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

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

Issue 1783933002: Change colorspace's number of components to be unsigned (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 9 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/src/fpdfapi/fpdf_render/render_int.h" 7 #include "core/src/fpdfapi/fpdf_render/render_int.h"
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 if (pBC) { 910 if (pBC) {
911 CPDF_Dictionary* pDict = pGroup->GetDict(); 911 CPDF_Dictionary* pDict = pGroup->GetDict();
912 if (pDict && pDict->GetDictBy("Group")) 912 if (pDict && pDict->GetDictBy("Group"))
913 pCSObj = pDict->GetDictBy("Group")->GetElementValue("CS"); 913 pCSObj = pDict->GetDictBy("Group")->GetElementValue("CS");
914 else 914 else
915 pCSObj = NULL; 915 pCSObj = NULL;
916 pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); 916 pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj);
917 if (pCS) { 917 if (pCS) {
918 FX_FLOAT R, G, B; 918 FX_FLOAT R, G, B;
919 FX_DWORD comps = 8; 919 FX_DWORD comps = 8;
920 if (pCS->CountComponents() > static_cast<int32_t>(comps)) { 920 if (pCS->CountComponents() > comps) {
921 comps = (FX_DWORD)pCS->CountComponents(); 921 comps = pCS->CountComponents();
922 } 922 }
923 CFX_FixedBufGrow<FX_FLOAT, 8> float_array(comps); 923 CFX_FixedBufGrow<FX_FLOAT, 8> float_array(comps);
924 FX_FLOAT* pFloats = float_array; 924 FX_FLOAT* pFloats = float_array;
925 FX_SAFE_DWORD num_floats = comps; 925 FX_SAFE_DWORD num_floats = comps;
926 num_floats *= sizeof(FX_FLOAT); 926 num_floats *= sizeof(FX_FLOAT);
927 if (!num_floats.IsValid()) { 927 if (!num_floats.IsValid()) {
928 return NULL; 928 return NULL;
929 } 929 }
930 FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); 930 FXSYS_memset(pFloats, 0, num_floats.ValueOrDie());
931 int count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); 931 int count = pBC->GetCount() > 8 ? 8 : pBC->GetCount();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 } else if (pFunc) { 988 } else if (pFunc) {
989 int size = dest_pitch * height; 989 int size = dest_pitch * height;
990 for (int i = 0; i < size; i++) { 990 for (int i = 0; i < size; i++) {
991 dest_buf[i] = transfers[src_buf[i]]; 991 dest_buf[i] = transfers[src_buf[i]];
992 } 992 }
993 } else { 993 } else {
994 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); 994 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height);
995 } 995 }
996 return pMask.release(); 996 return pMask.release();
997 } 997 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/pageint.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698