1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Canvas Management (Canvas) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_canvas.h" |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_canvas_memory_define PORTABLE C */ |
36 |
|
|
/* 6.3.0 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This function assigns canvas memory pointer and size */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* canvas Canvas control block */ |
48 |
|
|
/* memory Canvas memory address */ |
49 |
|
|
/* memsize Canvas memory size */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* status Completion status */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _gx_canvas_dirty_mark Set the canvas dirty flag */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLED BY */ |
60 |
|
|
/* */ |
61 |
|
|
/* Application software */ |
62 |
|
|
/* */ |
63 |
|
|
/**************************************************************************/ |
64 |
|
2 |
UINT _gx_canvas_memory_define(GX_CANVAS *canvas, GX_COLOR *memory, ULONG memsize) |
65 |
|
|
{ |
66 |
|
|
#ifdef GX_ENABLE_CANVAS_PARTIAL_FRAME_BUFFER |
67 |
|
|
GX_DISPLAY *display = canvas -> gx_canvas_display; |
68 |
|
|
ULONG canvas_size; |
69 |
|
|
|
70 |
|
|
if (!display) |
71 |
|
|
{ |
72 |
|
|
return GX_INVALID_DISPLAY; |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
canvas_size = (ULONG)(display -> gx_display_driver_row_pitch_get((USHORT)canvas -> gx_canvas_x_resolution) * canvas -> gx_canvas_y_resolution); |
76 |
|
|
|
77 |
|
|
if (memsize < canvas_size) |
78 |
|
|
{ |
79 |
|
|
canvas -> gx_canvas_status |= GX_CANVAS_PARTIAL_FRAME_BUFFER; |
80 |
|
|
} |
81 |
|
|
#endif |
82 |
|
|
|
83 |
|
|
/* change the memory pointer value */ |
84 |
|
2 |
canvas -> gx_canvas_memory = memory; |
85 |
|
|
|
86 |
|
|
/* change the memory size */ |
87 |
|
2 |
canvas -> gx_canvas_memory_size = memsize; |
88 |
|
|
|
89 |
|
|
/* mark the canvas dirty so that it get refreshed */ |
90 |
|
2 |
_gx_canvas_dirty_mark(canvas, GX_NULL); |
91 |
|
|
|
92 |
|
|
/* Return successful status. */ |
93 |
|
2 |
return(GX_SUCCESS); |
94 |
|
|
} |
95 |
|
|
|