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

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

Issue 1419943006: More chromium_code whack-a-mole. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month 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 | « BUILD.gn ('k') | core/src/fxge/win32/fx_win32_gdipext.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 8
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
10 #include <crtdbg.h> 10 #include <crtdbg.h>
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 case HANGUL_CHARSET: 351 case HANGUL_CHARSET:
352 case GB2312_CHARSET: 352 case GB2312_CHARSET:
353 subst_pitch_family = 0; 353 subst_pitch_family = 0;
354 break; 354 break;
355 } 355 }
356 HFONT hFont = 356 HFONT hFont =
357 ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, 357 ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset,
358 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face); 358 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face);
359 char facebuf[100]; 359 char facebuf[100];
360 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, hFont); 360 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, hFont);
361 int ret = ::GetTextFaceA(m_hDC, 100, facebuf); 361 ::GetTextFaceA(m_hDC, 100, facebuf);
362 ::SelectObject(m_hDC, hOldFont); 362 ::SelectObject(m_hDC, hOldFont);
363 if (face.EqualNoCase(facebuf)) { 363 if (face.EqualNoCase(facebuf)) {
364 return hFont; 364 return hFont;
365 } 365 }
366 int iCount = sizeof(VariantNames) / sizeof(VariantNames[0]); 366 int iCount = sizeof(VariantNames) / sizeof(VariantNames[0]);
367 for (int i = 0; i < iCount; ++i) { 367 for (int i = 0; i < iCount; ++i) {
368 if (face == VariantNames[i].m_pFaceName) { 368 if (face == VariantNames[i].m_pFaceName) {
369 CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf); 369 CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf);
370 const unsigned short* pName = 370 const unsigned short* pName =
371 (const unsigned short*)VariantNames[i].m_pVariantName; 371 (const unsigned short*)VariantNames[i].m_pVariantName;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 if (m_DeviceClass == FXDC_PRINTER) { 529 if (m_DeviceClass == FXDC_PRINTER) {
530 CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(FALSE, TRUE); 530 CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(FALSE, TRUE);
531 if (pBitmap == NULL) { 531 if (pBitmap == NULL) {
532 return FALSE; 532 return FALSE;
533 } 533 }
534 if ((pBitmap->IsCmykImage() || pIccTransform) && 534 if ((pBitmap->IsCmykImage() || pIccTransform) &&
535 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { 535 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) {
536 return FALSE; 536 return FALSE;
537 } 537 }
538 int width = pSrcRect->Width(), height = pSrcRect->Height(); 538 int width = pSrcRect->Width(), height = pSrcRect->Height();
539 int pitch = pBitmap->GetPitch();
540 LPBYTE pBuffer = pBitmap->GetBuffer(); 539 LPBYTE pBuffer = pBitmap->GetBuffer();
541 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); 540 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
542 ((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1; 541 ((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1;
543 FX_RECT dst_rect(0, 0, width, height); 542 FX_RECT dst_rect(0, 0, width, height);
544 dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); 543 dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
545 int dst_width = dst_rect.Width(); 544 int dst_width = dst_rect.Width();
546 int dst_height = dst_rect.Height(); 545 int dst_height = dst_rect.Height();
547 ::StretchDIBits(m_hDC, left, top, dst_width, dst_height, 0, 0, dst_width, 546 ::StretchDIBits(m_hDC, left, top, dst_width, dst_height, 0, 0, dst_width,
548 dst_height, pBuffer, (BITMAPINFO*)info.c_str(), 547 dst_height, pBuffer, (BITMAPINFO*)info.c_str(),
549 DIB_RGB_COLORS, SRCCOPY); 548 DIB_RGB_COLORS, SRCCOPY);
550 delete pBitmap; 549 delete pBitmap;
551 } else { 550 } else {
552 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; 551 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1;
553 if ((pBitmap->IsCmykImage() || pIccTransform) && 552 if ((pBitmap->IsCmykImage() || pIccTransform) &&
554 (pBitmap = pBitmap->CloneConvert(FXDIB_Rgb, NULL, pIccTransform)) == 553 (pBitmap = pBitmap->CloneConvert(FXDIB_Rgb, NULL, pIccTransform)) ==
555 NULL) { 554 NULL) {
556 return FALSE; 555 return FALSE;
557 } 556 }
558 int width = pSrcRect->Width(), height = pSrcRect->Height(); 557 int width = pSrcRect->Width(), height = pSrcRect->Height();
559 int pitch = pBitmap->GetPitch();
560 LPBYTE pBuffer = pBitmap->GetBuffer(); 558 LPBYTE pBuffer = pBitmap->GetBuffer();
561 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); 559 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
562 ::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left, 560 ::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left,
563 pBitmap->GetHeight() - pSrcRect->bottom, 0, 561 pBitmap->GetHeight() - pSrcRect->bottom, 0,
564 pBitmap->GetHeight(), pBuffer, 562 pBitmap->GetHeight(), pBuffer,
565 (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); 563 (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
566 if (pBitmap != pBitmap1) { 564 if (pBitmap != pBitmap1) {
567 delete pBitmap; 565 delete pBitmap;
568 } 566 }
569 } 567 }
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 SelectObject(m_hDC, m_hOldBitmap); 1356 SelectObject(m_hDC, m_hOldBitmap);
1359 DeleteDC(m_hDC); 1357 DeleteDC(m_hDC);
1360 } 1358 }
1361 if (m_hBitmap) { 1359 if (m_hBitmap) {
1362 DeleteObject(m_hBitmap); 1360 DeleteObject(m_hBitmap);
1363 } 1361 }
1364 delete GetBitmap(); 1362 delete GetBitmap();
1365 } 1363 }
1366 1364
1367 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ 1365 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | core/src/fxge/win32/fx_win32_gdipext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698