Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendib24bppc.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: Win32 subsystem 00003 * LICENSE: See COPYING in the top level directory 00004 * FILE: subsystems/win32/win32k/dib/dib24bppc.c 00005 * PURPOSE: C language equivalents of asm optimised 24bpp functions 00006 * PROGRAMMERS: Jason Filby 00007 * Magnus Olsen 00008 */ 00009 00010 #include <win32k.h> 00011 00012 #define NDEBUG 00013 #include <debug.h> 00014 00015 VOID 00016 DIB_24BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c) 00017 { 00018 PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x1 << 1) + x1; 00019 ULONG Count = x2 - x1; 00020 00021 if (Count < 8) 00022 { 00023 /* For small fills, don't bother doing anything fancy */ 00024 while (Count--) 00025 { 00026 *(PUSHORT)(addr) = c; 00027 addr += 2; 00028 *(addr) = c >> 16; 00029 addr += 1; 00030 } 00031 } 00032 else 00033 { 00034 ULONG Fill[3]; 00035 ULONG MultiCount; 00036 00037 /* Align to 4-byte address */ 00038 while (0 != ((ULONG_PTR) addr & 0x3)) 00039 { 00040 *(PUSHORT)(addr) = c; 00041 addr += 2; 00042 *(addr) = c >> 16; 00043 addr += 1; 00044 Count--; 00045 } 00046 /* If the color we need to fill with is 0ABC, then the final mem pattern 00047 * (note little-endianness) would be: 00048 * 00049 * |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders 00050 * |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders 00051 * 00052 * So, taking endianness into account again, we need to fill with these 00053 * ULONGs: CABC BCAB ABCA */ 00054 00055 c = c & 0xffffff; /* 0ABC */ 00056 Fill[0] = c | (c << 24); /* CABC */ 00057 Fill[1] = (c >> 8) | (c << 16); /* BCAB */ 00058 Fill[2] = (c << 8) | (c >> 16); /* ABCA */ 00059 MultiCount = Count / 4; 00060 do 00061 { 00062 *(PULONG)addr = Fill[0]; 00063 addr += 4; 00064 *(PULONG)addr = Fill[1]; 00065 addr += 4; 00066 *(PULONG)addr = Fill[2]; 00067 addr += 4; 00068 } 00069 while (0 != --MultiCount); 00070 00071 Count = Count & 0x03; 00072 while (0 != Count--) 00073 { 00074 *(PUSHORT)(addr) = c; 00075 addr += 2; 00076 *(addr) = c >> 16; 00077 addr += 1; 00078 } 00079 } 00080 } Generated on Sat May 26 2012 04:36:59 for ReactOS by
1.7.6.1
|