📄 gdi.c
字号:
{ *(Uint16*) pdc->cur_dst &= (Uint16) pdc->cur_pixel; *(pdc->cur_dst + 2) &= (Uint8) (pdc->cur_pixel >> 16);}static void _dc_and_pixel_4 (PDC pdc){ *(Uint32 *) pdc->cur_dst &= (Uint32) pdc->cur_pixel;}static void _dc_or_pixel_1 (PDC pdc){ *pdc->cur_dst |= (Uint8) pdc->cur_pixel;}static void _dc_or_pixel_2 (PDC pdc){ *(Uint16 *) pdc->cur_dst |= (Uint16) pdc->cur_pixel;}static void _dc_or_pixel_3 (PDC pdc){ *(Uint16*) pdc->cur_dst |= (Uint16) pdc->cur_pixel; *(pdc->cur_dst + 2) |= (Uint8) (pdc->cur_pixel >> 16);}static void _dc_or_pixel_4 (PDC pdc){ *(Uint32 *) pdc->cur_dst |= (Uint32) pdc->cur_pixel;}static void _dc_xor_pixel_1 (PDC pdc){ *pdc->cur_dst ^= (Uint8) pdc->cur_pixel;}static void _dc_xor_pixel_2 (PDC pdc){ *(Uint16 *) pdc->cur_dst ^= (Uint16) pdc->cur_pixel;}static void _dc_xor_pixel_3 (PDC pdc){ *(Uint16*) pdc->cur_dst ^= (Uint16) pdc->cur_pixel; *(pdc->cur_dst + 2) ^= (Uint8) (pdc->cur_pixel >> 16);}static void _dc_xor_pixel_4 (PDC pdc){ *(Uint32 *) pdc->cur_dst ^= (Uint32) pdc->cur_pixel;}static void _dc_move_to_1 (PDC pdc, int x, int y){ pdc->cur_dst = pdc->surface->pixels + pdc->surface->pitch * y; pdc->cur_dst += x;}static void _dc_move_to_2 (PDC pdc, int x, int y){ pdc->cur_dst = pdc->surface->pixels + pdc->surface->pitch * y; pdc->cur_dst += x << 1;}static void _dc_move_to_3 (PDC pdc, int x, int y){ pdc->cur_dst = pdc->surface->pixels + pdc->surface->pitch * y; pdc->cur_dst += (x << 1) + x;}static void _dc_move_to_4 (PDC pdc, int x, int y){ pdc->cur_dst = pdc->surface->pixels + pdc->surface->pitch * y; pdc->cur_dst += x << 2;}static void _dc_step_x_1 (PDC pdc, int step){ pdc->cur_dst += step;}static void _dc_step_x_2 (PDC pdc, int step){ pdc->cur_dst += step << 1;}static void _dc_step_x_3 (PDC pdc, int step){ pdc->cur_dst += (step << 1) + step;}static void _dc_step_x_4 (PDC pdc, int step){ pdc->cur_dst += step << 2;}/* * a fast draw line operation if (cur_pixel == 0 && pdc->step == 1 && pdc->rop == ROP_SET) * or (BytesPerPixel == 1) */ static void _dc_draw_hline_set_0 (PDC pdc, int w){ Uint8* row = pdc->cur_dst; int n = w * pdc->surface->format->BytesPerPixel; if (!pdc->cur_pixel && !((long)row&3) && !(n&3)) { n = n >> 2; GAL_memset4 (row, 0, n); } else memset (row, pdc->cur_pixel, n);}static void _dc_draw_hline_set_1 (PDC pdc, int w){ if (pdc->step == 1) { _dc_draw_hline_set_0 (pdc, w); } else { Uint8* row = pdc->cur_dst; while (w > 0) { *row = (Uint8) pdc->cur_pixel; row += pdc->step; w -= pdc->step; } }}static void _dc_draw_hline_set_2 (PDC pdc, int w){ if (pdc->step == 1 && pdc->cur_pixel == 0) { _dc_draw_hline_set_0 (pdc, w); }#ifdef ASM_memset2 else if (pdc->step == 1 && !((long)pdc->cur_dst & 2)) { ASM_memset2 (pdc->cur_dst, pdc->cur_pixel, w); }#endif else { Uint16* row = (Uint16*)pdc->cur_dst; while (w > 0) { *row = (Uint16) pdc->cur_pixel; row += pdc->step; w -= pdc->step; } }}static void _dc_draw_hline_set_3 (PDC pdc, int w){ if (pdc->step == 1 && pdc->cur_pixel == 0) { _dc_draw_hline_set_0 (pdc, w); }#ifdef ASM_memset3 else if (pdc->step == 1) { ASM_memset3 (pdc->cur_dst, pdc->cur_pixel, w); }#endif else { Uint8* row = (Uint8*)pdc->cur_dst; int step = (pdc->step << 1) + pdc->step; while (w > 0) {#if MGUI_BYTEORDER == MGUI_LIL_ENDIAN *(Uint16*) row = (Uint16) pdc->cur_pixel; *(row + 2) = (Uint8) (pdc->cur_pixel >> 16);#else *(Uint16*) row = ((Uint16) pdc->cur_pixel << 8); *(row + 2) = (Uint8) (pdc->cur_pixel);#endif row += step; w -= pdc->step; } }}static void _dc_draw_hline_set_4 (PDC pdc, int w){ Uint32* row = (Uint32*)pdc->cur_dst; if (pdc->step == 1) { GAL_memset4 (row, pdc->cur_pixel, w); } else { while (w > 0) { *row = pdc->cur_pixel; row += pdc->step; w -= pdc->step; } }}static void _dc_draw_hline_and_1 (PDC pdc, int w){ Uint8* row = pdc->cur_dst;#ifdef ASM_memandset4 if (pdc->step == 1 && !((Uint32)pdc->cur_dst & 3) && !(w & 3)) { Uint16 _w = MAKEWORD (pdc->cur_pixel, pdc->cur_pixel); Uint32 _u = MAKELONG (_w, _w); ASM_memandset4 (row, _u, w >> 2); return; }#endif while (w > 0) { *row &= (Uint8) pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_and_2 (PDC pdc, int w){ Uint16* row = (Uint16*)pdc->cur_dst;#ifdef ASM_memandset4 if (pdc->step == 1 && !((Uint32)pdc->cur_dst & 3) && !(w & 1)) { Uint32 u = MAKELONG (pdc->cur_pixel, pdc->cur_pixel); ASM_memandset4 (row, u, w >> 1); return; }#endif while (w > 0) { *row &= (Uint16) pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_and_3 (PDC pdc, int w){ Uint8* row = (Uint8*)pdc->cur_dst; int step = (pdc->step << 1) + pdc->step;#ifdef ASM_memandset3 if (pdc->step == 1) { ASM_memandset3 (row, pdc->cur_pixel, w); return; }#endif while (w > 0) {#if MGUI_BYTEORDER == MGUI_LIL_ENDIAN *(Uint16*) row &= (Uint16) pdc->cur_pixel; *(row + 2) &= (Uint8) (pdc->cur_pixel >> 16);#else *(Uint16*) row &= ((Uint16) pdc->cur_pixel << 8); *(row + 2) &= (Uint8) (pdc->cur_pixel);#endif row += step; w -= pdc->step; }}static void _dc_draw_hline_and_4 (PDC pdc, int w){ Uint32* row = (Uint32*)pdc->cur_dst;#ifdef ASM_memandset4 if (pdc->step == 1) { ASM_memandset4 (row, pdc->cur_pixel, w); return; }#endif while (w > 0) { *row &= pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_or_1 (PDC pdc, int w){ Uint8* row = pdc->cur_dst;#ifdef ASM_memorset4 if (pdc->step == 1 && !((Uint32)pdc->cur_dst & 3) && !(w & 3)) { Uint16 _w = MAKEWORD (pdc->cur_pixel, pdc->cur_pixel); Uint32 _u = MAKELONG (_w, _w); ASM_memorset4 (row, _u, w >> 2); return; }#endif while (w > 0) { *row |= (Uint8) pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_or_2 (PDC pdc, int w){ Uint16* row = (Uint16*)pdc->cur_dst;#ifdef ASM_memorset4 if (pdc->step == 1 && !((Uint32)pdc->cur_dst & 3) && !(w & 1)) { Uint32 u = MAKELONG (pdc->cur_pixel, pdc->cur_pixel); ASM_memorset4 (row, u, w>>1); return; }#endif while (w > 0) { *row |= (Uint16) pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_or_3 (PDC pdc, int w){ Uint8* row = (Uint8*)pdc->cur_dst; int step = (pdc->step << 1) + pdc->step;#ifdef ASM_memorset3 if (pdc->step == 1) { ASM_memorset3 (row, pdc->cur_pixel, w); return; }#endif while (w > 0) {#if MGUI_BYTEORDER == MGUI_LIL_ENDIAN *(Uint16*) row |= (Uint16) pdc->cur_pixel; *(row + 2) |= (Uint8) (pdc->cur_pixel >> 16);#else *(Uint16*) row |= ((Uint16) pdc->cur_pixel << 8); *(row + 2) |= (Uint8) (pdc->cur_pixel);#endif row += step; w -= pdc->step; }}static void _dc_draw_hline_or_4 (PDC pdc, int w){ Uint32* row = (Uint32*)pdc->cur_dst;#ifdef ASM_memorset4 if (pdc->step == 1) { ASM_memorset4 (row, pdc->cur_pixel, w); return; }#endif while (w > 0) { *row |= pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_xor_1 (PDC pdc, int w){ Uint8* row = pdc->cur_dst;#ifdef ASM_memxorset4 if (pdc->step == 1 && !((Uint32)pdc->cur_dst & 3) && !(w & 3)) { Uint16 _w = MAKEWORD (pdc->cur_pixel, pdc->cur_pixel); Uint32 _u = MAKELONG (_w, _w); ASM_memxorset4 (pdc->cur_dst, _u, w >> 2); return; }#endif while (w > 0) { *row ^= (Uint8) pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_xor_2 (PDC pdc, int w){ Uint16* row = (Uint16*)pdc->cur_dst;#ifdef ASM_memxorset4 if (pdc->step == 1 && !((Uint32)pdc->cur_dst & 3) && !(w & 1)) { Uint32 u = MAKELONG (pdc->cur_pixel, pdc->cur_pixel); ASM_memxorset4 (row, u, w>>1); return; }#endif while (w > 0) { *row ^= (Uint16) pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}static void _dc_draw_hline_xor_3 (PDC pdc, int w){ Uint8* row = (Uint8*)pdc->cur_dst; int step = (pdc->step << 1) + pdc->step;#ifdef ASM_memxorset3 if (pdc->step == 1) { ASM_memxorset3 (pdc->cur_dst, pdc->cur_pixel, w); return; }#endif while (w > 0) {#if MGUI_BYTEORDER == MGUI_LIL_ENDIAN *(Uint16*) row ^= (Uint16) pdc->cur_pixel; *(row + 2) ^= (Uint8) (pdc->cur_pixel >> 16);#else *(Uint16*) row ^= ((Uint16) pdc->cur_pixel << 8); *(row + 2) ^= (Uint8) (pdc->cur_pixel);#endif row += step; w -= pdc->step; }}static void _dc_draw_hline_xor_4 (PDC pdc, int w){ Uint32* row = (Uint32*)pdc->cur_dst;#ifdef ASM_memxorset4 if (pdc->step == 1) { ASM_memxorset4 (pdc->cur_dst, pdc->cur_pixel, w); return; }#endif while (w > 0) { *row ^= pdc->cur_pixel; row += pdc->step; w -= pdc->step; }}/* * a fast put line operation if (pdc->step == 1 && pdc->rop == ROP_SET) * or (BytesPerPixel == 1) */ static void _dc_put_hline_set_0 (PDC pdc, Uint8* src, int w){ Uint8* row = pdc->cur_dst; int n = w * pdc->surface->format->BytesPerPixel; if (!((long)row&3) && !(n&3) && !((long)src&3)) { GAL_memcpy4 (row, src, n >> 2); } else ASM_memcpy (row, src, n);}static void _dc_put_hline_set_1 (PDC pdc, Uint8* src, int w){ if (pdc->step == 1 && pdc->bkmode != BM_TRANSPARENT) { _dc_put_hline_set_0 (pdc, src, w); } else { Uint8* row = pdc->cur_dst; if (pdc->bkmode == BM_TRANSPARENT) { while (w > 0) { if (*src != pdc->skip_pixel) *row = *src; row += pdc->step; src += pdc->step; w -= pdc->step; } } else while (w > 0) { *row = *src; row += pdc->step; src += pdc->step; w -= pdc->step; } }}static void _dc_put_hline_set_2 (PDC pdc, Uint8* src, int w){ if (pdc->step == 1 && pdc->bkmode != BM_TRANSPARENT) { _dc_put_hline_set_0 (pdc, src, w); } else { Uint16* dstrow = (Uint16*)pdc->cur_dst; Uint16* srcrow = (Uint16*)src; if (pdc->bkmode == BM_TRANSPARENT) { while (w > 0) { if (*srcrow != pdc->skip_pixel) *dstrow = *srcrow; dstrow += pdc->step; srcrow += pdc->step; w -= pdc->step; } } else while (w > 0) { *dstrow = *srcrow; dstrow += pdc->step; srcrow += pdc->step; w -= pdc->step; } }}static void _dc_put_hline_set_3 (PDC pdc, Uint8* src, int w){ if (pdc->step == 1 && pdc->bkmode != BM_TRANSPARENT) { _dc_put_hline_set_0 (pdc, src, w); } else { Uint8* row = (Uint8*)pdc->cur_dst; int step = (pdc->step << 1) + pdc->step; if (pdc->bkmode == BM_TRANSPARENT) { while (w > 0) { if (((* (Uint32*)row) & 0x00FFFFFF) != pdc->skip_pixel) { *row = *src; *(row + 1) = *(src + 1); *(row + 2) = *(src + 2); } row += step; src += step; w -= pdc->step; } } else while (w > 0) { *row = *src; *(row + 1) = *(src + 1); *(row + 2) = *(src + 2); row += step; src += step; w -= pdc->step; } }}static void _dc_put_hline_set_4 (PDC pdc, Uint8* src, int w){ Uint32* dstrow = (Uint32*)pdc->cur_dst; Uint32* srcrow = (Uint32*)src; if (pdc->step == 1 && pdc->bkmode != BM_TRANSPARENT) { GAL_memset4 (dstrow, pdc->cur_pixel, w); } else { if (pdc->bkmode == BM_TRANSPARENT) { while (w > 0) { if (*srcrow != pdc->skip_pixel) *dstrow = *srcrow; dstrow += pdc->step; srcrow += pdc->step; w -= pdc->step; } } else while (w > 0) { *dstrow = *srcrow; dstrow += pdc->step; srcrow += pdc->step; w -= pdc->step; } }}static void _dc_put_hline_and_1 (PDC pdc, Uint8* src, int w){ Uint8* row = pdc->cur_dst;#ifdef ASM_memandcpy4 if (pdc->step == 1 && pdc->bkmode != BM_TRANSPARENT && !((Uint32)row & 3) && !((Uint32)src & 3) && !(w & 3)) { ASM_memandcpy4 (row, src, w >> 2); return; }#endif if (pdc->bkmode == BM_TRANSPARENT) { while (w > 0) { if (*src != pdc->skip_pixel) *row &= *src; row += pdc->step;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -