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

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

Issue 2163103002: Use smart pointers for graphics device classes (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: vector change Created 4 years, 5 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
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 "core/fxge/include/fx_ge.h" 7 #include "core/fxge/include/fx_ge.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 !GetDIBits(&bitmap, left, top) || 1246 !GetDIBits(&bitmap, left, top) ||
1247 !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, 1247 !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left,
1248 pSrcRect->top, FXDIB_BLEND_NORMAL, nullptr, 1248 pSrcRect->top, FXDIB_BLEND_NORMAL, nullptr,
1249 FALSE, nullptr)) { 1249 FALSE, nullptr)) {
1250 return FALSE; 1250 return FALSE;
1251 } 1251 }
1252 FX_RECT src_rect(0, 0, width, height); 1252 FX_RECT src_rect(0, 0, width, height);
1253 return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL); 1253 return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL);
1254 } 1254 }
1255 CFX_DIBExtractor temp(pSource); 1255 CFX_DIBExtractor temp(pSource);
1256 CFX_DIBitmap* pBitmap = temp; 1256 CFX_DIBitmap* pBitmap = temp.GetBitmap();
1257 if (!pBitmap) 1257 if (!pBitmap)
1258 return FALSE; 1258 return FALSE;
1259 return GDI_SetDIBits(pBitmap, pSrcRect, left, top); 1259 return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
1260 } 1260 }
1261 1261
1262 FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, 1262 FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
1263 uint32_t color, 1263 uint32_t color,
1264 int dest_left, 1264 int dest_left,
1265 int dest_top, 1265 int dest_top,
1266 int dest_width, 1266 int dest_width,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 FX_RECT src_rect(0, 0, clip_width, clip_height); 1328 FX_RECT src_rect(0, 0, clip_width, clip_height);
1329 return SetDIBits(&background, 0, &src_rect, 1329 return SetDIBits(&background, 0, &src_rect,
1330 image_rect.left + clip_rect.left, 1330 image_rect.left + clip_rect.left,
1331 image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL); 1331 image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL);
1332 } 1332 }
1333 if (pSource->HasAlpha()) { 1333 if (pSource->HasAlpha()) {
1334 CWin32Platform* pPlatform = 1334 CWin32Platform* pPlatform =
1335 (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); 1335 (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
1336 if (pPlatform->m_GdiplusExt.IsAvailable() && !pSource->IsCmykImage()) { 1336 if (pPlatform->m_GdiplusExt.IsAvailable() && !pSource->IsCmykImage()) {
1337 CFX_DIBExtractor temp(pSource); 1337 CFX_DIBExtractor temp(pSource);
1338 CFX_DIBitmap* pBitmap = temp; 1338 CFX_DIBitmap* pBitmap = temp.GetBitmap();
1339 if (!pBitmap) 1339 if (!pBitmap)
1340 return FALSE; 1340 return FALSE;
1341 return pPlatform->m_GdiplusExt.StretchDIBits( 1341 return pPlatform->m_GdiplusExt.StretchDIBits(
1342 m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, 1342 m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height,
1343 pClipRect, flags); 1343 pClipRect, flags);
1344 } 1344 }
1345 return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, 1345 return UseFoxitStretchEngine(pSource, color, dest_left, dest_top,
1346 dest_width, dest_height, pClipRect, flags); 1346 dest_width, dest_height, pClipRect, flags);
1347 } 1347 }
1348 CFX_DIBExtractor temp(pSource); 1348 CFX_DIBExtractor temp(pSource);
1349 CFX_DIBitmap* pBitmap = temp; 1349 CFX_DIBitmap* pBitmap = temp.GetBitmap();
1350 if (!pBitmap) 1350 if (!pBitmap)
1351 return FALSE; 1351 return FALSE;
1352 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, 1352 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
1353 dest_height, flags); 1353 dest_height, flags);
1354 } 1354 }
1355 1355
1356 FX_BOOL CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap, 1356 FX_BOOL CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap,
1357 int bitmap_alpha, 1357 int bitmap_alpha,
1358 uint32_t color, 1358 uint32_t color,
1359 const CFX_Matrix* pMatrix, 1359 const CFX_Matrix* pMatrix,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 if (m_hDC) { 1415 if (m_hDC) {
1416 SelectObject(m_hDC, m_hOldBitmap); 1416 SelectObject(m_hDC, m_hOldBitmap);
1417 DeleteDC(m_hDC); 1417 DeleteDC(m_hDC);
1418 } 1418 }
1419 if (m_hBitmap) 1419 if (m_hBitmap)
1420 DeleteObject(m_hBitmap); 1420 DeleteObject(m_hBitmap);
1421 delete GetBitmap(); 1421 delete GetBitmap();
1422 } 1422 }
1423 1423
1424 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ 1424 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698