Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenrlecomp.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS kernel 00004 * PURPOSE: RLE compression 00005 * FILE: subsystems/win32k/eng/rlecomp.c 00006 * PROGRAMER: Jason Filby 00007 */ 00008 00009 #include <win32k.h> 00010 00011 #define NDEBUG 00012 #include <debug.h> 00013 00014 enum Rle_EscapeCodes 00015 { 00016 RLE_EOL = 0, /* End of line */ 00017 RLE_END = 1, /* End of bitmap */ 00018 RLE_DELTA = 2 /* Delta */ 00019 }; 00020 00021 VOID DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta, ULONG Format) 00022 { 00023 INT x = 0; 00024 INT y = Size.cy - 1; 00025 INT c; 00026 INT length; 00027 INT width; 00028 INT height = Size.cy - 1; 00029 BYTE *begin = CompressedBits; 00030 BYTE *bits = CompressedBits; 00031 BYTE *temp; 00032 INT shift = 0; 00033 00034 if ((Format == BMF_4RLE) || (Format == BMF_4BPP)) 00035 shift = 1; 00036 else if ((Format != BMF_8RLE) && (Format != BMF_8BPP)) 00037 return; 00038 00039 width = ((Size.cx + shift) >> shift); 00040 00041 _SEH2_TRY 00042 { 00043 while (y >= 0) 00044 { 00045 length = (*bits++) >> shift; 00046 if (length) 00047 { 00048 c = *bits++; 00049 while (length--) 00050 { 00051 if (x >= width) break; 00052 temp = UncompressedBits + (((height - y) * Delta) + x); 00053 x++; 00054 *temp = c; 00055 } 00056 } 00057 else 00058 { 00059 length = *bits++; 00060 switch (length) 00061 { 00062 case RLE_EOL: 00063 x = 0; 00064 y--; 00065 break; 00066 case RLE_END: 00067 _SEH2_YIELD(return); 00068 case RLE_DELTA: 00069 x += (*bits++) >> shift; 00070 y -= (*bits++) >> shift; 00071 break; 00072 default: 00073 length = length >> shift; 00074 while (length--) 00075 { 00076 c = *bits++; 00077 if (x < width) 00078 { 00079 temp = UncompressedBits + (((height - y) * Delta) + x); 00080 x++; 00081 *temp = c; 00082 } 00083 } 00084 if ((bits - begin) & 1) 00085 { 00086 bits++; 00087 } 00088 } 00089 } 00090 } 00091 } 00092 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) 00093 { 00094 DPRINT1("Decoding error\n"); 00095 } 00096 _SEH2_END; 00097 00098 return; 00099 } Generated on Sat May 26 2012 04:37:09 for ReactOS by
1.7.6.1
|