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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp

Issue 366803003: Fix uninitialized RGB in GetRGB (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/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include "pageint.h" 10 #include "pageint.h"
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) { 1355 if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) {
1356 pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()- >GetPattern(pvalue->m_pPattern->m_pPatternObj, FALSE, &pvalue->m_pPattern->m_Par entMatrix); 1356 pvalue->m_pPattern = pvalue->m_pPattern->m_pDocument->GetPageData()- >GetPattern(pvalue->m_pPattern->m_pPatternObj, FALSE, &pvalue->m_pPattern->m_Par entMatrix);
1357 } 1357 }
1358 } 1358 }
1359 } 1359 }
1360 FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const 1360 FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const
1361 { 1361 {
1362 if (m_pCS == NULL || m_pBuffer == NULL) { 1362 if (m_pCS == NULL || m_pBuffer == NULL) {
1363 return FALSE; 1363 return FALSE;
1364 } 1364 }
1365 FX_FLOAT r, g, b; 1365 FX_FLOAT r=0.0f, g=0.0f, b=0.0f;
1366 if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) { 1366 if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) {
1367 return FALSE; 1367 return FALSE;
1368 } 1368 }
1369 R = (FX_INT32)(r * 255 + 0.5f); 1369 R = (FX_INT32)(r * 255 + 0.5f);
1370 G = (FX_INT32)(g * 255 + 0.5f); 1370 G = (FX_INT32)(g * 255 + 0.5f);
1371 B = (FX_INT32)(b * 255 + 0.5f); 1371 B = (FX_INT32)(b * 255 + 0.5f);
1372 return TRUE; 1372 return TRUE;
1373 } 1373 }
1374 CPDF_Pattern* CPDF_Color::GetPattern() const 1374 CPDF_Pattern* CPDF_Color::GetPattern() const
1375 { 1375 {
(...skipping 18 matching lines...) Expand all
1394 PatternValue* pvalue = (PatternValue*)m_pBuffer; 1394 PatternValue* pvalue = (PatternValue*)m_pBuffer;
1395 return pvalue->m_nComps ? pvalue->m_Comps : NULL; 1395 return pvalue->m_nComps ? pvalue->m_Comps : NULL;
1396 } 1396 }
1397 FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const 1397 FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const
1398 { 1398 {
1399 if (m_pCS != other.m_pCS || m_pCS == NULL) { 1399 if (m_pCS != other.m_pCS || m_pCS == NULL) {
1400 return FALSE; 1400 return FALSE;
1401 } 1401 }
1402 return FXSYS_memcmp32(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; 1402 return FXSYS_memcmp32(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0;
1403 } 1403 }
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