Arm-2D  
2D Image Processing Library for Cortex-M Processors
arm_2d_helper_scene.h
1/*
2 * Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19/* ----------------------------------------------------------------------
20 * Project: Arm-2D Library
21 * Title: #include "arm_2d_helper_scene.h"
22 * Description: Public header file for the scene service
23 *
24 * $Date: 20. Dec 2024
25 * $Revision: V.1.8.5
26 *
27 * Target Processor: Cortex-M cores
28 * -------------------------------------------------------------------- */
29
30#ifndef __ARM_2D_HELPER_SCENE_H__
31#define __ARM_2D_HELPER_SCENE_H__
32
33/*============================ INCLUDES ======================================*/
34#include "arm_2d_helper_pfb.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#if defined(__clang__)
41# pragma clang diagnostic push
42# pragma clang diagnostic ignored "-Wunknown-warning-option"
43# pragma clang diagnostic ignored "-Wreserved-identifier"
44# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
45# pragma clang diagnostic ignored "-Wpadded"
46# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
47#endif
48
49/* OOC header, please DO NOT modify */
50#ifdef __ARM_2D_HELPER_SCENE_IMPLEMENT__
51# define __ARM_2D_IMPL__
52# undef __ARM_2D_HELPER_SCENE_IMPLEMENT__
53#elif defined(__ARM_2D_HELPER_SCENE_INHERIT__)
54# undef __ARM_2D_HELPER_SCENE_INHERIT__
55# define __ARM_2D_INHERIT__
56#endif
57#include "arm_2d_utils.h"
58
59/*============================ MACROS ========================================*/
60
61/*!
62 * \addtogroup Deprecated
63 * @{
64 */
65#define arm_2d_scene_player_set_switching_period \
66 arm_2d_scene_player_set_auto_switching_period
67/*! @} */
68
69/*!
70 * \addtogroup gHelper 8 Helper Services
71 * @{
72 */
73/*============================ MACROFIED FUNCTIONS ===========================*/
74
75/*!
76 * \brief register / update the evtOnDrawNavigation event handler. You can use
77 * this event to draw an ALWAY-TOP navigation bar or title during switching
78 * period.
79 *
80 * \param[in] __DISP_ADAPTER_PTR the target scene player
81 * \param[in] __DRAW_HANDLER the event handler to draw the navigation bar and/or
82 * titles
83 * \param[in] __USER_TARGET_PTR the address of an user specified object. If it
84 * is NULL, ptThis will be used instead.
85 * \param[in] ... an optional dirty region list for the navigation layer. If
86 * ommited, NULL is used.
87 * \note if the optional dirty region list is omitted and the normal scene
88 * doesn't cover the region of the content in the navigation layer,
89 * you won't see the content.
90 * \return arm_2d_err_t the operation result
91 */
92#define arm_2d_scene_player_register_on_draw_navigation_event_handler( \
93 __SCENE_PLAYER_PTR, \
94 __DRAW_HANDLER, \
95 __USER_TARGET_PTR, \
96 ...) \
97 __arm_2d_scene_player_register_on_draw_navigation_event_handler( \
98 (__SCENE_PLAYER_PTR), \
99 (__DRAW_HANDLER), \
100 (__USER_TARGET_PTR), \
101 (NULL,##__VA_ARGS__))
102
103/*!
104 * \brief configure the scene switching mode
105 *
106 * \param[in] __DISP_ADAPTER_PTR the target scene player
107 * \param[in] __SWITCH_MODE a switching mode object
108 * \param[in] ... an optional configurations for the switching
109 */
110#define arm_2d_scene_player_set_switching_mode(__SCENE_PLAYER_PTR, \
111 __SWITCH_MODE, \
112 ...) \
113 __arm_2d_scene_player_set_switching_mode((__SCENE_PLAYER_PTR), \
114 &(__SWITCH_MODE), \
115 (0,##__VA_ARGS__))
116
117/*!
118 * \brief register / update the evtBeforeSwitching event handler. You can use
119 * this event to prepare next scenes.
120 *
121 * \param[in] ptThis the target scene player
122 * \param[in] fnHandler the event handler
123 * \param[in] ... optional, the address of an user specified object.
124 * \return arm_2d_err_t the operation result
125 */
126#define arm_2d_scene_player_register_before_switching_event_handler( \
127 __SCENE_PLAYER_PTR, \
128 __HANDLER, \
129 ...) \
130 __arm_2d_scene_player_register_before_switching_event_handler( \
131 (__SCENE_PLAYER_PTR), \
132 (__HANDLER), \
133 (NULL,##__VA_ARGS__))
134
135
136/*!
137 * \brief register / update the evtBeforeDeposing event handler.
138 *
139 * \param[in] ptThis the target scene player
140 * \param[in] fnHandler the event handler
141 * \param[in] ... optional, the address of an user specified object.
142 * \return arm_2d_err_t the operation result
143 */
144#define arm_2d_scene_player_register_before_deposing_event_handler( \
145 __SCENE_PLAYER_PTR, \
146 __HANDLER, \
147 ...) \
148 __arm_2d_scene_player_register_before_deposing_event_handler( \
149 (__SCENE_PLAYER_PTR), \
150 (__HANDLER), \
151 (NULL,##__VA_ARGS__))
152
153/*============================ TYPES =========================================*/
154
155/*!
156 * \brief scene switching mode
157 */
158typedef enum {
159
160 /* valid switching visual effects begin */
161 ARM_2D_SCENE_SWITCH_CFG_NONE = 0, //!< no switching visual effect
162 ARM_2D_SCENE_SWITCH_CFG_USER = 1, //!< user defined switching visual effect
163 ARM_2D_SCENE_SWITCH_CFG_FADE_WHITE = 2, //!< fade in fade out (white)
164 ARM_2D_SCENE_SWITCH_CFG_FADE_BLACK = 3, //!< fade in fade out (black)
169 ARM_2D_SCENE_SWITCH_CFG_ERASE_LEFT = 8, //!< erase to the right
171 ARM_2D_SCENE_SWITCH_CFG_ERASE_UP, //!< erase to the top
172 ARM_2D_SCENE_SWITCH_CFG_ERASE_DOWN, //!< erase to the bottom
177
178 /* valid switching visual effects end */
179 __ARM_2D_SCENE_SWITCH_CFG_VALID, //!< For internal user only
180
181 ARM_2D_SCENE_SWITCH_CFG_IGNORE_OLD_BG = _BV(8), //!< ignore the background of the old scene
182 ARM_2D_SCENE_SWITCH_CFG_IGNORE_OLD_SCEBE = _BV(9), //!< ignore the old scene
183 ARM_2D_SCENE_SWITCH_CFG_IGNORE_NEW_BG = _BV(10), //!< ignore the background of the new scene
184 ARM_2D_SCENE_SWITCH_CFG_IGNORE_NEW_SCEBE = _BV(11), //!< ignore the new scene
185
186 ARM_2D_SCENE_SWITCH_CFG_DEFAULT_BG_WHITE = 0 << 12, //!< use white as default background
187 ARM_2D_SCENE_SWITCH_CFG_DEFAULT_BG_BLACK = 1 << 12, //!< use black as default background
188 ARM_2D_SCENE_SWITCH_CFG_DEFAULT_BG_USER = 2 << 12, //!< use user defined default background
189
190 __ARM_2D_SCENE_SWTICH_CFG_IGNORE_msk = 0x0F << 8, //!< For internal user only
191 __ARM_2D_SCENE_SWTICH_CFG_IGNORE_pos = 8, //!< For internal user only
192 __ARM_2D_SCENE_SWTICH_CFG_DEFAULT_BG_msk = 3 << 12, //!< For internal user only
193 __ARM_2D_SCENE_SWTICH_CFG_DEFAULT_BG_pos = 12, //!< For internal user only
194
195 ARM_2D_SCENE_SWITCH_CFG_BG_BLUR = _BV(14), //!< blurring the background when possible
196
198
199/*!
200 * \brief the scene switching status
201 *
202 */
203typedef enum {
204 ARM_2D_SCENE_SWITCH_STATUS_AUTO, //!< time-based auto switching
205 ARM_2D_SCENE_SWITCH_STATUS_MANUAL, //!< offset-based manual switching
206 ARM_2D_SCENE_SWITCH_STATUS_MANUAL_CANCEL, //!< cancel existing manual switching
207 ARM_2D_SCENE_SWITCH_STATUS_MANUAL_AUTO_CPL, //!< automatically finish the rest part of switching.
209
210/*!
211 * \brief an internal data structure for scene switching
212 *
213 * \note Please do not use it.
214 */
216
217 struct {
218 uint8_t chMode; //!< the switch visual effect
219 uint8_t bIgnoreOldSceneBG : 1; //!< when set, ignore the background of the old scene
220 uint8_t bIgnoreOldScene : 1; //!< when set, ignore the old scene
221 uint8_t bIgnoreNewSceneBG : 1; //!< when set, ignore the background of the new scene
222 uint8_t bIgnoreNewScene : 1; //!< when set, ignore the new scene
223 uint8_t u2DefaultBG : 2; //!< the default background
224 uint8_t bBlurBG : 1; //!< when set, enable blurring when possible
225 uint8_t : 1;
226 } Feature;
227 uint16_t hwSetting; //!< the setting value
228
230
232
233/*!
234 * \brief scene switching mode descriptor
235 */
236typedef const struct {
237 uint8_t chEffects; //!< switching effects
238 arm_2d_helper_draw_handler_t *fnSwitchDrawer; //!< switching algorithm
239
240 void (*fnOnRequestChangeSwitchingStatus)(arm_2d_scene_player_t *ptThis); //!< on request change-switch-status event handler
241 void (*fnOnSwitchComplete) (arm_2d_scene_player_t *ptThis); //!< on request switch complete event handler
243
244/*!
245 * \brief a class for describing scenes which are the combination of a
246 * background and a foreground with a dirty-region-list support
247 *
248 */
249typedef struct arm_2d_scene_t arm_2d_scene_t;
251ARM_PRIVATE(
252 arm_2d_scene_t *ptNext; //!< next scene
253
254 struct {
255 uint8_t bLoaded : 1;
256 uint8_t : 7;
257 };
259 arm_2d_scene_player_t *ptPlayer; //!< points to the host scene player
260
261 arm_2d_colour_t tCanvas; //!< the canvas colour
262
263 /*! \note Please do NOT use it unless it is necessary */
264 arm_2d_helper_draw_handler_t *fnBackground;
265
266 arm_2d_region_list_item_t *ptDirtyRegion; //!< dirty region list for the scene
267 arm_2d_helper_draw_handler_t *fnScene; //!< the function pointer for the scene
268
269 void (*fnOnLoad)(arm_2d_scene_t *ptThis); //!< on load event handler
270 void (*fnAfterSwitch)(arm_2d_scene_t *ptThis); //!< after scene switching event handler
271 void (*fnOnBGStart)(arm_2d_scene_t *ptThis); //!< on-start-drawing-background event handler
272 void (*fnOnBGComplete)(arm_2d_scene_t *ptThis); //!< on-complete-drawing-background event handler
273 void (*fnOnFrameStart)(arm_2d_scene_t *ptThis); //!< on-frame-start event handler
274 void (*fnOnFrameCPL)(arm_2d_scene_t *ptThis); //!< on-frame-complete event handler
275
276 /*!
277 * \note We can use this event to initialize/generate the new(next) scene
278 */
279 void (*fnBeforeSwitchOut)(arm_2d_scene_t *ptThis); //!< before-scene-switch-out event handler
280
281 /*!
282 * \note We use fnDepose to free the resources
283 */
284 void (*fnDepose)(arm_2d_scene_t *ptThis); //!< on-scene-depose event handler
285 struct {
286 uint8_t bOnSwitchingIgnoreBG : 1; //!< ignore background during switching period
287 uint8_t bOnSwitchingIgnoreScene : 1; //!< ignore forground during switching period
288 uint8_t : 2;
289 uint8_t : 3;
290 uint8_t bUseDirtyRegionHelper : 1; //!< indicate whether use the built-in dirty region helper.
291 };
292
293 arm_2d_helper_dirty_region_t tDirtyRegionHelper;
294};
295
296/*!
297 * \brief the scene player event handler
298 *
299 * \param[in] pTarget a user attached target address
300 * \param[in] ptPlayer the scene player
301 * \param[in] ptScene the old scene that is to be switched out
302 */
304 void *pTarget,
305 arm_2d_scene_player_t *ptPlayer,
306 arm_2d_scene_t *ptScene);
307
308/*!
309 * \brief on low level render event
310 */
311typedef struct arm_2d_scene_evt_t {
312 arm_2d_scene_evt_handler_t *fnHandler; //!< event handler function
313 void *pTarget; //!< user attached target
315
316/*!
317 * \brief a class to manage scenes
318 *
319 */
321 inherit(arm_2d_helper_pfb_t); //!< inherit from arm_2d_helper_pfb_t
322
323 struct {
324 uint32_t wMin;
325 uint32_t wMax;
326 uint64_t dwTotal;
327 uint64_t dwRenderTotal;
328 uint32_t wAverage;
329 float fCPUUsage;
330 uint16_t hwIterations;
331 uint16_t hwFrameCounter;
332 uint32_t wLCDLatency;
333 int64_t lTimestamp;
334 } Benchmark;
335
336 ARM_PRIVATE(
337 struct {
338 arm_2d_scene_t *ptHead; //!< points to the head of the FIFO
339 arm_2d_scene_t *ptTail; //!< points to the tail of the FIFO
340 } SceneFIFO; //!< Scene FIFO
341
342 struct {
343
344 uint8_t bNextSceneReq : 1; //!< a flag to request switching-to-the next-scene
345 uint8_t bManualSwitchReq : 1; //!< a flag to request using manual switching
346 uint8_t bCancelSwitchReq : 1; //!< a flag to request cancel a manual switching
347 uint8_t bFinishManualSwitchReq : 1; //!< a flag to request finishing a manual switching
348 uint8_t : 4;
349
350 uint8_t bManualSwitch : 1; //!< manual switching
351 uint8_t bCancelSwitch : 1; //!< cancel a manual switching
352 uint8_t bFinishManualSwitch : 1; //!< finish a manual switching
353 uint8_t bFirstFrameAfterSwitch : 1;
354 uint8_t : 4;
355
356 uint8_t bSwitchCPL : 1; //!< indication of scene switching completion
357 uint8_t bUpdateBG : 1; //!< update the background of the current scene
358 uint8_t : 2;
359 uint8_t bCallOldSceneFrameCPL : 1; //!< call the old scene frame complete event handler
360 uint8_t bCallNewSceneFrameCPL : 1; //!< call the new scene frame complete event handler
361 uint8_t bCallOldSceneBGCPL : 1; //!< call the old scene Background complete event handler
362 uint8_t bCallNewSceneBGCPL : 1; //!< call the new scene Background complete event handler
363
364 uint8_t chState; //!< the state of the FSM used by runtime.
365 } Runtime; //!< scene player runtime
366
367 struct {
368 arm_2d_scene_switch_mode_t *ptMode; //!< the switching mode
369 uint8_t chState; //!< FSM state
370 int16_t iOffset; //!< erase offset
371 union {
372 struct {
373 uint8_t chOpacity; //!< opacity of the cover
374 bool bIsFadeBlack; //!< the colour of the cover
375 } Fade;
376 struct {
377 arm_2d_tile_t tSceneWindow; //!< scene window
378 arm_2d_tile_t tTemp; //!< a temp tile
379 } Erase;
380 struct {
381 arm_2d_tile_t tSceneWindow; //!< scene window
382 arm_2d_filter_iir_blur_descriptor_t tBlurOP; //!< for blur
383 } FlyIn;
384 struct {
385 arm_2d_tile_t tSceneWindow; //!< scene window
386 } Slide;
387 };
388 __arm_2d_helper_scene_switch_t tConfig; //!< the switching configuration
389
390 arm_2d_location_t tTouchPointer; //!< the coordinate offset for manual switching mode, used in erasing, sliding etc.
391 int16_t iFullLength; //!< the full length of the axis of switching
392 uint16_t hwPeriod; //!< the switching should finish in specified millisecond
393 int64_t lTimeStamp;
394 }Switch;
395
396 struct {
397 /*!
398 * \note We can use this event to initialize/generate the new(next) scene
399 */
400 arm_2d_scene_evt_t evtBeforeSwitching; //!< before-scene-switch-out event handler
401 arm_2d_scene_evt_t evtBeforeDeposing; //!< before-scene-deposing event handler
402 } Events;
404};
405
406/*============================ GLOBAL VARIABLES ==============================*/
407
408extern
409arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_NONE;
410
411extern
412arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_USER;
413
414extern
415arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_FADE_WHITE;
416
417extern
418arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_FADE_BLACK;
419
420extern
421arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_SLIDE_LEFT;
422
423extern
424arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_SLIDE_RIGHT;
425
426extern
427arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_SLIDE_UP;
428
429extern
430arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_SLIDE_DOWN;
431
432extern
433arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_ERASE_LEFT;
434
435extern
436arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_ERASE_RIGHT;
437
438extern
439arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_ERASE_UP;
440
441extern
442arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_ERASE_DOWN;
443
444extern
445arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_FLY_IN_FROM_LEFT;
446
447extern
448arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_FLY_IN_FROM_RIGHT;
449
450extern
451arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_FLY_IN_FROM_TOP;
452
453extern
454arm_2d_scene_switch_mode_t ARM_2D_SCENE_SWITCH_MODE_FLY_IN_FROM_BOTTOM;
455
456/*============================ LOCAL VARIABLES ===============================*/
457/*============================ PROTOTYPES ====================================*/
458
459/*!
460 * \brief flush the scene FIFO
461 *
462 * \param[in] ptThis the target scene player
463 */
464extern
465ARM_NONNULL(1)
467
468/*!
469 * \brief append a set of scenes to a scene player
470 *
471 * \param[in] ptThis the target scene player
472 * \param[in] ptScenes a scene array
473 * \param[in] hwCount the number of scenes in the array
474 */
475extern
476ARM_NONNULL(1)
478 arm_2d_scene_t *ptScenes,
479 int_fast16_t hwCount);
480
481/*!
482 * \brief request updating the background of the current scene
483 * \param[in] ptThis the target scene player
484 */
485ARM_NONNULL(1)
487
488
489/*!
490 * \brief get the screen size of a specified display adapter.
491 *
492 * \param[in] ptThis the target scene player
493 * \return arm_2d_size_t the screen size
494 */
495extern
496ARM_NONNULL(1)
498
499/*!
500 * \brief request switching to the next scene safely
501 *
502 * \param[in] ptThis the target scene player
503 *
504 * \note Once received a request, the scene player will only switch to the
505 * next scene at the end of a frame.
506 */
507extern
508ARM_NONNULL(1)
510
511/*!
512 * \brief configure the scene switching mode
513 *
514 * \param[in] ptThis the target scene player
515 * \param[in] ptMode a switching mode object
516 * \param[in] hwSettings configurations for the switching
517 */
518extern
519ARM_NONNULL(1)
522 uint16_t hwSettings);
523
524/*!
525 * \brief read the current scene switching mode
526 *
527 * \param[in] ptThis the target scene player
528 * \return uint16_t the current setting value for the scene switching mode
529 */
530extern
531ARM_NONNULL(1)
533
534/*!
535 * \brief configure the scene switching period in auto-switching
536 *
537 * \param[in] ptThis the target scene player
538 * \param[in] iMS period in millisecond
539 */
540extern
541ARM_NONNULL(1)
543 int_fast16_t iMS);
544
545extern
546ARM_NONNULL(1)
547/*!
548 * \brief use manual switch mode and set the offset
549 *
550 * \param[in] ptThis the target scene player
551 * \param[in] tPointer the touch pointer location
552 */
554 arm_2d_location_t tPointer);
555
556extern
557ARM_NONNULL(1)
558/*!
559 * \brief end the manual switching and finish the left part in a specific period (ms)
560 *
561 * \param[in] ptThis the target scene player
562 * \param[in] bMoveToPreviousScene a boolean value indicating whether move back to the
563 * previous scene, i.e. whether cancel the current switching
564 * \param iInMS the planned period as if the switching is done in auto-switching mode
565 * \return arm_2d_err_t configuration result
566 */
568 bool bMoveToPreviousScene,
569 int_fast16_t iInMS);
570
571/*!
572 * \brief check whether scene player is switching scenes
573 *
574 * \param[in] ptThis the target scene player
575 * \return true the scene player is switching scenes
576 * \return false the scene player stays in tge current scene.
577 */
578extern
579ARM_NONNULL(1)
581
582/*!
583 * \brief get the scene player switching status
584 *
585 * \param[in] ptThis the target scene player
586 * \return arm_2d_scene_player_switch_status_t the switching status
587 */
588extern
589ARM_NONNULL(1)
592
593/*!
594 * \brief register / update the evtOnDrawNavigation event handler. You can use
595 * this event to draw an ALWAY-TOP navigation bar or title during switching
596 * period.
597 *
598 * \param[in] ptThis the target scene player
599 * \param[in] fnHandler the event handler to draw the navigation bar and/or titles
600 * \param[in] pTarget the address of an user specified object. If it is NULL,
601 * ptThis will be used instead.
602 * \param[in] ptDirtyRegions a dirty region list for the navigation layer.
603 * \note if ptDirtyRegions is NULL and the normal scene doesn't cover the region
604 * of the content in the navigation layer, you won't see the content.
605 * \return arm_2d_err_t the operation result
606 */
607extern
608ARM_NONNULL(1)
610 arm_2d_scene_player_t *ptThis,
611 arm_2d_helper_draw_handler_t *fnHandler,
612 void *pTarget,
613 arm_2d_region_list_item_t *ptDirtyRegions);
614
615/*!
616 * \brief hide the navigation layer
617 * \param[in] ptThis an initialised scene player
618 */
619extern
620ARM_NONNULL(1)
622
623/*!
624 * \brief show the navigation layer if there is a valid one
625 * \param[in] ptThis an initialised scene player
626 */
627extern
628ARM_NONNULL(1)
630
631/*!
632 * \brief register / update the evtBeforeSwitching event handler. You can use
633 * this event to prepare next scenes.
634 *
635 * \param[in] ptThis the target scene player
636 * \param[in] fnHandler the event handler
637 * \param[in] pTarget the address of an user specified object.
638 * \return arm_2d_err_t the operation result
639 */
640extern
641ARM_NONNULL(1)
643 arm_2d_scene_player_t *ptThis,
645 void *pTarget);
646
647/*!
648 * \brief register / update the evtBeforeDeposing event handler. You can use
649 * this event to prepare next scenes.
650 *
651 * \param[in] ptThis the target scene player
652 * \param[in] fnHandler the event handler
653 * \param[in] pTarget the address of an user specified object.
654 * \return arm_2d_err_t the operation result
655 */
656extern
657ARM_NONNULL(1)
659 arm_2d_scene_player_t *ptThis,
661 void *pTarget);
662
663/*!
664 * \brief the scene player task function
665 *
666 * \param[in] ptThis the target scene player
667 *
668 * \note the event sequence of a scene:
669 * 1. when fnBackground is valid
670 * - invoke fnOnBGStart when it is valid
671 * - invoke fnBackground
672 * - invoke fnOnBGComplete when it is valid
673 * 2. invoke fnOnFrameStart when it is valid
674 * 3. invoke fnScene
675 * 4. invoke fnOnFrameCPL when it is valid
676 * 5. Check bNextSceneReq
677 * - false (0), go back to step 2
678 * - true, invoke fnDepose when it is valid and switch to the next scene
679 *
680 */
681extern
682ARM_NONNULL(1)
684
685/*!
686 * \brief append dirty regions to the a specified scene
687 * \param[in] ptScene the target scene
688 * \param[in] ptItems the dirty regions
689 * \param[in] tCount the number of dirty regions
690 * \retval true operation is successful
691 * \retval false the operation is failed.
692 */
693extern
694ARM_NONNULL(1,2)
697 size_t tCount);
698
699/*!
700 * \brief remove dirty regions from the a specified scene
701 * \param[in] ptScene the target scene
702 * \param[in] ptItems the dirty regions
703 * \param[in] tCount the number of dirty regions
704 * \retval true operation is successful
705 * \retval false the operation is failed.
706 */
707extern
708ARM_NONNULL(1,2)
711 size_t tCount);
712
713/*!
714 * \brief get the current scene of a given scene player
715 * \param[in] ptThis the target scene player
716 * \return arm_2d_scene_t * the current scene
717 */
718extern
719ARM_NONNULL(1)
722
723
724/*-----------------------------------------------------------------------------*
725 * Dynamic Dirty Region Helper Service *
726 *-----------------------------------------------------------------------------*/
727
728/*!
729 * \brief initialize a user dynamic dirty region
730 *
731 * \param[in] ptThis the target region list item. If it is NULL, this function will
732 * allocate an object from the heap
733 * \param[in] ptScene the target scene.
734 * \return arm_2d_region_list_item_t* the target region list item
735 */
736extern
739 arm_2d_scene_t *ptScene);
740
741/*!
742 * \brief depose a given user dynamic dirty region
743 *
744 * \param[in] ptThis the target region list item.
745 * \param[in] ptScene the target scene.
746 */
747extern
748ARM_NONNULL(1)
751 arm_2d_scene_t *ptScene);
752
753/*! @} */
754
755#if defined(__clang__)
756# pragma clang diagnostic pop
757#endif
758
759#ifdef __cplusplus
760}
761#endif
762
763#endif