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

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

Issue 801913002: Simplify PDFium by removing code that's not used in the open source repo. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years 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
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_ 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
9 #include "../../../include/fxge/fx_ge_win32.h" 9 #include "../../../include/fxge/fx_ge_win32.h"
10 #include <crtdbg.h> 10 #include <crtdbg.h>
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 FX_BOOL CWin32FontInfo::GetFontCharset(void* hFont, int& charset) 385 FX_BOOL CWin32FontInfo::GetFontCharset(void* hFont, int& charset)
386 { 386 {
387 TEXTMETRIC tm; 387 TEXTMETRIC tm;
388 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); 388 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
389 ::GetTextMetrics(m_hDC, &tm); 389 ::GetTextMetrics(m_hDC, &tm);
390 ::SelectObject(m_hDC, hOldFont); 390 ::SelectObject(m_hDC, hOldFont);
391 charset = tm.tmCharSet; 391 charset = tm.tmCharSet;
392 return TRUE; 392 return TRUE;
393 } 393 }
394 #ifndef _FPDFAPI_MINI_
395 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() 394 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault()
396 { 395 {
397 return FX_NEW CWin32FontInfo; 396 return FX_NEW CWin32FontInfo;
398 } 397 }
399 #endif
400 void CFX_GEModule::InitPlatform() 398 void CFX_GEModule::InitPlatform()
401 { 399 {
402 CWin32Platform* pPlatformData = FX_NEW CWin32Platform; 400 CWin32Platform* pPlatformData = FX_NEW CWin32Platform;
403 if (!pPlatformData) { 401 if (!pPlatformData) {
404 return; 402 return;
405 } 403 }
406 OSVERSIONINFO ver; 404 OSVERSIONINFO ver;
407 ver.dwOSVersionInfoSize = sizeof(ver); 405 ver.dwOSVersionInfoSize = sizeof(ver);
408 GetVersionEx(&ver); 406 GetVersionEx(&ver);
409 pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5; 407 pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5;
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 } else { 970 } else {
973 CFX_DIBitmap bitmap; 971 CFX_DIBitmap bitmap;
974 if (bitmap.Create(width, height, FXDIB_Rgb)) { 972 if (bitmap.Create(width, height, FXDIB_Rgb)) {
975 bmi.bmiHeader.biBitCount = 24; 973 bmi.bmiHeader.biBitCount = 24;
976 ::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi, DI B_RGB_COLORS); 974 ::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi, DI B_RGB_COLORS);
977 ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0, pI ccTransform); 975 ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0, pI ccTransform);
978 } else { 976 } else {
979 ret = FALSE; 977 ret = FALSE;
980 } 978 }
981 } 979 }
982 #ifndef _FPDFAPI_MINI_
983 if (pBitmap->HasAlpha() && ret) { 980 if (pBitmap->HasAlpha() && ret) {
984 pBitmap->LoadChannel(FXDIB_Alpha, 0xff); 981 pBitmap->LoadChannel(FXDIB_Alpha, 0xff);
985 } 982 }
986 #endif
987 DeleteObject(hbmp); 983 DeleteObject(hbmp);
988 DeleteObject(hDCMemory); 984 DeleteObject(hDCMemory);
989 return ret; 985 return ret;
990 } 986 }
991 FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo r, const FX_RECT* pSrcRect, int left, int top, int blend_type, 987 FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo r, const FX_RECT* pSrcRect, int left, int top, int blend_type,
992 int alpha_flag, void* pIccTransform) 988 int alpha_flag, void* pIccTransform)
993 { 989 {
994 ASSERT(blend_type == FXDIB_BLEND_NORMAL); 990 ASSERT(blend_type == FXDIB_BLEND_NORMAL);
995 if (pSource->IsAlphaMask()) { 991 if (pSource->IsAlphaMask()) {
996 int width = pSource->GetWidth(), height = pSource->GetHeight(); 992 int width = pSource->GetWidth(), height = pSource->GetHeight();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, FX_BOOL bCmykOu tput) 1164 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, FX_BOOL bCmykOu tput)
1169 { 1165 {
1170 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); 1166 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY);
1171 int obj_type = ::GetObjectType(hDC); 1167 int obj_type = ::GetObjectType(hDC);
1172 int device_class; 1168 int device_class;
1173 if (device_type == DT_RASPRINTER || device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC) { 1169 if (device_type == DT_RASPRINTER || device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC) {
1174 device_class = FXDC_PRINTER; 1170 device_class = FXDC_PRINTER;
1175 } else { 1171 } else {
1176 device_class = FXDC_DISPLAY; 1172 device_class = FXDC_DISPLAY;
1177 } 1173 }
1178 #ifndef _FPDFAPI_MINI_
1179 if (device_class == FXDC_PRINTER) { 1174 if (device_class == FXDC_PRINTER) {
1180 return FX_NEW CGdiPrinterDriver(hDC); 1175 return FX_NEW CGdiPrinterDriver(hDC);
1181 } 1176 }
1182 #endif
1183 return FX_NEW CGdiDisplayDriver(hDC); 1177 return FX_NEW CGdiDisplayDriver(hDC);
1184 } 1178 }
1185 CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for mat) 1179 CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for mat)
1186 { 1180 {
1187 BITMAPINFOHEADER bmih; 1181 BITMAPINFOHEADER bmih;
1188 FXSYS_memset32(&bmih, 0, sizeof (BITMAPINFOHEADER)); 1182 FXSYS_memset32(&bmih, 0, sizeof (BITMAPINFOHEADER));
1189 bmih.biSize = sizeof(BITMAPINFOHEADER); 1183 bmih.biSize = sizeof(BITMAPINFOHEADER);
1190 bmih.biBitCount = format & 0xff; 1184 bmih.biBitCount = format & 0xff;
1191 bmih.biHeight = -height; 1185 bmih.biHeight = -height;
1192 bmih.biPlanes = 1; 1186 bmih.biPlanes = 1;
(...skipping 22 matching lines...) Expand all
1215 if (m_hDC) { 1209 if (m_hDC) {
1216 SelectObject(m_hDC, m_hOldBitmap); 1210 SelectObject(m_hDC, m_hOldBitmap);
1217 DeleteDC(m_hDC); 1211 DeleteDC(m_hDC);
1218 } 1212 }
1219 if (m_hBitmap) { 1213 if (m_hBitmap) {
1220 DeleteObject(m_hBitmap); 1214 DeleteObject(m_hBitmap);
1221 } 1215 }
1222 delete GetBitmap(); 1216 delete GetBitmap();
1223 } 1217 }
1224 #endif 1218 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698