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

Side by Side Diff: core/fxge/dib/fx_dib_engine.cpp

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 Created 4 years, 2 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/fxge/apple/fx_quartz_device.cpp ('k') | core/fxge/dib/fx_dib_main.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 <limits.h> 7 #include <limits.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fxge/dib/dib_int.h" 11 #include "core/fxge/dib/dib_int.h"
12 #include "core/fxge/fx_dib.h" 12 #include "core/fxge/fx_dib.h"
13 #include "third_party/base/ptr_util.h"
13 14
14 namespace { 15 namespace {
15 16
16 bool SourceSizeWithinLimit(int width, int height) { 17 bool SourceSizeWithinLimit(int width, int height) {
17 const int kMaxProgressiveStretchPixels = 1000000; 18 const int kMaxProgressiveStretchPixels = 1000000;
18 return !height || width < kMaxProgressiveStretchPixels / height; 19 return !height || width < kMaxProgressiveStretchPixels / height;
19 } 20 }
20 21
21 FXDIB_Format GetStretchedFormat(const CFX_DIBSource& src) { 22 FXDIB_Format GetStretchedFormat(const CFX_DIBSource& src) {
22 FXDIB_Format format = src.GetFormat(); 23 FXDIB_Format format = src.GetFormat();
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 return StartStretch(); 924 return StartStretch();
924 } 925 }
925 926
926 FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) { 927 FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) {
927 if (m_Flags & FXDIB_DOWNSAMPLE) 928 if (m_Flags & FXDIB_DOWNSAMPLE)
928 return ContinueQuickStretch(pPause); 929 return ContinueQuickStretch(pPause);
929 return ContinueStretch(pPause); 930 return ContinueStretch(pPause);
930 } 931 }
931 932
932 FX_BOOL CFX_ImageStretcher::StartStretch() { 933 FX_BOOL CFX_ImageStretcher::StartStretch() {
933 m_pStretchEngine = WrapUnique( 934 m_pStretchEngine = pdfium::MakeUnique<CStretchEngine>(
934 new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, 935 m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource,
935 m_ClipRect, m_pSource, m_Flags)); 936 m_Flags);
936 m_pStretchEngine->StartStretchHorz(); 937 m_pStretchEngine->StartStretchHorz();
937 if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) { 938 if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
938 m_pStretchEngine->Continue(nullptr); 939 m_pStretchEngine->Continue(nullptr);
939 return FALSE; 940 return FALSE;
940 } 941 }
941 return TRUE; 942 return TRUE;
942 } 943 }
943 944
944 FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) { 945 FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) {
945 return m_pStretchEngine && m_pStretchEngine->Continue(pPause); 946 return m_pStretchEngine && m_pStretchEngine->Continue(pPause);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 result_width); 999 result_width);
999 if (m_pMaskScanline) { 1000 if (m_pMaskScanline) {
1000 m_pSource->m_pAlphaMask->DownSampleScanline( 1001 m_pSource->m_pAlphaMask->DownSampleScanline(
1001 src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX, 1002 src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX,
1002 m_ClipRect.left, result_width); 1003 m_ClipRect.left, result_width);
1003 } 1004 }
1004 m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get()); 1005 m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get());
1005 } 1006 }
1006 return FALSE; 1007 return FALSE;
1007 } 1008 }
OLDNEW
« no previous file with comments | « core/fxge/apple/fx_quartz_device.cpp ('k') | core/fxge/dib/fx_dib_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698