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

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

Issue 1918113002: Clean up CPDF_Page. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: more Created 4 years, 8 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>
11 11
12 #include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
13 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" 12 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h"
14 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" 13 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h"
15 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" 14 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
16 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" 15 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h"
17 #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" 16 #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h"
18 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 17 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
19 #include "core/fpdfapi/fpdf_page/pageint.h" 18 #include "core/fpdfapi/fpdf_page/pageint.h"
20 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 19 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
21 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 20 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
22 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 21 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 return TRUE; 526 return TRUE;
528 } 527 }
529 bitmap_device1.GetBitmap()->Clear(0xffffff); 528 bitmap_device1.GetBitmap()->Clear(0xffffff);
530 { 529 {
531 CPDF_RenderStatus bitmap_render; 530 CPDF_RenderStatus bitmap_render;
532 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL, 531 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL,
533 NULL, NULL, NULL, &m_pRenderStatus->m_Options, 0, 532 NULL, NULL, NULL, &m_pRenderStatus->m_Options, 0,
534 m_pRenderStatus->m_bDropObjects, NULL, TRUE); 533 m_pRenderStatus->m_bDropObjects, NULL, TRUE);
535 CFX_Matrix patternDevice = *pObj2Device; 534 CFX_Matrix patternDevice = *pObj2Device;
536 patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top); 535 patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top);
537 if (m_pPattern->m_PatternType == CPDF_Pattern::TILING) { 536 if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) {
538 bitmap_render.DrawTilingPattern( 537 bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject,
539 static_cast<CPDF_TilingPattern*>(m_pPattern), m_pImageObject, 538 &patternDevice, FALSE);
540 &patternDevice, FALSE); 539 } else if (CPDF_ShadingPattern* pShadingPattern =
541 } else { 540 m_pPattern->AsShadingPattern()) {
542 bitmap_render.DrawShadingPattern( 541 bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject,
543 static_cast<CPDF_ShadingPattern*>(m_pPattern), m_pImageObject, 542 &patternDevice, FALSE);
544 &patternDevice, FALSE);
545 } 543 }
546 } 544 }
547 { 545 {
548 CFX_FxgeDevice bitmap_device2; 546 CFX_FxgeDevice bitmap_device2;
549 if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb)) { 547 if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb)) {
550 return TRUE; 548 return TRUE;
551 } 549 }
552 bitmap_device2.GetBitmap()->Clear(0); 550 bitmap_device2.GetBitmap()->Clear(0);
553 CPDF_RenderStatus bitmap_render; 551 CPDF_RenderStatus bitmap_render;
554 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL, 552 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL,
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 std::unique_ptr<CPDF_Function> pFunc; 885 std::unique_ptr<CPDF_Function> pFunc;
888 CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR"); 886 CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR");
889 if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) 887 if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream()))
890 pFunc.reset(CPDF_Function::Load(pFuncObj)); 888 pFunc.reset(CPDF_Function::Load(pFuncObj));
891 889
892 CFX_Matrix matrix = *pMatrix; 890 CFX_Matrix matrix = *pMatrix;
893 matrix.TranslateI(-pClipRect->left, -pClipRect->top); 891 matrix.TranslateI(-pClipRect->left, -pClipRect->top);
894 892
895 CPDF_Form form(m_pContext->GetDocument(), m_pContext->GetPageResources(), 893 CPDF_Form form(m_pContext->GetDocument(), m_pContext->GetPageResources(),
896 pGroup); 894 pGroup);
897 form.ParseContent(NULL, NULL, NULL, NULL); 895 form.ParseContent(nullptr, nullptr, nullptr);
898 896
899 CFX_FxgeDevice bitmap_device; 897 CFX_FxgeDevice bitmap_device;
900 FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha"; 898 FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha";
901 int width = pClipRect->right - pClipRect->left; 899 int width = pClipRect->right - pClipRect->left;
902 int height = pClipRect->bottom - pClipRect->top; 900 int height = pClipRect->bottom - pClipRect->top;
903 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 901 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
904 if (!bitmap_device.Create(width, height, 902 if (!bitmap_device.Create(width, height,
905 bLuminosity ? FXDIB_Rgb32 : FXDIB_8bppMask)) { 903 bLuminosity ? FXDIB_Rgb32 : FXDIB_8bppMask)) {
906 return NULL; 904 return NULL;
907 } 905 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } else if (pFunc) { 996 } else if (pFunc) {
999 int size = dest_pitch * height; 997 int size = dest_pitch * height;
1000 for (int i = 0; i < size; i++) { 998 for (int i = 0; i < size; i++) {
1001 dest_buf[i] = transfers[src_buf[i]]; 999 dest_buf[i] = transfers[src_buf[i]];
1002 } 1000 }
1003 } else { 1001 } else {
1004 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); 1002 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height);
1005 } 1003 }
1006 return pMask.release(); 1004 return pMask.release();
1007 } 1005 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render_cache.cpp ('k') | core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698