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

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

Issue 361103002: Fix uninitialized RGB in LoadPalette (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | 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 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 #include "../../../include/fpdfapi/fpdf_module.h" 9 #include "../../../include/fpdfapi/fpdf_module.h"
10 #include "../../../include/fpdfapi/fpdf_render.h" 10 #include "../../../include/fpdfapi/fpdf_render.h"
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 if (m_bpc * m_nComponents == 1) { 862 if (m_bpc * m_nComponents == 1) {
863 if (m_bDefaultDecode && (m_Family == PDFCS_DEVICEGRAY || m_Family == PDF CS_DEVICERGB)) { 863 if (m_bDefaultDecode && (m_Family == PDFCS_DEVICEGRAY || m_Family == PDF CS_DEVICERGB)) {
864 return; 864 return;
865 } 865 }
866 if (m_pColorSpace->CountComponents() > 3) { 866 if (m_pColorSpace->CountComponents() > 3) {
867 return; 867 return;
868 } 868 }
869 FX_FLOAT color_values[3]; 869 FX_FLOAT color_values[3];
870 color_values[0] = m_pCompData[0].m_DecodeMin; 870 color_values[0] = m_pCompData[0].m_DecodeMin;
871 color_values[1] = color_values[2] = color_values[0]; 871 color_values[1] = color_values[2] = color_values[0];
872 FX_FLOAT R, G, B; 872 FX_FLOAT R=0.0f, G=0.0f, B=0.0f;
873 m_pColorSpace->GetRGB(color_values, R, G, B); 873 m_pColorSpace->GetRGB(color_values, R, G, B);
874 FX_ARGB argb0 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 25 5), FXSYS_round(B * 255)); 874 FX_ARGB argb0 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 25 5), FXSYS_round(B * 255));
875 color_values[0] += m_pCompData[0].m_DecodeStep; 875 color_values[0] += m_pCompData[0].m_DecodeStep;
876 color_values[1] += m_pCompData[0].m_DecodeStep; 876 color_values[1] += m_pCompData[0].m_DecodeStep;
877 color_values[2] += m_pCompData[0].m_DecodeStep; 877 color_values[2] += m_pCompData[0].m_DecodeStep;
878 m_pColorSpace->GetRGB(color_values, R, G, B); 878 m_pColorSpace->GetRGB(color_values, R, G, B);
879 FX_ARGB argb1 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 25 5), FXSYS_round(B * 255)); 879 FX_ARGB argb1 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 25 5), FXSYS_round(B * 255));
880 if (argb0 != 0xFF000000 || argb1 != 0xFFFFFFFF) { 880 if (argb0 != 0xFF000000 || argb1 != 0xFFFFFFFF) {
881 SetPaletteArgb(0, argb0); 881 SetPaletteArgb(0, argb0);
882 SetPaletteArgb(1, argb1); 882 SetPaletteArgb(1, argb1);
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 if (!m_bCached) { 1507 if (!m_bCached) {
1508 if (m_pBitmap) { 1508 if (m_pBitmap) {
1509 delete m_pBitmap; 1509 delete m_pBitmap;
1510 m_pBitmap = NULL; 1510 m_pBitmap = NULL;
1511 } 1511 }
1512 if (m_pMask) { 1512 if (m_pMask) {
1513 delete m_pMask; 1513 delete m_pMask;
1514 } 1514 }
1515 } 1515 }
1516 } 1516 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698