Changeset 10373 for trunk/src/gdi32/dibsect.h
- Timestamp:
- Jan 11, 2004, 12:42:14 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/src/gdi32/dibsect.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibsect.h
r10321 r10373 1 /* $Id: dibsect.h,v 1.2 7 2003-11-14 17:31:47sandervl Exp $ */1 /* $Id: dibsect.h,v 1.28 2004-01-11 11:42:11 sandervl Exp $ */ 2 2 3 3 /* … … 75 75 #endif 76 76 77 // 78 //Mark DIB section as invalid (dib section memory is out of sync with 79 //GDI bitmap). 80 // 81 //This must be done for any GDI function that modifies the bitmap 82 // 83 #define DIBSECTION_MARK_INVALID(hdc) \ 84 if(DIBSection::getSection() != NULL) { \ 85 DIBSection *dib = DIBSection::findHDC(hdc); \ 86 if(dib) { \ 87 dib->setInvalid(); \ 88 } \ 89 } 90 91 #define DIBSECTION_MARK_INVALID_BMP(hBitmap) \ 92 if(DIBSection::getSection() != NULL) { \ 93 DIBSection *dib = DIBSection::findObj(hBitmap); \ 94 if(dib) { \ 95 dib->setInvalid(); \ 96 } \ 97 } 98 99 // 100 //Check if DIB section is marked dirty (bitmap data modified by application) 101 //If true, then update the GDI bitmap 102 // 103 //This must be done for any GDI function that accesses the bitmap 104 // 105 #define DIBSECTION_CHECK_IF_DIRTY(hdc) \ 106 if(DIBSection::getSection() != NULL) { \ 107 DIBSection *dib = DIBSection::findHDC(hdc); \ 108 if(dib && dib->isDirty()) { \ 109 dib->flush(); \ 110 } \ 111 } 112 113 #define DIBSECTION_CHECK_IF_DIRTY_BMP(hBitmap) \ 114 if(DIBSection::getSection() != NULL) { \ 115 DIBSection *dib = DIBSection::findObj(hBitmap); \ 116 if(dib && dib->isDirty()) { \ 117 dib->flush(); \ 118 } \ 119 } 120 121 77 122 class DIBSection 78 123 { 79 124 public: 80 DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, DWORD handle, int fFlip);125 DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, HBITMAP hBitmap, int fFlip); 81 126 ~DIBSection(); 82 127 … … 88 133 void UnSelectDIBObject() { this->hdc = 0; }; 89 134 90 DWORD GetBitmapHandle() { return handle; }; 91 void SetBitmapHandle(DWORD bmphandle) { handle = bmphandle; }; 135 void setDirty() { fDirty = TRUE; }; 136 BOOL isDirty() { return fDirty; } 137 void setInvalid(); 138 BOOL isInvalid() { return fInvalid; }; 139 140 DWORD GetBitmapHandle() { return hBitmap; }; 141 void SetBitmapHandle(DWORD bmphandle) { hBitmap = bmphandle; }; 92 142 DWORD GetRGBUsage() { return iUsage; }; 93 143 … … 97 147 int nSrcWidth, int nSrcHeight, 98 148 DWORD Rop); 149 150 void flush(); 151 void sync(); 152 99 153 void sync(HDC hdc, DWORD nYdest, DWORD nDestHeight, BOOL orgYInversion = TRUE); 154 void flush(HDC hdc, DWORD nYdest, DWORD nDestHeight, BOOL orgYInversion = TRUE); 100 155 void sync(DWORD xDst, DWORD yDst, DWORD widthDst, DWORD heightDst, PVOID bits); 156 101 157 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb); 102 158 int GetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb); 103 159 int SetDIBColorTable(int startIdx, int cEntries, PALETTEENTRY *rgb); 104 160 105 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT106 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi,107 UINT coloruse);108 109 161 int GetDIBSection(int iSize , void *lpBuffer); 110 162 111 163 static DIBSection *getSection() { return section; } ; 112 static DIBSection *findObj(H ANDLE handle);164 static DIBSection *findObj(HBITMAP hBitmap); 113 165 static DIBSection *findHDC(HDC hdc); 114 static void deleteSection(H ANDLE handle);166 static void deleteSection(HBITMAP hBitmap); 115 167 116 168 static void initDIBSection(); … … 119 171 static void unlock() { LeaveCriticalSection(&dibcritsect); }; 120 172 173 static void syncAll(); 174 121 175 protected: 122 176 123 177 private: 124 DWORD handle, iUsage; 125 DWORD hSection, dwOffset; 178 HBITMAP hBitmap; 179 180 DWORD hSection, dwOffset, iUsage, dwSize; 126 181 HWND hwndParent; 127 182 HDC hdc; … … 131 186 DIBSECTION dibinfo; 132 187 188 BOOL fDirty; //bitmap is out of sync with dib memory 189 BOOL fInvalid; //dib memory is out of sync with bitmap 190 133 191 BITMAPINFO2 *pOS2bmp; 134 192 // Linked list management … … 139 197 }; 140 198 141 #define DIBSECTION_MARK_INVALID(a)142 #define DIBSECTION_CHECK_IF_DIRTY(a)143 144 199 #endif 145 200
Note:
See TracChangeset
for help on using the changeset viewer.
