20 #include <LLDW_PAINTER_impl.h>
23 #include <LLUI_DISPLAY.h>
26 #include "ui_drawing.h"
36 #define LOG_DRAW_START(fn) LLTRACE_record_event_u32(LLUI_EVENT_group, LLUI_EVENT_offset + UI_LOG_DRAW, \
37 CONCAT_DEFINES(LOG_DRAW_, fn))
38 #define LOG_DRAW_END(s) LLTRACE_record_event_end_u32(LLUI_EVENT_group, LLUI_EVENT_offset + UI_LOG_DRAW, (s))
43 #define LOG_DRAW_drawThickFadedPoint 100
44 #define LOG_DRAW_drawThickFadedLine 101
45 #define LOG_DRAW_drawThickFadedCircle 102
46 #define LOG_DRAW_drawThickFadedCircleArc 103
47 #define LOG_DRAW_drawThickFadedEllipse 104
48 #define LOG_DRAW_drawThickLine 105
49 #define LOG_DRAW_drawThickCircle 106
50 #define LOG_DRAW_drawThickEllipse 107
51 #define LOG_DRAW_drawThickCircleArc 108
53 #define LOG_DRAW_drawFlippedImage 200
54 #define LOG_DRAW_drawRotatedImageNearestNeighbor 201
55 #define LOG_DRAW_drawRotatedImageBilinear 202
56 #define LOG_DRAW_drawScaledImageNearestNeighbor 203
57 #define LOG_DRAW_drawScaledImageBilinear 204
58 #define LOG_DRAW_drawScaledStringBilinear 205
59 #define LOG_DRAW_drawCharWithRotationBilinear 206
60 #define LOG_DRAW_drawCharWithRotationNearestNeighbor 207
66 void LLDW_PAINTER_IMPL_drawThickFadedPoint(MICROUI_GraphicsContext *gc, jint x, jint y, jint thickness, jint fade) {
67 if (((thickness > 0) || (fade > 0)) && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) &
68 LLDW_PAINTER_IMPL_drawThickFadedPoint)) {
69 LOG_DRAW_START(drawThickFadedPoint);
70 DRAWING_Status status = UI_DRAWING_drawThickFadedPoint(gc, x, y, thickness, fade);
71 LLUI_DISPLAY_setDrawingStatus(status);
76 void LLDW_PAINTER_IMPL_drawThickFadedLine(MICROUI_GraphicsContext *gc, jint startX, jint startY, jint endX, jint endY,
77 jint thickness, jint fade, DRAWING_Cap startCap, DRAWING_Cap endCap) {
78 if (((thickness > 0) || (fade > 0)) && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) &
79 LLDW_PAINTER_IMPL_drawThickFadedLine)) {
80 LOG_DRAW_START(drawThickFadedLine);
81 DRAWING_Status status = UI_DRAWING_drawThickFadedLine(gc, startX, startY, endX, endY, thickness, fade, startCap,
83 LLUI_DISPLAY_setDrawingStatus(status);
88 void LLDW_PAINTER_IMPL_drawThickFadedCircle(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter, jint thickness,
90 if (((thickness > 0) || (fade > 0)) && (diameter > 0) && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) &
91 LLDW_PAINTER_IMPL_drawThickFadedCircle))
93 LOG_DRAW_START(drawThickFadedCircle);
94 DRAWING_Status status = UI_DRAWING_drawThickFadedCircle(gc, x, y, diameter, thickness, fade);
95 LLUI_DISPLAY_setDrawingStatus(status);
100 void LLDW_PAINTER_IMPL_drawThickFadedCircleArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter,
101 jfloat startAngle, jfloat arcAngle, jint thickness, jint fade,
102 DRAWING_Cap start, DRAWING_Cap end) {
103 if (((thickness > 0) || (fade > 0)) && (diameter > 0) && ((int32_t)arcAngle != 0) && LLUI_DISPLAY_requestDrawing(gc,
107 LLDW_PAINTER_IMPL_drawThickFadedCircleArc))
109 LOG_DRAW_START(drawThickFadedCircleArc);
110 DRAWING_Status status = UI_DRAWING_drawThickFadedCircleArc(gc, x, y, diameter, startAngle, arcAngle, thickness,
112 LLUI_DISPLAY_setDrawingStatus(status);
113 LOG_DRAW_END(status);
117 void LLDW_PAINTER_IMPL_drawThickFadedEllipse(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
118 jint thickness, jint fade) {
119 if (((thickness > 0) || (fade > 0)) && (width > 0) && (height > 0) && LLUI_DISPLAY_requestDrawing(gc,
121 LLDW_PAINTER_IMPL_drawThickFadedEllipse))
123 LOG_DRAW_START(drawThickFadedEllipse);
124 DRAWING_Status status = UI_DRAWING_drawThickFadedEllipse(gc, x, y, width, height, thickness, fade);
125 LLUI_DISPLAY_setDrawingStatus(status);
126 LOG_DRAW_END(status);
130 void LLDW_PAINTER_IMPL_drawThickLine(MICROUI_GraphicsContext *gc, jint startX, jint startY, jint endX, jint endY,
132 if ((thickness > 0) && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) & LLDW_PAINTER_IMPL_drawThickLine)) {
133 LOG_DRAW_START(drawThickLine);
134 DRAWING_Status status = UI_DRAWING_drawThickLine(gc, startX, startY, endX, endY, thickness);
135 LLUI_DISPLAY_setDrawingStatus(status);
136 LOG_DRAW_END(status);
140 void LLDW_PAINTER_IMPL_drawThickCircle(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter, jint thickness) {
141 if ((thickness > 0) && (diameter > 0) && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) &
142 LLDW_PAINTER_IMPL_drawThickCircle)) {
143 LOG_DRAW_START(drawThickCircle);
144 DRAWING_Status status = UI_DRAWING_drawThickCircle(gc, x, y, diameter, thickness);
145 LLUI_DISPLAY_setDrawingStatus(status);
146 LOG_DRAW_END(status);
150 void LLDW_PAINTER_IMPL_drawThickEllipse(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
152 if ((thickness > 0) && (width > 0) && (height > 0) && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) &
153 LLDW_PAINTER_IMPL_drawThickEllipse))
155 LOG_DRAW_START(drawThickEllipse);
156 DRAWING_Status status = UI_DRAWING_drawThickEllipse(gc, x, y, width, height, thickness);
157 LLUI_DISPLAY_setDrawingStatus(status);
158 LOG_DRAW_END(status);
162 void LLDW_PAINTER_IMPL_drawThickCircleArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter, jfloat startAngle,
163 jfloat arcAngle, jint thickness) {
164 if ((thickness > 0) && (diameter > 0) && ((int32_t)arcAngle != 0) && LLUI_DISPLAY_requestDrawing(gc,
166 LLDW_PAINTER_IMPL_drawThickCircleArc))
168 LOG_DRAW_START(drawThickCircleArc);
169 DRAWING_Status status = UI_DRAWING_drawThickCircleArc(gc, x, y, diameter, startAngle, arcAngle, thickness);
170 LLUI_DISPLAY_setDrawingStatus(status);
171 LOG_DRAW_END(status);
175 void LLDW_PAINTER_IMPL_drawFlippedImage(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
176 jint width, jint height, jint x, jint y, DRAWING_Flip transformation,
178 if (!LLUI_DISPLAY_isImageClosed(img) && (alpha > 0)
179 && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) & LLDW_PAINTER_IMPL_drawFlippedImage)) {
180 LOG_DRAW_START(drawFlippedImage);
181 DRAWING_Status status = UI_DRAWING_drawFlippedImage(gc, img, regionX, regionY, width, height, x, y,
182 transformation, alpha);
183 LLUI_DISPLAY_setDrawingStatus(status);
184 LOG_DRAW_END(status);
188 void LLDW_PAINTER_IMPL_drawRotatedImageNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
189 jint rotationX, jint rotationY, jfloat angle, jint alpha) {
190 if (!LLUI_DISPLAY_isImageClosed(img) && (alpha > 0)
191 && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) & LLDW_PAINTER_IMPL_drawRotatedImageNearestNeighbor)) {
192 LOG_DRAW_START(drawRotatedImageNearestNeighbor);
193 DRAWING_Status status = UI_DRAWING_drawRotatedImageNearestNeighbor(gc, img, x, y, rotationX, rotationY, angle,
195 LLUI_DISPLAY_setDrawingStatus(status);
196 LOG_DRAW_END(status);
200 void LLDW_PAINTER_IMPL_drawRotatedImageBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
201 jint rotationX, jint rotationY, jfloat angle, jint alpha) {
202 if (!LLUI_DISPLAY_isImageClosed(img) && (alpha > 0)
203 && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) & LLDW_PAINTER_IMPL_drawRotatedImageBilinear)) {
204 LOG_DRAW_START(drawRotatedImageBilinear);
205 DRAWING_Status status = UI_DRAWING_drawRotatedImageBilinear(gc, img, x, y, rotationX, rotationY, angle, alpha);
206 LLUI_DISPLAY_setDrawingStatus(status);
207 LOG_DRAW_END(status);
211 void LLDW_PAINTER_IMPL_drawScaledImageNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
212 jfloat factorX, jfloat factorY, jint alpha) {
213 if (!LLUI_DISPLAY_isImageClosed(img) && (alpha > 0) && (factorX > 0.f) && (factorY > 0.f)
214 && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) & LLDW_PAINTER_IMPL_drawScaledImageNearestNeighbor)) {
215 LOG_DRAW_START(drawScaledImageNearestNeighbor);
216 DRAWING_Status status = UI_DRAWING_drawScaledImageNearestNeighbor(gc, img, x, y, factorX, factorY, alpha);
217 LLUI_DISPLAY_setDrawingStatus(status);
218 LOG_DRAW_END(status);
222 void LLDW_PAINTER_IMPL_drawScaledImageBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
223 jfloat factorX, jfloat factorY, jint alpha) {
224 if (!LLUI_DISPLAY_isImageClosed(img) && (alpha > 0) && (factorX > 0.f) && (factorY > 0.f)
225 && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback) & LLDW_PAINTER_IMPL_drawScaledImageBilinear)) {
226 LOG_DRAW_START(drawScaledImageBilinear);
227 DRAWING_Status status = UI_DRAWING_drawScaledImageBilinear(gc, img, x, y, factorX, factorY, alpha);
228 LLUI_DISPLAY_setDrawingStatus(status);
229 LOG_DRAW_END(status);
233 void LLDW_PAINTER_IMPL_drawScaledStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
234 MICROUI_Font *font, jint x, jint y, jfloat xRatio, jfloat yRatio) {
235 if ((length > 0) && (xRatio > 0) && (yRatio > 0)
236 && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback)LLDW_PAINTER_IMPL_drawScaledStringBilinear)) {
237 LOG_DRAW_START(drawScaledStringBilinear);
238 DRAWING_Status status = UI_DRAWING_drawScaledStringBilinear(gc, chars, length, font, x, y, xRatio, yRatio);
239 LLUI_DISPLAY_setDrawingStatus(status);
240 LOG_DRAW_END(status);
244 void LLDW_PAINTER_IMPL_drawScaledRenderableStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
245 MICROUI_Font *font, jint width,
246 MICROUI_RenderableString *renderableString, jint x, jint y,
247 jfloat xRatio, jfloat yRatio) {
248 if ((length > 0) && (xRatio > 0) && (yRatio > 0)
249 && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback)LLDW_PAINTER_IMPL_drawScaledRenderableStringBilinear)) {
250 LOG_DRAW_START(drawScaledStringBilinear);
251 DRAWING_Status status = UI_DRAWING_drawScaledRenderableStringBilinear(gc, chars, length, font, width,
252 renderableString, x, y, xRatio, yRatio);
253 LLUI_DISPLAY_setDrawingStatus(status);
254 LOG_DRAW_END(status);
258 void LLDW_PAINTER_IMPL_drawCharWithRotationBilinear(MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font, jint x,
259 jint y, jint xRotation, jint yRotation, jfloat angle, jint alpha) {
260 if ((alpha > 0) && LLUI_DISPLAY_requestDrawing(gc, (SNI_callback)LLDW_PAINTER_IMPL_drawCharWithRotationBilinear)) {
261 LOG_DRAW_START(drawCharWithRotationBilinear);
262 DRAWING_Status status = UI_DRAWING_drawCharWithRotationBilinear(gc, c, font, x, y, xRotation, yRotation, angle,
264 LLUI_DISPLAY_setDrawingStatus(status);
265 LOG_DRAW_END(status);
269 void LLDW_PAINTER_IMPL_drawCharWithRotationNearestNeighbor(MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
270 jint x, jint y, jint xRotation, jint yRotation, jfloat angle,
273 LLUI_DISPLAY_requestDrawing(gc, (SNI_callback)LLDW_PAINTER_IMPL_drawCharWithRotationNearestNeighbor)) {
274 LOG_DRAW_START(drawCharWithRotationNearestNeighbor);
275 DRAWING_Status status = UI_DRAWING_drawCharWithRotationNearestNeighbor(gc, c, font, x, y, xRotation, yRotation,
277 LLUI_DISPLAY_setDrawingStatus(status);
278 LOG_DRAW_END(status);