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

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

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 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
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_module.h" 7 #include "../../../include/fpdfapi/fpdf_module.h"
8 #include "../../../include/fpdfapi/fpdf_render.h" 8 #include "../../../include/fpdfapi/fpdf_render.h"
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../fpdf_page/pageint.h" 10 #include "../fpdf_page/pageint.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (!pDocCache) { 544 if (!pDocCache) {
545 return NULL; 545 return NULL;
546 } 546 }
547 return pDocCache->GetTransferFunc(pObj); 547 return pDocCache->GetTransferFunc(pObj);
548 } 548 }
549 FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bTyp e3) const 549 FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bTyp e3) const
550 { 550 {
551 CPDF_ColorStateData* pColorData = (CPDF_ColorStateData*)(const CPDF_ColorSta teData*)pObj->m_ColorState; 551 CPDF_ColorStateData* pColorData = (CPDF_ColorStateData*)(const CPDF_ColorSta teData*)pObj->m_ColorState;
552 if (m_pType3Char && !bType3 && (!m_pType3Char->m_bColored || (m_pType3Char-> m_bColored && (!pColorData || pColorData->m_FillColor.IsNull())))) { 552 if (m_pType3Char && !bType3 && (!m_pType3Char->m_bColored || (m_pType3Char-> m_bColored && (!pColorData || pColorData->m_FillColor.IsNull())))) {
553 return m_T3FillColor; 553 return m_T3FillColor;
554 } else if (!pColorData || pColorData->m_FillColor.IsNull()) { 554 }
555 if (!pColorData || pColorData->m_FillColor.IsNull()) {
555 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial States.m_ColorState; 556 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial States.m_ColorState;
556 } 557 }
557 FX_COLORREF rgb = pColorData->m_FillRGB; 558 FX_COLORREF rgb = pColorData->m_FillRGB;
558 if (rgb == (FX_DWORD) - 1) { 559 if (rgb == (FX_DWORD) - 1) {
559 return 0; 560 return 0;
560 } 561 }
561 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; 562 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState;
562 int alpha; 563 int alpha;
563 if (pGeneralData) { 564 if (pGeneralData) {
564 alpha = (int32_t)(pGeneralData->m_FillAlpha * 255); 565 alpha = (int32_t)(pGeneralData->m_FillAlpha * 255);
565 if (pGeneralData->m_pTR) { 566 if (pGeneralData->m_pTR) {
566 if (!pGeneralData->m_pTransferFunc) { 567 if (!pGeneralData->m_pTransferFunc) {
567 ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTra nsferFunc(pGeneralData->m_pTR); 568 ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTra nsferFunc(pGeneralData->m_pTR);
568 } 569 }
569 if (pGeneralData->m_pTransferFunc) { 570 if (pGeneralData->m_pTransferFunc) {
570 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); 571 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb);
571 } 572 }
572 } 573 }
573 } else { 574 } else {
574 alpha = 255; 575 alpha = 255;
575 } 576 }
576 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); 577 return m_Options.TranslateColor(ArgbEncode(alpha, rgb));
577 } 578 }
578 FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const 579 FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const
579 { 580 {
580 CPDF_ColorStateData* pColorData = (CPDF_ColorStateData*)(const CPDF_ColorSta teData*)pObj->m_ColorState; 581 CPDF_ColorStateData* pColorData = (CPDF_ColorStateData*)(const CPDF_ColorSta teData*)pObj->m_ColorState;
581 if (m_pType3Char && (!m_pType3Char->m_bColored || (m_pType3Char->m_bColored && (!pColorData || pColorData->m_StrokeColor.IsNull())))) { 582 if (m_pType3Char && (!m_pType3Char->m_bColored || (m_pType3Char->m_bColored && (!pColorData || pColorData->m_StrokeColor.IsNull())))) {
582 return m_T3FillColor; 583 return m_T3FillColor;
583 } else if (!pColorData || pColorData->m_StrokeColor.IsNull()) { 584 }
585 if (!pColorData || pColorData->m_StrokeColor.IsNull()) {
584 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial States.m_ColorState; 586 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial States.m_ColorState;
585 } 587 }
586 FX_COLORREF rgb = pColorData->m_StrokeRGB; 588 FX_COLORREF rgb = pColorData->m_StrokeRGB;
587 if (rgb == (FX_DWORD) - 1) { 589 if (rgb == (FX_DWORD) - 1) {
588 return 0; 590 return 0;
589 } 591 }
590 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; 592 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState;
591 int alpha; 593 int alpha;
592 if (pGeneralData) { 594 if (pGeneralData) {
593 alpha = (int32_t)(pGeneralData->m_StrokeAlpha * 255); 595 alpha = (int32_t)(pGeneralData->m_StrokeAlpha * 255);
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 CPDF_ContentMarkItem& item = pData->GetItem(i); 1382 CPDF_ContentMarkItem& item = pData->GetItem(i);
1381 if (item.GetName() == FX_BSTRC("OC") && item.GetParamType() == CPDF_Cont entMarkItem::PropertiesDict) { 1383 if (item.GetName() == FX_BSTRC("OC") && item.GetParamType() == CPDF_Cont entMarkItem::PropertiesDict) {
1382 CPDF_Dictionary* pOCG = (CPDF_Dictionary*)item.GetParam(); 1384 CPDF_Dictionary* pOCG = (CPDF_Dictionary*)item.GetParam();
1383 if (!CheckOCGVisible(pOCG)) { 1385 if (!CheckOCGVisible(pOCG)) {
1384 return FALSE; 1386 return FALSE;
1385 } 1387 }
1386 } 1388 }
1387 } 1389 }
1388 return TRUE; 1390 return TRUE;
1389 } 1391 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698