Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: core/src/fxge/win32/fx_win32_dib.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/win32/fx_win32_device.cpp ('k') | core/src/fxge/win32/fx_win32_dwrite.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
9 #include <windows.h> 9 #include <windows.h>
10 #include "../../../include/fxge/fx_ge_win32.h" 10 #include "../../../include/fxge/fx_ge_win32.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return NULL; 64 return NULL;
65 } 65 }
66 FXDIB_Format format = bAlpha ? (FXDIB_Format)(pbmi->bmiHeader.biBitCount + 0 x200) : (FXDIB_Format)pbmi->bmiHeader.biBitCount; 66 FXDIB_Format format = bAlpha ? (FXDIB_Format)(pbmi->bmiHeader.biBitCount + 0 x200) : (FXDIB_Format)pbmi->bmiHeader.biBitCount;
67 FX_BOOL ret = pBitmap->Create(width, height, format); 67 FX_BOOL ret = pBitmap->Create(width, height, format);
68 if (!ret) { 68 if (!ret) {
69 delete pBitmap; 69 delete pBitmap;
70 return NULL; 70 return NULL;
71 } 71 }
72 FXSYS_memcpy32(pBitmap->GetBuffer(), pData, pitch * height); 72 FXSYS_memcpy32(pBitmap->GetBuffer(), pData, pitch * height);
73 if (bBottomUp) { 73 if (bBottomUp) {
74 FX_LPBYTE temp_buf = FX_Alloc(FX_BYTE, pitch); 74 FX_LPBYTE temp_buf = FX_Alloc(uint8_t, pitch);
75 int top = 0, bottom = height - 1; 75 int top = 0, bottom = height - 1;
76 while (top < bottom) { 76 while (top < bottom) {
77 FXSYS_memcpy32(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch); 77 FXSYS_memcpy32(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch);
78 FXSYS_memcpy32(pBitmap->GetBuffer() + top * pitch, pBitmap->GetBuffe r() + bottom * pitch, pitch); 78 FXSYS_memcpy32(pBitmap->GetBuffer() + top * pitch, pBitmap->GetBuffe r() + bottom * pitch, pitch);
79 FXSYS_memcpy32(pBitmap->GetBuffer() + bottom * pitch, temp_buf, pitc h); 79 FXSYS_memcpy32(pBitmap->GetBuffer() + bottom * pitch, temp_buf, pitc h);
80 top ++; 80 top ++;
81 bottom --; 81 bottom --;
82 } 82 }
83 FX_Free(temp_buf); 83 FX_Free(temp_buf);
84 temp_buf = NULL; 84 temp_buf = NULL;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 CFX_DIBitmap* pDIBitmap = FX_NEW CFX_DIBitmap; 203 CFX_DIBitmap* pDIBitmap = FX_NEW CFX_DIBitmap;
204 if (!pDIBitmap) { 204 if (!pDIBitmap) {
205 return NULL; 205 return NULL;
206 } 206 }
207 int ret = 0; 207 int ret = 0;
208 if (bmih.biBitCount == 1 || bmih.biBitCount == 8) { 208 if (bmih.biBitCount == 1 || bmih.biBitCount == 8) {
209 int size = sizeof (BITMAPINFOHEADER) + 8; 209 int size = sizeof (BITMAPINFOHEADER) + 8;
210 if (bmih.biBitCount == 8) { 210 if (bmih.biBitCount == 8) {
211 size += sizeof (FX_DWORD) * 254; 211 size += sizeof (FX_DWORD) * 254;
212 } 212 }
213 BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(FX_BYTE, size); 213 BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(uint8_t, size);
214 pbmih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 214 pbmih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
215 pbmih->bmiHeader.biBitCount = bmih.biBitCount; 215 pbmih->bmiHeader.biBitCount = bmih.biBitCount;
216 pbmih->bmiHeader.biCompression = BI_RGB; 216 pbmih->bmiHeader.biCompression = BI_RGB;
217 pbmih->bmiHeader.biHeight = -height; 217 pbmih->bmiHeader.biHeight = -height;
218 pbmih->bmiHeader.biPlanes = 1; 218 pbmih->bmiHeader.biPlanes = 1;
219 pbmih->bmiHeader.biWidth = bmih.biWidth; 219 pbmih->bmiHeader.biWidth = bmih.biWidth;
220 if (!pDIBitmap->Create(bmih.biWidth, height, bmih.biBitCount == 1 ? FXDI B_1bppRgb : FXDIB_8bppRgb)) { 220 if (!pDIBitmap->Create(bmih.biWidth, height, bmih.biBitCount == 1 ? FXDI B_1bppRgb : FXDIB_8bppRgb)) {
221 delete pDIBitmap; 221 delete pDIBitmap;
222 FX_Free(pbmih); 222 FX_Free(pbmih);
223 if (bCreatedDC) { 223 if (bCreatedDC) {
(...skipping 15 matching lines...) Expand all
239 delete pDIBitmap; 239 delete pDIBitmap;
240 if (bCreatedDC) { 240 if (bCreatedDC) {
241 DeleteDC(hDC); 241 DeleteDC(hDC);
242 } 242 }
243 return NULL; 243 return NULL;
244 } 244 }
245 ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAP INFO*)&bmih, DIB_RGB_COLORS); 245 ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAP INFO*)&bmih, DIB_RGB_COLORS);
246 if (ret != 0 && bmih.biBitCount == 32) { 246 if (ret != 0 && bmih.biBitCount == 32) {
247 int pitch = pDIBitmap->GetPitch(); 247 int pitch = pDIBitmap->GetPitch();
248 for (int row = 0; row < height; row ++) { 248 for (int row = 0; row < height; row ++) {
249 FX_BYTE* dest_scan = (FX_BYTE*)(pDIBitmap->GetBuffer() + row * p itch); 249 uint8_t* dest_scan = (uint8_t*)(pDIBitmap->GetBuffer() + row * p itch);
250 for (int col = 0; col < width; col++) { 250 for (int col = 0; col < width; col++) {
251 dest_scan[3] = 255; 251 dest_scan[3] = 255;
252 dest_scan += 4; 252 dest_scan += 4;
253 } 253 }
254 } 254 }
255 } 255 }
256 } 256 }
257 if (ret == 0) { 257 if (ret == 0) {
258 if (pDIBitmap) { 258 if (pDIBitmap) {
259 delete pDIBitmap; 259 delete pDIBitmap;
(...skipping 27 matching lines...) Expand all
287 } 287 }
288 void CFX_WindowsDIB::LoadFromDevice(HDC hDC, int left, int top) 288 void CFX_WindowsDIB::LoadFromDevice(HDC hDC, int left, int top)
289 { 289 {
290 ::BitBlt(m_hMemDC, 0, 0, m_Width, m_Height, hDC, left, top, SRCCOPY); 290 ::BitBlt(m_hMemDC, 0, 0, m_Width, m_Height, hDC, left, top, SRCCOPY);
291 } 291 }
292 void CFX_WindowsDIB::SetToDevice(HDC hDC, int left, int top) 292 void CFX_WindowsDIB::SetToDevice(HDC hDC, int left, int top)
293 { 293 {
294 ::BitBlt(hDC, left, top, m_Width, m_Height, m_hMemDC, 0, 0, SRCCOPY); 294 ::BitBlt(hDC, left, top, m_Width, m_Height, m_hMemDC, 0, 0, SRCCOPY);
295 } 295 }
296 #endif 296 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_device.cpp ('k') | core/src/fxge/win32/fx_win32_dwrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698