mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
refactor: rename COLOR_TYPE_* to LCUI_COLOR_TYPE_*
This commit is contained in:
@@ -57,6 +57,21 @@ typedef unsigned char LCUI_BOOL;
|
||||
typedef unsigned char uchar_t;
|
||||
typedef void (*CallBackFunc)(void*,void*);
|
||||
|
||||
/** 色彩模式 */
|
||||
typedef enum LCUI_ColorType {
|
||||
LCUI_COLOR_TYPE_INDEX8, /**< 8位索引 */
|
||||
LCUI_COLOR_TYPE_GRAY8, /**< 8位灰度 */
|
||||
LCUI_COLOR_TYPE_RGB323, /**< RGB323 */
|
||||
LCUI_COLOR_TYPE_ARGB2222, /**< ARGB2222 */
|
||||
LCUI_COLOR_TYPE_RGB555, /**< RGB555 */
|
||||
LCUI_COLOR_TYPE_RGB565, /**< RGB565 */
|
||||
LCUI_COLOR_TYPE_RGB888, /**< RGB888 */
|
||||
LCUI_COLOR_TYPE_ARGB8888 /**< RGB8888 */
|
||||
} LCUI_ColorType;
|
||||
|
||||
#define LCUI_COLOR_TYPE_RGB LCUI_COLOR_TYPE_RGB888
|
||||
#define LCUI_COLOR_TYPE_ARGB LCUI_COLOR_TYPE_ARGB8888
|
||||
|
||||
typedef union LCUI_RGB565_ {
|
||||
short unsigned int value;
|
||||
struct {
|
||||
|
||||
+3
-18
@@ -37,21 +37,6 @@ LCUI_BEGIN_HEADER
|
||||
#undef RGB
|
||||
#endif
|
||||
|
||||
/** 色彩模式 */
|
||||
enum GraphColorType {
|
||||
COLOR_TYPE_INDEX8, /**< 8位索引 */
|
||||
COLOR_TYPE_GRAY8, /**< 8位灰度 */
|
||||
COLOR_TYPE_RGB323, /**< RGB323 */
|
||||
COLOR_TYPE_ARGB2222, /**< ARGB2222 */
|
||||
COLOR_TYPE_RGB555, /**< RGB555 */
|
||||
COLOR_TYPE_RGB565, /**< RGB565 */
|
||||
COLOR_TYPE_RGB888, /**< RGB888 */
|
||||
COLOR_TYPE_ARGB8888 /**< RGB8888 */
|
||||
};
|
||||
|
||||
#define COLOR_TYPE_RGB COLOR_TYPE_RGB888
|
||||
#define COLOR_TYPE_ARGB COLOR_TYPE_ARGB8888
|
||||
|
||||
/* 将两个像素点的颜色值进行alpha混合 */
|
||||
#define _ALPHA_BLEND(__back__ , __fore__, __alpha__) \
|
||||
((((__fore__-__back__)*(__alpha__))>>8)+__back__)
|
||||
@@ -108,7 +93,7 @@ enum GraphColorType {
|
||||
#define Graph_GetQuote(g) (g)->quote.is_valid ? (g)->quote.source:(g)
|
||||
|
||||
#define Graph_SetPixel(G, X, Y, C) \
|
||||
if( (G)->color_type == COLOR_TYPE_ARGB ) { \
|
||||
if( (G)->color_type == LCUI_COLOR_TYPE_ARGB ) { \
|
||||
(G)->argb[(G)->width*(Y)+(X)] = (C); \
|
||||
} else { \
|
||||
(G)->bytes[(G)->bytes_per_row*(Y)+(X)*3] = (C).value>>8; \
|
||||
@@ -163,8 +148,8 @@ LCUI_API int Graph_QuoteReadOnly(LCUI_Graph *self,
|
||||
/** 判断图像是否有Alpha透明通道 */
|
||||
#define Graph_HasAlpha(G) \
|
||||
((G)->quote.is_valid ? ( \
|
||||
(G)->quote.source->color_type == COLOR_TYPE_ARGB \
|
||||
) : ((G)->color_type == COLOR_TYPE_ARGB))
|
||||
(G)->quote.source->color_type == LCUI_COLOR_TYPE_ARGB \
|
||||
) : ((G)->color_type == LCUI_COLOR_TYPE_ARGB))
|
||||
|
||||
/** 判断图像是否有效 */
|
||||
#define Graph_IsValid(G) \
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ static int LCUICursor_LoadDefualtGraph(LCUI_Graph *buff)
|
||||
Graph_Free(buff);
|
||||
}
|
||||
Graph_Init(buff);
|
||||
buff->color_type = COLOR_TYPE_ARGB;
|
||||
buff->color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
if (Graph_Create(buff, 12, 19) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ static void DrawCircle(LCUI_Graph *graph, LCUI_Pos center,
|
||||
if (circle.bottom > area.y + area.height) {
|
||||
circle.bottom = area.y + area.height;
|
||||
}
|
||||
if (src->color_type != COLOR_TYPE_ARGB) {
|
||||
if (src->color_type != LCUI_COLOR_TYPE_ARGB) {
|
||||
return;
|
||||
}
|
||||
px_row_bytes = src->bytes + circle.top*src->bytes_per_row;
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ void Graph_DrawHorizLine(LCUI_Graph *graph, LCUI_Color color, int size,
|
||||
if (start.y + size > area.y + area.height) {
|
||||
size = area.y + area.height - start.y;
|
||||
}
|
||||
if (des->color_type == COLOR_TYPE_ARGB) {
|
||||
if (des->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
LCUI_ARGB *pPixel, *pRowPixel;
|
||||
pRowPixel = des->argb + start.y*des->width + start.x;
|
||||
for (y = 0; y < size; ++y) {
|
||||
@@ -85,7 +85,7 @@ LCUI_API void Graph_DrawVertiLine(LCUI_Graph *graph, LCUI_Color color,
|
||||
len = area.y + area.height - start.y;
|
||||
}
|
||||
|
||||
if (des->color_type == COLOR_TYPE_ARGB) {
|
||||
if (des->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
LCUI_ARGB *pPixel, *pRowPixel;
|
||||
pRowPixel = des->argb + start.y*des->width + start.x;
|
||||
for (y = 0; y < len; ++y) {
|
||||
|
||||
@@ -805,7 +805,7 @@ int FontBitmap_Mix(LCUI_Graph *graph, LCUI_Pos pos, const LCUI_FontBitmap *bmp,
|
||||
Graph_GetValidRect(&write_slot, &w_rect);
|
||||
/* 获取背景图引用的源图形 */
|
||||
graph = Graph_GetQuote(graph);
|
||||
if (graph->color_type == COLOR_TYPE_ARGB) {
|
||||
if (graph->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
FontBitmap_MixARGB(graph, &w_rect, bmp, color, &r_rect);
|
||||
} else {
|
||||
FontBitmap_MixRGB(graph, &w_rect, bmp, color, &r_rect);
|
||||
|
||||
@@ -305,7 +305,7 @@ LCUI_TextLayer TextLayer_New(void)
|
||||
layer->task.redraw_all = 0;
|
||||
Graph_Init(&layer->canvas);
|
||||
LinkedList_Init(&layer->dirty_rects);
|
||||
layer->canvas.color_type = COLOR_TYPE_ARGB;
|
||||
layer->canvas.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
TextRowList_InsertNewRow(&layer->text_rows, 0);
|
||||
return layer;
|
||||
}
|
||||
|
||||
+39
-39
@@ -47,7 +47,7 @@ void Graph_PrintInfo(LCUI_Graph *graph)
|
||||
LOG("width:%d, ", graph->width);
|
||||
LOG("height:%d, ", graph->height);
|
||||
LOG("opacity:%.2f, ", graph->opacity);
|
||||
LOG("%s\n", graph->color_type == COLOR_TYPE_ARGB ? "RGBA" : "RGB");
|
||||
LOG("%s\n", graph->color_type == LCUI_COLOR_TYPE_ARGB ? "RGBA" : "RGB");
|
||||
if (graph->quote.is_valid) {
|
||||
LOG("graph src:");
|
||||
Graph_PrintInfo(Graph_GetQuote(graph));
|
||||
@@ -61,7 +61,7 @@ void Graph_Init(LCUI_Graph *graph)
|
||||
graph->quote.top = 0;
|
||||
graph->quote.left = 0;
|
||||
graph->palette = NULL;
|
||||
graph->color_type = COLOR_TYPE_RGB;
|
||||
graph->color_type = LCUI_COLOR_TYPE_RGB;
|
||||
graph->bytes = NULL;
|
||||
graph->opacity = 1.0;
|
||||
graph->mem_size = 0;
|
||||
@@ -94,17 +94,17 @@ LCUI_Color ARGB(uchar_t a, uchar_t r, uchar_t g, uchar_t b)
|
||||
static size_t get_pixel_size(int color_type)
|
||||
{
|
||||
switch (color_type) {
|
||||
case COLOR_TYPE_INDEX8:
|
||||
case COLOR_TYPE_GRAY8:
|
||||
case COLOR_TYPE_RGB323:
|
||||
case COLOR_TYPE_ARGB2222:
|
||||
case LCUI_COLOR_TYPE_INDEX8:
|
||||
case LCUI_COLOR_TYPE_GRAY8:
|
||||
case LCUI_COLOR_TYPE_RGB323:
|
||||
case LCUI_COLOR_TYPE_ARGB2222:
|
||||
return 1;
|
||||
case COLOR_TYPE_RGB555:
|
||||
case COLOR_TYPE_RGB565:
|
||||
case LCUI_COLOR_TYPE_RGB555:
|
||||
case LCUI_COLOR_TYPE_RGB565:
|
||||
return 2;
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
return 3;
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
default:break;
|
||||
}
|
||||
return 4;
|
||||
@@ -161,14 +161,14 @@ void PixelsFormat(const uchar_t *in_pixels, int in_color_type,
|
||||
size_t pixel_count)
|
||||
{
|
||||
switch (in_color_type) {
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
if (out_color_type == COLOR_TYPE_ARGB8888) {
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
if (out_color_type == LCUI_COLOR_TYPE_ARGB8888) {
|
||||
return;
|
||||
}
|
||||
PixelsFormatRGB(in_pixels, out_pixels, pixel_count);
|
||||
break;
|
||||
case COLOR_TYPE_RGB888:
|
||||
if (out_color_type == COLOR_TYPE_RGB888) {
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
if (out_color_type == LCUI_COLOR_TYPE_RGB888) {
|
||||
return;
|
||||
}
|
||||
PixelsFormatARGB(in_pixels, out_pixels, pixel_count);
|
||||
@@ -205,7 +205,7 @@ static int Graph_RGBToARGB(LCUI_Graph *graph)
|
||||
}
|
||||
free(graph->argb);
|
||||
graph->argb = buffer;
|
||||
graph->color_type = COLOR_TYPE_ARGB8888;
|
||||
graph->color_type = LCUI_COLOR_TYPE_ARGB8888;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ static int Graph_ARGBToRGB(LCUI_Graph *graph)
|
||||
}
|
||||
free(graph->argb);
|
||||
graph->bytes = buffer;
|
||||
graph->color_type = COLOR_TYPE_RGB888;
|
||||
graph->color_type = LCUI_COLOR_TYPE_RGB888;
|
||||
graph->bytes_per_pixel = 3;
|
||||
return 0;
|
||||
}
|
||||
@@ -701,16 +701,16 @@ int Graph_SetColorType(LCUI_Graph *graph, int color_type)
|
||||
return -1;
|
||||
}
|
||||
switch (graph->color_type) {
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
switch (color_type) {
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
return Graph_ARGBToRGB(graph);
|
||||
default:break;
|
||||
}
|
||||
break;
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
switch (color_type) {
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
return Graph_RGBToARGB(graph);
|
||||
default:break;
|
||||
}
|
||||
@@ -862,7 +862,7 @@ int Graph_SetAlphaBits(LCUI_Graph *graph, uchar_t *a, size_t size)
|
||||
if (size > (size_t)(graph->width * graph->height)) {
|
||||
size = (size_t)(graph->width * graph->height);
|
||||
}
|
||||
if (graph->color_type != COLOR_TYPE_ARGB) {
|
||||
if (graph->color_type != LCUI_COLOR_TYPE_ARGB) {
|
||||
return -2;
|
||||
}
|
||||
for (i = 0; i < size; ++i) {
|
||||
@@ -879,7 +879,7 @@ int Graph_SetRedBits(LCUI_Graph *graph, uchar_t *r, size_t size)
|
||||
if (size > (size_t)(graph->width * graph->height)) {
|
||||
size = (size_t)(graph->width * graph->height);
|
||||
}
|
||||
if (graph->color_type == COLOR_TYPE_ARGB) {
|
||||
if (graph->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
for (i = 0; i < size; ++i) {
|
||||
graph->argb[i].r = r[i];
|
||||
}
|
||||
@@ -901,7 +901,7 @@ int Graph_SetGreenBits(LCUI_Graph *graph, uchar_t *g, size_t size)
|
||||
if (size > (size_t)(graph->width * graph->height)) {
|
||||
size = (size_t)(graph->width * graph->height);
|
||||
}
|
||||
if (graph->color_type == COLOR_TYPE_ARGB) {
|
||||
if (graph->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
for (i = 0; i < size; ++i) {
|
||||
graph->argb[i].g = g[i];
|
||||
}
|
||||
@@ -923,7 +923,7 @@ int Graph_SetBlueBits(LCUI_Graph *graph, uchar_t *b, size_t size)
|
||||
if (size > (size_t)(graph->width * graph->height)) {
|
||||
size = (size_t)(graph->width * graph->height);
|
||||
}
|
||||
if (graph->color_type == COLOR_TYPE_ARGB) {
|
||||
if (graph->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
for (i = 0; i < size; ++i) {
|
||||
graph->argb[i].b = b[i];
|
||||
}
|
||||
@@ -975,7 +975,7 @@ int Graph_Zoom(const LCUI_Graph *graph, LCUI_Graph *buff,
|
||||
if (Graph_Create(buff, width, height) < 0) {
|
||||
return -2;
|
||||
}
|
||||
if (graph->color_type == COLOR_TYPE_ARGB) {
|
||||
if (graph->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
LCUI_ARGB *px_src, *px_des, *px_row_src;
|
||||
for (y = 0; y < height; ++y) {
|
||||
src_y = (int)(y * scale_y);
|
||||
@@ -1020,9 +1020,9 @@ int Graph_Cut(const LCUI_Graph *graph, LCUI_Rect rect,
|
||||
return -3;
|
||||
}
|
||||
switch (graph->color_type) {
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
return Graph_CutARGB(graph, rect, buff);
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
return Graph_CutRGB(graph, rect, buff);
|
||||
default:break;
|
||||
}
|
||||
@@ -1033,9 +1033,9 @@ int Graph_HorizFlip(const LCUI_Graph *graph, LCUI_Graph *buff)
|
||||
{
|
||||
|
||||
switch (graph->color_type) {
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
return Graph_HorizFlipRGB(graph, buff);
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
return Graph_HorizFlipARGB(graph, buff);
|
||||
default:break;
|
||||
}
|
||||
@@ -1045,9 +1045,9 @@ int Graph_HorizFlip(const LCUI_Graph *graph, LCUI_Graph *buff)
|
||||
int Graph_VertiFlip(const LCUI_Graph *graph, LCUI_Graph *buff)
|
||||
{
|
||||
switch (graph->color_type) {
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
return Graph_VertiFlipRGB(graph, buff);
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
return Graph_VertiFlipARGB(graph, buff);
|
||||
default:break;
|
||||
}
|
||||
@@ -1066,9 +1066,9 @@ int Graph_FillRect(LCUI_Graph *graph, LCUI_Color color,
|
||||
rect2.height = graph->height;
|
||||
}
|
||||
switch (graph->color_type) {
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
return Graph_FillRectRGB(graph, color, rect2);
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
return Graph_FillRectARGB(graph, color, rect2, with_alpha);
|
||||
default:break;
|
||||
}
|
||||
@@ -1157,15 +1157,15 @@ int Graph_Mix(LCUI_Graph *back, const LCUI_Graph *fore,
|
||||
fore = Graph_GetQuote(fore);
|
||||
back = Graph_GetQuote(back);
|
||||
switch (fore->color_type) {
|
||||
case COLOR_TYPE_RGB888:
|
||||
if (back->color_type == COLOR_TYPE_RGB888) {
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
if (back->color_type == LCUI_COLOR_TYPE_RGB888) {
|
||||
mixer = Graph_ReplaceRGB;
|
||||
} else {
|
||||
mixer = Graph_ReplaceToARGB;
|
||||
}
|
||||
break;
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
if (back->color_type == COLOR_TYPE_RGB888) {
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
if (back->color_type == LCUI_COLOR_TYPE_RGB888) {
|
||||
mixer = Graph_MixARGBToRGB;
|
||||
} else {
|
||||
if (with_alpha) {
|
||||
@@ -1207,10 +1207,10 @@ int Graph_Replace(LCUI_Graph *back, const LCUI_Graph *fore, int left, int top)
|
||||
fore = Graph_GetQuote(fore);
|
||||
back = Graph_GetQuote(back);
|
||||
switch (fore->color_type) {
|
||||
case COLOR_TYPE_RGB888:
|
||||
case LCUI_COLOR_TYPE_RGB888:
|
||||
Graph_ReplaceRGB(back, write_rect, fore, left, top);
|
||||
break;
|
||||
case COLOR_TYPE_ARGB8888:
|
||||
case LCUI_COLOR_TYPE_ARGB8888:
|
||||
Graph_ReplaceARGB(back, write_rect, fore, left, top);
|
||||
default:break;
|
||||
}
|
||||
|
||||
@@ -322,10 +322,10 @@ static LCUI_WidgetRenderer WidgetRenderer(LCUI_Widget w,
|
||||
Graph_Init(&that->self_graph);
|
||||
Graph_Init(&that->layer_graph);
|
||||
Graph_Init(&that->content_graph);
|
||||
that->layer_graph.color_type = COLOR_TYPE_ARGB;
|
||||
that->layer_graph.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
that->can_render_self = Widget_IsPaintable(w);
|
||||
if (that->can_render_self) {
|
||||
that->self_graph.color_type = COLOR_TYPE_ARGB;
|
||||
that->self_graph.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
Graph_Create(&that->self_graph,
|
||||
that->paint->rect.width,
|
||||
that->paint->rect.height);
|
||||
@@ -368,7 +368,7 @@ static LCUI_WidgetRenderer WidgetRenderer(LCUI_Widget w,
|
||||
return that;
|
||||
}
|
||||
if (that->has_content_graph) {
|
||||
that->content_graph.color_type = COLOR_TYPE_ARGB;
|
||||
that->content_graph.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
Graph_Create(&that->content_graph, that->content_rect.width,
|
||||
that->content_rect.height);
|
||||
}
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ int LCUI_ReadBMPHeader(LCUI_ImageReader reader)
|
||||
reader->header.height = info->height;
|
||||
reader->header.type = LCUI_BMP_IMAGE;
|
||||
if (info->bits == 24) {
|
||||
reader->header.color_type = COLOR_TYPE_RGB;
|
||||
reader->header.color_type = LCUI_COLOR_TYPE_RGB;
|
||||
reader->header.bit_depth = 24;
|
||||
}
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -191,7 +191,7 @@ int LCUI_ReadJPEGHeader(LCUI_ImageReader reader)
|
||||
header->height = cinfo->image_height;
|
||||
header->type = LCUI_JPEG_IMAGE;
|
||||
if (cinfo->jpeg_color_space == JCS_RGB) {
|
||||
header->color_type = COLOR_TYPE_RGB;
|
||||
header->color_type = LCUI_COLOR_TYPE_RGB;
|
||||
header->bit_depth = 24;
|
||||
} else {
|
||||
header->color_type = 0;
|
||||
@@ -256,7 +256,7 @@ int LCUI_ReadJPEG(LCUI_ImageReader reader, LCUI_Graph *graph)
|
||||
if (cinfo->num_components != 3) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
graph->color_type = COLOR_TYPE_RGB;
|
||||
graph->color_type = LCUI_COLOR_TYPE_RGB;
|
||||
if (0 != Graph_Create(graph, cinfo->output_width,
|
||||
cinfo->output_height)) {
|
||||
return -ENOMEM;
|
||||
|
||||
+7
-7
@@ -138,10 +138,10 @@ int LCUI_ReadPNGHeader(LCUI_ImageReader reader)
|
||||
reader->header.type = LCUI_PNG_IMAGE;
|
||||
switch (reader->header.color_type) {
|
||||
case PNG_COLOR_TYPE_RGB_ALPHA:
|
||||
reader->header.color_type = COLOR_TYPE_ARGB;
|
||||
reader->header.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
break;
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
reader->header.color_type = COLOR_TYPE_RGB;
|
||||
reader->header.color_type = LCUI_COLOR_TYPE_RGB;
|
||||
break;
|
||||
default:
|
||||
reader->header.color_type = 0;
|
||||
@@ -180,16 +180,16 @@ int LCUI_ReadPNG(LCUI_ImageReader reader, LCUI_Graph *graph)
|
||||
}
|
||||
/* 根据不同的色彩类型进行相应处理 */
|
||||
switch (header->color_type) {
|
||||
case COLOR_TYPE_ARGB:
|
||||
graph->color_type = COLOR_TYPE_ARGB;
|
||||
case LCUI_COLOR_TYPE_ARGB:
|
||||
graph->color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
ret = Graph_Create(graph, header->width, header->height);
|
||||
if (ret != 0) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case COLOR_TYPE_RGB:
|
||||
graph->color_type = COLOR_TYPE_RGB;
|
||||
case LCUI_COLOR_TYPE_RGB:
|
||||
graph->color_type = LCUI_COLOR_TYPE_RGB;
|
||||
ret = Graph_Create(graph, header->width, header->height);
|
||||
if (ret != 0) {
|
||||
ret = -ENOMEM;
|
||||
@@ -278,7 +278,7 @@ int LCUI_WritePNGFile(const char *file_name, const LCUI_Graph *graph)
|
||||
|
||||
Graph_GetValidRect(graph, &rect);
|
||||
graph = Graph_GetQuote(graph);
|
||||
if (graph->color_type == COLOR_TYPE_ARGB) {
|
||||
if (graph->color_type == LCUI_COLOR_TYPE_ARGB) {
|
||||
LCUI_ARGB *px_ptr, *px_row_ptr;
|
||||
|
||||
row_size = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
@@ -447,10 +447,10 @@ static void FBDisplay_InitCanvas(void)
|
||||
display.canvas.mem_size = display.fb.mem_len;
|
||||
switch (display.fb.var_info.bits_per_pixel) {
|
||||
case 32:
|
||||
display.canvas.color_type = COLOR_TYPE_ARGB8888;
|
||||
display.canvas.color_type = LCUI_COLOR_TYPE_ARGB8888;
|
||||
break;
|
||||
case 24:
|
||||
display.canvas.color_type = COLOR_TYPE_RGB888;
|
||||
display.canvas.color_type = LCUI_COLOR_TYPE_RGB888;
|
||||
break;
|
||||
case 8:
|
||||
ioctl(display.fb.dev_fd, FBIOGETCMAP, &display.fb.cmap);
|
||||
@@ -468,7 +468,7 @@ static void FBDisplay_InitSurface(void)
|
||||
LCUIMutex_Init(&surface->mutex);
|
||||
LinkedList_Init(&surface->rects);
|
||||
display.surface_count = 0;
|
||||
surface->canvas.color_type = COLOR_TYPE_ARGB;
|
||||
surface->canvas.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
FBSurface_Resize(surface, display.width, display.height);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ static void X11Surface_OnResize(LCUI_Surface s, int width, int height)
|
||||
switch (depth) {
|
||||
case 32:
|
||||
case 24:
|
||||
s->fb.color_type = COLOR_TYPE_ARGB;
|
||||
s->fb.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
break;
|
||||
default:
|
||||
LOG("[x11display] unsupport depth: %d.\n", depth);
|
||||
@@ -274,7 +274,7 @@ static LCUI_Surface X11Surface_New(void)
|
||||
Graph_Init(&surface->fb);
|
||||
LCUIMutex_Init(&surface->mutex);
|
||||
LinkedList_Init(&surface->rects);
|
||||
surface->fb.color_type = COLOR_TYPE_ARGB;
|
||||
surface->fb.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
LinkedList_AppendNode(&x11.surfaces, &surface->node);
|
||||
LCUI_PostSimpleTask(X11Surface_OnCreate, surface, NULL);
|
||||
return surface;
|
||||
|
||||
@@ -194,7 +194,7 @@ static LCUI_Surface WinSurface_New(void)
|
||||
surface->is_ready = FALSE;
|
||||
surface->node.data = surface;
|
||||
Graph_Init(&surface->fb);
|
||||
surface->fb.color_type = COLOR_TYPE_ARGB;
|
||||
surface->fb.color_type = LCUI_COLOR_TYPE_ARGB;
|
||||
for (i = 0; i < TASK_TOTAL_NUM; ++i) {
|
||||
surface->tasks[i].is_valid = FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user