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

Side by Side Diff: core/fpdfapi/fpdf_render/fpdf_render_image.cpp

Issue 2000973002: Make CPDF_Function::Load() return an unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix build, nits Created 4 years, 7 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/fpdfapi/fpdf_render/render_int.h" 7 #include "core/fpdfapi/fpdf_render/render_int.h"
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 } 865 }
866 866
867 CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( 867 CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
868 const uint8_t* src_buf, 868 const uint8_t* src_buf,
869 uint32_t src_size, 869 uint32_t src_size,
870 int width, 870 int width,
871 int height, 871 int height,
872 int nComps, 872 int nComps,
873 int bpc, 873 int bpc,
874 const CPDF_Dictionary* pParams); 874 const CPDF_Dictionary* pParams);
875
875 CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, 876 CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
876 FX_RECT* pClipRect, 877 FX_RECT* pClipRect,
877 const CFX_Matrix* pMatrix) { 878 const CFX_Matrix* pMatrix) {
878 if (!pSMaskDict) { 879 if (!pSMaskDict)
879 return NULL; 880 return nullptr;
880 } 881
881 CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G"); 882 CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G");
882 if (!pGroup) { 883 if (!pGroup)
883 return NULL; 884 return nullptr;
884 } 885
885 std::unique_ptr<CPDF_Function> pFunc; 886 std::unique_ptr<CPDF_Function> pFunc;
886 CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR"); 887 CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR");
887 if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) 888 if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream()))
888 pFunc.reset(CPDF_Function::Load(pFuncObj)); 889 pFunc = CPDF_Function::Load(pFuncObj);
889 890
890 CFX_Matrix matrix = *pMatrix; 891 CFX_Matrix matrix = *pMatrix;
891 matrix.TranslateI(-pClipRect->left, -pClipRect->top); 892 matrix.TranslateI(-pClipRect->left, -pClipRect->top);
892 893
893 CPDF_Form form(m_pContext->GetDocument(), m_pContext->GetPageResources(), 894 CPDF_Form form(m_pContext->GetDocument(), m_pContext->GetPageResources(),
894 pGroup); 895 pGroup);
895 form.ParseContent(nullptr, nullptr, nullptr); 896 form.ParseContent(nullptr, nullptr, nullptr);
896 897
897 CFX_FxgeDevice bitmap_device; 898 CFX_FxgeDevice bitmap_device;
898 FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha"; 899 FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha";
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 } else if (pFunc) { 997 } else if (pFunc) {
997 int size = dest_pitch * height; 998 int size = dest_pitch * height;
998 for (int i = 0; i < size; i++) { 999 for (int i = 0; i < size; i++) {
999 dest_buf[i] = transfers[src_buf[i]]; 1000 dest_buf[i] = transfers[src_buf[i]];
1000 } 1001 }
1001 } else { 1002 } else {
1002 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); 1003 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height);
1003 } 1004 }
1004 return pMask.release(); 1005 return pMask.release();
1005 } 1006 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render.cpp ('k') | core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698