QuadBlitter.h
Go to the documentation of this file.00001 00015 #ifndef __QuadBlitter_H__ 00016 #define __QuadBlitter_H__ 00017 00018 // Includes 00019 #include "StandardLibrary.h" 00020 00021 // Forward declares 00022 00023 00024 // QuadBlitter 00025 class QuadBlitter 00026 { 00027 public: 00028 // DstColor fylls med fillColor 00029 static void Blit(unsigned short fillColor, unsigned short* targetColor, int targetHPitch, int targetVPitch, int targetX1, int targetY1, int targetX2, int targetY2, int targetX3, int targetY3, int targetX4, int targetY4); 00030 00031 // SrcColor kopieras till DstColor 00032 static void Blit(unsigned short* sourceColor, int sourceHPitch, int sourceVPitch, unsigned short* targetColor, int targetHPitch, int targetVPitch, int sourceX1, int sourceY1, int sourceX2, int sourceY2, int sourceX3, int sourceY3, int sourceX4, int sourceY4, int targetX1, int targetY1, int targetX2, int targetY2, int targetX3, int targetY3, int targetX4, int targetY4); 00033 00034 // SrcColor blendas (SrcAlpha) med DstColor 00035 static void Blit(unsigned short* sourceColor, unsigned char* sourceAlpha, int sourceHPitch, int sourceVPitch, unsigned short* targetColor, int targetHPitch, int targetVPitch, int sourceX1, int sourceY1, int sourceX2, int sourceY2, int sourceX3, int sourceY3, int sourceX4, int sourceY4, int targetX1, int targetY1, int targetX2, int targetY2, int targetX3, int targetY3, int targetX4, int targetY4); 00036 00037 // SrcColor blendas (SrcAlpha*BlitAlpha) med DstColor 00038 static void Blit(unsigned char alpha, unsigned short* sourceColor, unsigned char* sourceAlpha, int sourceHPitch, int sourceVPitch, unsigned short* targetColor, int targetHPitch, int targetVPitch, int sourceX1, int sourceY1, int sourceX2, int sourceY2, int sourceX3, int sourceY3, int sourceX4, int sourceY4, int targetX1, int targetY1, int targetX2, int targetY2, int targetX3, int targetY3, int targetX4, int targetY4); 00039 private: 00040 struct EdgeX 00041 { 00042 unsigned short x; 00043 }; 00044 00045 struct EdgeXUV 00046 { 00047 int u; 00048 int v; 00049 unsigned short x; 00050 }; 00051 00052 00053 00054 class EdgeBuffer 00055 { 00056 public: 00057 EdgeBuffer(): 00058 buffer_(0), 00059 size_(512) 00060 { 00061 00062 } 00063 00064 ~EdgeBuffer() 00065 { 00066 if (buffer_) 00067 { 00068 Free(buffer_); 00069 buffer_=0; 00070 size_=512; 00071 } 00072 } 00073 00074 void SetMinSize(int size) 00075 { 00076 if (buffer_ && size_>size) 00077 { 00078 return; 00079 } 00080 00081 while (size_<size) 00082 { 00083 size_*=2; 00084 } 00085 00086 if (!buffer_) 00087 { 00088 buffer_=Malloc(size_); 00089 } 00090 else 00091 { 00092 Free(buffer_); 00093 buffer_=Malloc(size_); 00094 } 00095 } 00096 00097 void* buffer_; 00098 int size_; 00099 }; 00100 00101 static EdgeBuffer edgeBuffer_; 00102 00103 }; 00104 00105 #endif /* __QuadBlitter_H__ */ 00106
Reproduction/republishing of any material on this site without permission is strictly prohibited.
