| OLD | NEW |
| 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 "render_int.h" | 7 #include "render_int.h" |
| 8 | 8 |
| 9 #include "../fpdf_page/pageint.h" | 9 #include "../fpdf_page/pageint.h" |
| 10 #include "core/include/fpdfapi/fpdf_module.h" | 10 #include "core/include/fpdfapi/fpdf_module.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 int bb = FXSYS_GetBValue(m_BackColor); | 149 int bb = FXSYS_GetBValue(m_BackColor); |
| 150 r = (br - fr) * gray / 255 + fr; | 150 r = (br - fr) * gray / 255 + fr; |
| 151 g = (bg - fg) * gray / 255 + fg; | 151 g = (bg - fg) * gray / 255 + fg; |
| 152 b = (bb - fb) * gray / 255 + fb; | 152 b = (bb - fb) * gray / 255 + fb; |
| 153 return ArgbEncode(a, r, g, b); | 153 return ArgbEncode(a, r, g, b); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // static | 156 // static |
| 157 int CPDF_RenderStatus::s_CurrentRecursionDepth = 0; | 157 int CPDF_RenderStatus::s_CurrentRecursionDepth = 0; |
| 158 | 158 |
| 159 CPDF_RenderStatus::CPDF_RenderStatus() { | 159 CPDF_RenderStatus::CPDF_RenderStatus() |
| 160 m_pContext = NULL; | 160 : m_pFormResource(nullptr), |
| 161 m_bStopped = FALSE; | 161 m_pPageResource(nullptr), |
| 162 m_pDevice = NULL; | 162 m_pContext(nullptr), |
| 163 m_pCurObj = NULL; | 163 m_bStopped(FALSE), |
| 164 m_pStopObj = NULL; | 164 m_pDevice(nullptr), |
| 165 m_HalftoneLimit = 0; | 165 m_pCurObj(nullptr), |
| 166 m_pObjectRenderer = NULL; | 166 m_pStopObj(nullptr), |
| 167 m_bPrint = FALSE; | 167 m_HalftoneLimit(0), |
| 168 m_Transparency = 0; | 168 m_bPrint(FALSE), |
| 169 m_DitherBits = 0; | 169 m_Transparency(0), |
| 170 m_bDropObjects = FALSE; | 170 m_DitherBits(0), |
| 171 m_bStdCS = FALSE; | 171 m_bDropObjects(FALSE), |
| 172 m_GroupFamily = 0; | 172 m_bStdCS(FALSE), |
| 173 m_bLoadMask = FALSE; | 173 m_GroupFamily(0), |
| 174 m_pType3Char = NULL; | 174 m_bLoadMask(FALSE), |
| 175 m_T3FillColor = 0; | 175 m_pType3Char(nullptr), |
| 176 m_pFormResource = NULL; | 176 m_T3FillColor(0), |
| 177 m_pPageResource = NULL; | 177 m_curBlend(FXDIB_BLEND_NORMAL) {} |
| 178 m_curBlend = FXDIB_BLEND_NORMAL; | |
| 179 } | |
| 180 | 178 |
| 181 CPDF_RenderStatus::~CPDF_RenderStatus() { | 179 CPDF_RenderStatus::~CPDF_RenderStatus() { |
| 182 delete m_pObjectRenderer; | |
| 183 } | 180 } |
| 184 | 181 |
| 185 FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, | 182 FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, |
| 186 CFX_RenderDevice* pDevice, | 183 CFX_RenderDevice* pDevice, |
| 187 const CFX_AffineMatrix* pDeviceMatrix, | 184 const CFX_AffineMatrix* pDeviceMatrix, |
| 188 const CPDF_PageObject* pStopObj, | 185 const CPDF_PageObject* pStopObj, |
| 189 const CPDF_RenderStatus* pParentState, | 186 const CPDF_RenderStatus* pParentState, |
| 190 const CPDF_GraphicStates* pInitialStates, | 187 const CPDF_GraphicStates* pInitialStates, |
| 191 const CPDF_RenderOptions* pOptions, | 188 const CPDF_RenderOptions* pOptions, |
| 192 int transparency, | 189 int transparency, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 229 } |
| 233 if (!pColorData || pColorData->m_StrokeColor.IsNull()) { | 230 if (!pColorData || pColorData->m_StrokeColor.IsNull()) { |
| 234 CPDF_ColorStateData* pData = m_InitialStates.m_ColorState.GetModify(); | 231 CPDF_ColorStateData* pData = m_InitialStates.m_ColorState.GetModify(); |
| 235 pData->m_StrokeRGB = pParentData->m_FillRGB; | 232 pData->m_StrokeRGB = pParentData->m_FillRGB; |
| 236 pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor); | 233 pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor); |
| 237 } | 234 } |
| 238 } | 235 } |
| 239 } else { | 236 } else { |
| 240 m_InitialStates.DefaultStates(); | 237 m_InitialStates.DefaultStates(); |
| 241 } | 238 } |
| 242 m_pObjectRenderer = NULL; | 239 m_pObjectRenderer.reset(); |
| 243 m_Transparency = transparency; | 240 m_Transparency = transparency; |
| 244 return TRUE; | 241 return TRUE; |
| 245 } | 242 } |
| 246 void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, | 243 void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, |
| 247 const CFX_AffineMatrix* pObj2Device) { | 244 const CFX_AffineMatrix* pObj2Device) { |
| 248 CFX_FloatRect clip_rect = m_pDevice->GetClipBox(); | 245 CFX_FloatRect clip_rect = m_pDevice->GetClipBox(); |
| 249 CFX_AffineMatrix device2object; | 246 CFX_AffineMatrix device2object; |
| 250 device2object.SetReverse(*pObj2Device); | 247 device2object.SetReverse(*pObj2Device); |
| 251 device2object.TransformRect(clip_rect); | 248 device2object.TransformRect(clip_rect); |
| 252 int index = 0; | 249 int index = 0; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { | 282 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { |
| 286 return; | 283 return; |
| 287 } | 284 } |
| 288 } | 285 } |
| 289 ProcessClipPath(pObj->m_ClipPath, pObj2Device); | 286 ProcessClipPath(pObj->m_ClipPath, pObj2Device); |
| 290 if (ProcessTransparency(pObj, pObj2Device)) { | 287 if (ProcessTransparency(pObj, pObj2Device)) { |
| 291 return; | 288 return; |
| 292 } | 289 } |
| 293 ProcessObjectNoClip(pObj, pObj2Device); | 290 ProcessObjectNoClip(pObj, pObj2Device); |
| 294 } | 291 } |
| 292 |
| 295 FX_BOOL CPDF_RenderStatus::ContinueSingleObject( | 293 FX_BOOL CPDF_RenderStatus::ContinueSingleObject( |
| 296 const CPDF_PageObject* pObj, | 294 const CPDF_PageObject* pObj, |
| 297 const CFX_AffineMatrix* pObj2Device, | 295 const CFX_AffineMatrix* pObj2Device, |
| 298 IFX_Pause* pPause) { | 296 IFX_Pause* pPause) { |
| 299 if (m_pObjectRenderer) { | 297 if (m_pObjectRenderer) { |
| 300 if (m_pObjectRenderer->Continue(pPause)) { | 298 if (m_pObjectRenderer->Continue(pPause)) |
| 301 return TRUE; | 299 return TRUE; |
| 302 } | 300 |
| 303 if (!m_pObjectRenderer->m_Result) { | 301 if (!m_pObjectRenderer->m_Result) |
| 304 DrawObjWithBackground(pObj, pObj2Device); | 302 DrawObjWithBackground(pObj, pObj2Device); |
| 305 } | 303 m_pObjectRenderer.reset(); |
| 306 delete m_pObjectRenderer; | |
| 307 m_pObjectRenderer = NULL; | |
| 308 return FALSE; | 304 return FALSE; |
| 309 } | 305 } |
| 306 |
| 310 m_pCurObj = pObj; | 307 m_pCurObj = pObj; |
| 311 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull()) | 308 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull() && |
| 312 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { | 309 !m_Options.m_pOCContext->CheckObjectVisible(pObj)) { |
| 313 return FALSE; | |
| 314 } | |
| 315 ProcessClipPath(pObj->m_ClipPath, pObj2Device); | |
| 316 if (ProcessTransparency(pObj, pObj2Device)) { | |
| 317 return FALSE; | 310 return FALSE; |
| 318 } | 311 } |
| 312 |
| 313 ProcessClipPath(pObj->m_ClipPath, pObj2Device); |
| 314 if (ProcessTransparency(pObj, pObj2Device)) |
| 315 return FALSE; |
| 316 |
| 319 if (pObj->m_Type == PDFPAGE_IMAGE) { | 317 if (pObj->m_Type == PDFPAGE_IMAGE) { |
| 320 m_pObjectRenderer = IPDF_ObjectRenderer::Create(pObj->m_Type); | 318 m_pObjectRenderer.reset(IPDF_ObjectRenderer::Create(pObj->m_Type)); |
| 321 if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) { | 319 if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) { |
| 322 if (!m_pObjectRenderer->m_Result) { | 320 if (!m_pObjectRenderer->m_Result) |
| 323 DrawObjWithBackground(pObj, pObj2Device); | 321 DrawObjWithBackground(pObj, pObj2Device); |
| 324 } | 322 m_pObjectRenderer.reset(); |
| 325 delete m_pObjectRenderer; | |
| 326 m_pObjectRenderer = NULL; | |
| 327 return FALSE; | 323 return FALSE; |
| 328 } | 324 } |
| 329 return ContinueSingleObject(pObj, pObj2Device, pPause); | 325 return ContinueSingleObject(pObj, pObj2Device, pPause); |
| 330 } | 326 } |
| 327 |
| 331 ProcessObjectNoClip(pObj, pObj2Device); | 328 ProcessObjectNoClip(pObj, pObj2Device); |
| 332 return FALSE; | 329 return FALSE; |
| 333 } | 330 } |
| 331 |
| 334 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) { | 332 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) { |
| 335 if (type != PDFPAGE_IMAGE) { | 333 if (type != PDFPAGE_IMAGE) { |
| 336 return NULL; | 334 return NULL; |
| 337 } | 335 } |
| 338 return new CPDF_ImageRenderer; | 336 return new CPDF_ImageRenderer; |
| 339 } | 337 } |
| 340 FX_BOOL CPDF_RenderStatus::GetObjectClippedRect( | 338 FX_BOOL CPDF_RenderStatus::GetObjectClippedRect( |
| 341 const CPDF_PageObject* pObj, | 339 const CPDF_PageObject* pObj, |
| 342 const CFX_AffineMatrix* pObj2Device, | 340 const CFX_AffineMatrix* pObj2Device, |
| 343 FX_BOOL bLogical, | 341 FX_BOOL bLogical, |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 } | 618 } |
| 621 } | 619 } |
| 622 } else { | 620 } else { |
| 623 alpha = 255; | 621 alpha = 255; |
| 624 } | 622 } |
| 625 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); | 623 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); |
| 626 } | 624 } |
| 627 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, | 625 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, |
| 628 const CFX_AffineMatrix* pObj2Device) { | 626 const CFX_AffineMatrix* pObj2Device) { |
| 629 if (ClipPath.IsNull()) { | 627 if (ClipPath.IsNull()) { |
| 630 if (m_LastClipPath.IsNull()) { | 628 if (!m_LastClipPath.IsNull()) { |
| 631 return; | 629 m_pDevice->RestoreState(TRUE); |
| 630 m_LastClipPath.SetNull(); |
| 632 } | 631 } |
| 633 m_pDevice->RestoreState(TRUE); | |
| 634 m_LastClipPath.SetNull(); | |
| 635 return; | 632 return; |
| 636 } | 633 } |
| 637 if (m_LastClipPath == ClipPath) { | 634 if (m_LastClipPath == ClipPath) |
| 638 return; | 635 return; |
| 639 } | 636 |
| 640 m_LastClipPath = ClipPath; | 637 m_LastClipPath = ClipPath; |
| 641 m_pDevice->RestoreState(TRUE); | 638 m_pDevice->RestoreState(TRUE); |
| 642 int nClipPath = ClipPath.GetPathCount(); | 639 int nClipPath = ClipPath.GetPathCount(); |
| 643 int i; | 640 for (int i = 0; i < nClipPath; ++i) { |
| 644 for (i = 0; i < nClipPath; i++) { | |
| 645 const CFX_PathData* pPathData = ClipPath.GetPath(i); | 641 const CFX_PathData* pPathData = ClipPath.GetPath(i); |
| 646 if (pPathData == NULL) { | 642 if (!pPathData) |
| 647 continue; | 643 continue; |
| 648 } | 644 |
| 649 if (pPathData->GetPointCount() == 0) { | 645 if (pPathData->GetPointCount() == 0) { |
| 650 CFX_PathData EmptyPath; | 646 CFX_PathData EmptyPath; |
| 651 EmptyPath.AppendRect(-1, -1, 0, 0); | 647 EmptyPath.AppendRect(-1, -1, 0, 0); |
| 652 int fill_mode = FXFILL_WINDING; | 648 int fill_mode = FXFILL_WINDING; |
| 653 m_pDevice->SetClip_PathFill(&EmptyPath, NULL, fill_mode); | 649 m_pDevice->SetClip_PathFill(&EmptyPath, nullptr, fill_mode); |
| 654 } else { | 650 } else { |
| 655 int ClipType = ClipPath.GetClipType(i); | 651 int ClipType = ClipPath.GetClipType(i); |
| 656 m_pDevice->SetClip_PathFill(pPathData, pObj2Device, ClipType); | 652 m_pDevice->SetClip_PathFill(pPathData, pObj2Device, ClipType); |
| 657 } | 653 } |
| 658 } | 654 } |
| 659 int textcount = ClipPath.GetTextCount(); | 655 int textcount = ClipPath.GetTextCount(); |
| 660 if (textcount == 0) { | 656 if (textcount == 0) |
| 661 return; | 657 return; |
| 662 } | 658 |
| 663 if (m_pDevice->GetDeviceClass() == FXDC_DISPLAY && | 659 if (m_pDevice->GetDeviceClass() == FXDC_DISPLAY && |
| 664 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) { | 660 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) { |
| 665 return; | 661 return; |
| 666 } | 662 } |
| 667 CFX_PathData* pTextClippingPath = NULL; | 663 |
| 668 for (i = 0; i < textcount; i++) { | 664 nonstd::unique_ptr<CFX_PathData> pTextClippingPath; |
| 665 for (int i = 0; i < textcount; ++i) { |
| 669 CPDF_TextObject* pText = ClipPath.GetText(i); | 666 CPDF_TextObject* pText = ClipPath.GetText(i); |
| 670 if (pText == NULL) { | 667 if (pText) { |
| 671 if (pTextClippingPath) { | 668 if (!pTextClippingPath) |
| 672 int fill_mode = FXFILL_WINDING; | 669 pTextClippingPath.reset(new CFX_PathData); |
| 673 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) { | 670 ProcessText(pText, pObj2Device, pTextClippingPath.get()); |
| 674 fill_mode |= FXFILL_NOPATHSMOOTH; | 671 continue; |
| 675 } | |
| 676 m_pDevice->SetClip_PathFill(pTextClippingPath, NULL, fill_mode); | |
| 677 delete pTextClippingPath; | |
| 678 pTextClippingPath = NULL; | |
| 679 } | |
| 680 } else { | |
| 681 if (pTextClippingPath == NULL) { | |
| 682 pTextClippingPath = new CFX_PathData; | |
| 683 } | |
| 684 ProcessText(pText, pObj2Device, pTextClippingPath); | |
| 685 } | 672 } |
| 673 |
| 674 if (!pTextClippingPath) |
| 675 continue; |
| 676 |
| 677 int fill_mode = FXFILL_WINDING; |
| 678 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) |
| 679 fill_mode |= FXFILL_NOPATHSMOOTH; |
| 680 m_pDevice->SetClip_PathFill(pTextClippingPath.get(), nullptr, fill_mode); |
| 681 pTextClippingPath.reset(); |
| 686 } | 682 } |
| 687 delete pTextClippingPath; | |
| 688 } | 683 } |
| 684 |
| 689 void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, | 685 void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, |
| 690 const CFX_AffineMatrix* pObj2Device) { | 686 const CFX_AffineMatrix* pObj2Device) { |
| 691 if (ClipPath.IsNull()) { | 687 if (ClipPath.IsNull()) { |
| 692 return; | 688 return; |
| 693 } | 689 } |
| 694 int fill_mode = 0; | 690 int fill_mode = 0; |
| 695 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { | 691 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { |
| 696 fill_mode |= FXFILL_NOPATHSMOOTH; | 692 fill_mode |= FXFILL_NOPATHSMOOTH; |
| 697 } | 693 } |
| 698 int nClipPath = ClipPath.GetPathCount(); | 694 int nClipPath = ClipPath.GetPathCount(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 rect.Intersect(m_pDevice->GetClipBox()); | 818 rect.Intersect(m_pDevice->GetClipBox()); |
| 823 if (rect.IsEmpty()) { | 819 if (rect.IsEmpty()) { |
| 824 return TRUE; | 820 return TRUE; |
| 825 } | 821 } |
| 826 CFX_Matrix deviceCTM = m_pDevice->GetCTM(); | 822 CFX_Matrix deviceCTM = m_pDevice->GetCTM(); |
| 827 FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a); | 823 FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a); |
| 828 FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); | 824 FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); |
| 829 int width = FXSYS_round((FX_FLOAT)rect.Width() * scaleX); | 825 int width = FXSYS_round((FX_FLOAT)rect.Width() * scaleX); |
| 830 int height = FXSYS_round((FX_FLOAT)rect.Height() * scaleY); | 826 int height = FXSYS_round((FX_FLOAT)rect.Height() * scaleY); |
| 831 CFX_FxgeDevice bitmap_device; | 827 CFX_FxgeDevice bitmap_device; |
| 832 CFX_DIBitmap* oriDevice = NULL; | 828 nonstd::unique_ptr<CFX_DIBitmap> oriDevice; |
| 833 if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { | 829 if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { |
| 834 oriDevice = new CFX_DIBitmap; | 830 oriDevice.reset(new CFX_DIBitmap); |
| 835 if (!m_pDevice->CreateCompatibleBitmap(oriDevice, width, height)) { | 831 if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height)) |
| 836 return TRUE; | 832 return TRUE; |
| 837 } | 833 |
| 838 m_pDevice->GetDIBits(oriDevice, rect.left, rect.top); | 834 m_pDevice->GetDIBits(oriDevice.get(), rect.left, rect.top); |
| 839 } | 835 } |
| 840 if (!bitmap_device.Create(width, height, FXDIB_Argb, 0, oriDevice)) { | 836 if (!bitmap_device.Create(width, height, FXDIB_Argb, 0, oriDevice.get())) |
| 841 return TRUE; | 837 return TRUE; |
| 842 } | 838 |
| 843 CFX_DIBitmap* bitmap = bitmap_device.GetBitmap(); | 839 CFX_DIBitmap* bitmap = bitmap_device.GetBitmap(); |
| 844 bitmap->Clear(0); | 840 bitmap->Clear(0); |
| 845 CFX_AffineMatrix new_matrix = *pObj2Device; | 841 CFX_AffineMatrix new_matrix = *pObj2Device; |
| 846 new_matrix.TranslateI(-rect.left, -rect.top); | 842 new_matrix.TranslateI(-rect.left, -rect.top); |
| 847 new_matrix.Scale(scaleX, scaleY); | 843 new_matrix.Scale(scaleX, scaleY); |
| 848 CFX_DIBitmap* pTextMask = NULL; | 844 nonstd::unique_ptr<CFX_DIBitmap> pTextMask; |
| 849 if (bTextClip) { | 845 if (bTextClip) { |
| 850 pTextMask = new CFX_DIBitmap; | 846 pTextMask.reset(new CFX_DIBitmap); |
| 851 if (!pTextMask->Create(width, height, FXDIB_8bppMask)) { | 847 if (!pTextMask->Create(width, height, FXDIB_8bppMask)) |
| 852 delete pTextMask; | |
| 853 return TRUE; | 848 return TRUE; |
| 854 } | 849 |
| 855 pTextMask->Clear(0); | 850 pTextMask->Clear(0); |
| 856 CFX_FxgeDevice text_device; | 851 CFX_FxgeDevice text_device; |
| 857 text_device.Attach(pTextMask); | 852 text_device.Attach(pTextMask.get()); |
| 858 for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { | 853 for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { |
| 859 CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); | 854 CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); |
| 860 if (textobj == NULL) { | 855 if (textobj == NULL) { |
| 861 break; | 856 break; |
| 862 } | 857 } |
| 863 CFX_AffineMatrix text_matrix; | 858 CFX_AffineMatrix text_matrix; |
| 864 textobj->GetTextMatrix(&text_matrix); | 859 textobj->GetTextMatrix(&text_matrix); |
| 865 CPDF_TextRenderer::DrawTextPath( | 860 CPDF_TextRenderer::DrawTextPath( |
| 866 &text_device, textobj->m_nChars, textobj->m_pCharCodes, | 861 &text_device, textobj->m_nChars, textobj->m_pCharCodes, |
| 867 textobj->m_pCharPos, textobj->m_TextState.GetFont(), | 862 textobj->m_pCharPos, textobj->m_TextState.GetFont(), |
| 868 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix, | 863 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix, |
| 869 textobj->m_GraphState, (FX_ARGB)-1, 0, NULL); | 864 textobj->m_GraphState, (FX_ARGB)-1, 0, NULL); |
| 870 } | 865 } |
| 871 } | 866 } |
| 872 CPDF_RenderStatus bitmap_render; | 867 CPDF_RenderStatus bitmap_render; |
| 873 bitmap_render.Initialize(m_pContext, &bitmap_device, NULL, m_pStopObj, NULL, | 868 bitmap_render.Initialize(m_pContext, &bitmap_device, NULL, m_pStopObj, NULL, |
| 874 NULL, &m_Options, 0, m_bDropObjects, pFormResource, | 869 NULL, &m_Options, 0, m_bDropObjects, pFormResource, |
| 875 TRUE); | 870 TRUE); |
| 876 bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); | 871 bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); |
| 877 m_bStopped = bitmap_render.m_bStopped; | 872 m_bStopped = bitmap_render.m_bStopped; |
| 878 if (pSMaskDict) { | 873 if (pSMaskDict) { |
| 879 CFX_AffineMatrix smask_matrix; | 874 CFX_AffineMatrix smask_matrix; |
| 880 FXSYS_memcpy(&smask_matrix, pGeneralState->m_SMaskMatrix, | 875 FXSYS_memcpy(&smask_matrix, pGeneralState->m_SMaskMatrix, |
| 881 sizeof smask_matrix); | 876 sizeof smask_matrix); |
| 882 smask_matrix.Concat(*pObj2Device); | 877 smask_matrix.Concat(*pObj2Device); |
| 883 CFX_DIBSource* pSMaskSource = LoadSMask(pSMaskDict, &rect, &smask_matrix); | 878 nonstd::unique_ptr<CFX_DIBSource> pSMaskSource( |
| 884 if (pSMaskSource) { | 879 LoadSMask(pSMaskDict, &rect, &smask_matrix)); |
| 885 bitmap->MultiplyAlpha(pSMaskSource); | 880 if (pSMaskSource) |
| 886 delete pSMaskSource; | 881 bitmap->MultiplyAlpha(pSMaskSource.get()); |
| 887 } | |
| 888 } | 882 } |
| 889 if (pTextMask) { | 883 if (pTextMask) { |
| 890 bitmap->MultiplyAlpha(pTextMask); | 884 bitmap->MultiplyAlpha(pTextMask.get()); |
| 891 delete pTextMask; | 885 pTextMask.reset(); |
| 892 pTextMask = NULL; | |
| 893 } | 886 } |
| 894 if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) { | 887 if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) { |
| 895 bitmap->MultiplyAlpha((int32_t)(group_alpha * 255)); | 888 bitmap->MultiplyAlpha((int32_t)(group_alpha * 255)); |
| 896 } | 889 } |
| 897 Transparency = m_Transparency; | 890 Transparency = m_Transparency; |
| 898 if (pPageObj->m_Type == PDFPAGE_FORM) { | 891 if (pPageObj->m_Type == PDFPAGE_FORM) { |
| 899 Transparency |= PDFTRANS_GROUP; | 892 Transparency |= PDFTRANS_GROUP; |
| 900 } | 893 } |
| 901 CompositeDIBitmap(bitmap, rect.left, rect.top, 0, 255, blend_type, | 894 CompositeDIBitmap(bitmap, rect.left, rect.top, 0, 255, blend_type, |
| 902 Transparency); | 895 Transparency); |
| 903 delete oriDevice; | |
| 904 return TRUE; | 896 return TRUE; |
| 905 } | 897 } |
| 898 |
| 906 CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, | 899 CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, |
| 907 const FX_RECT& rect, | 900 const FX_RECT& rect, |
| 908 int& left, | 901 int& left, |
| 909 int& top, | 902 int& top, |
| 910 FX_BOOL bBackAlphaRequired) { | 903 FX_BOOL bBackAlphaRequired) { |
| 911 FX_RECT bbox = rect; | 904 FX_RECT bbox = rect; |
| 912 bbox.Intersect(m_pDevice->GetClipBox()); | 905 bbox.Intersect(m_pDevice->GetClipBox()); |
| 913 left = bbox.left; | 906 left = bbox.left; |
| 914 top = bbox.top; | 907 top = bbox.top; |
| 915 CFX_Matrix deviceCTM = m_pDevice->GetCTM(); | 908 CFX_Matrix deviceCTM = m_pDevice->GetCTM(); |
| 916 FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a); | 909 FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a); |
| 917 FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); | 910 FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); |
| 918 int width = FXSYS_round(bbox.Width() * scaleX); | 911 int width = FXSYS_round(bbox.Width() * scaleX); |
| 919 int height = FXSYS_round(bbox.Height() * scaleY); | 912 int height = FXSYS_round(bbox.Height() * scaleY); |
| 920 CFX_DIBitmap* pBackdrop = new CFX_DIBitmap; | 913 nonstd::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap); |
| 921 if (bBackAlphaRequired && !m_bDropObjects) { | 914 if (bBackAlphaRequired && !m_bDropObjects) |
| 922 pBackdrop->Create(width, height, FXDIB_Argb); | 915 pBackdrop->Create(width, height, FXDIB_Argb); |
| 923 } else { | 916 else |
| 924 m_pDevice->CreateCompatibleBitmap(pBackdrop, width, height); | 917 m_pDevice->CreateCompatibleBitmap(pBackdrop.get(), width, height); |
| 918 |
| 919 if (!pBackdrop->GetBuffer()) |
| 920 return nullptr; |
| 921 |
| 922 FX_BOOL bNeedDraw; |
| 923 if (pBackdrop->HasAlpha()) |
| 924 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT); |
| 925 else |
| 926 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS); |
| 927 |
| 928 if (!bNeedDraw) { |
| 929 m_pDevice->GetDIBits(pBackdrop.get(), left, top); |
| 930 return pBackdrop.release(); |
| 925 } | 931 } |
| 926 if (pBackdrop->GetBuffer() == NULL) { | 932 |
| 927 delete pBackdrop; | |
| 928 return NULL; | |
| 929 } | |
| 930 FX_BOOL bNeedDraw; | |
| 931 if (pBackdrop->HasAlpha()) { | |
| 932 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT); | |
| 933 } else { | |
| 934 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS); | |
| 935 } | |
| 936 if (!bNeedDraw) { | |
| 937 m_pDevice->GetDIBits(pBackdrop, left, top); | |
| 938 return pBackdrop; | |
| 939 } | |
| 940 CFX_AffineMatrix FinalMatrix = m_DeviceMatrix; | 933 CFX_AffineMatrix FinalMatrix = m_DeviceMatrix; |
| 941 FinalMatrix.TranslateI(-left, -top); | 934 FinalMatrix.TranslateI(-left, -top); |
| 942 FinalMatrix.Scale(scaleX, scaleY); | 935 FinalMatrix.Scale(scaleX, scaleY); |
| 943 pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff); | 936 pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff); |
| 944 CFX_FxgeDevice device; | 937 CFX_FxgeDevice device; |
| 945 device.Attach(pBackdrop); | 938 device.Attach(pBackdrop.get()); |
| 946 m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix); | 939 m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix); |
| 947 return pBackdrop; | 940 return pBackdrop.release(); |
| 948 } | 941 } |
| 942 |
| 949 void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, | 943 void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, |
| 950 const CPDF_PageObject* pObj, | 944 const CPDF_PageObject* pObj, |
| 951 const CPDF_RenderOptions* pOptions, | 945 const CPDF_RenderOptions* pOptions, |
| 952 CFX_AffineMatrix* pFinalMatrix) { | 946 CFX_AffineMatrix* pFinalMatrix) { |
| 953 CFX_FxgeDevice device; | 947 CFX_FxgeDevice device; |
| 954 device.Attach(pBuffer); | 948 device.Attach(pBuffer); |
| 955 | 949 |
| 956 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); | 950 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); |
| 957 device.FillRect(&rect, 0xffffffff); | 951 device.FillRect(&rect, 0xffffffff); |
| 958 Render(&device, pObj, pOptions, pFinalMatrix); | 952 Render(&device, pObj, pOptions, pFinalMatrix); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { | 1210 CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { |
| 1217 if (!pObj) | 1211 if (!pObj) |
| 1218 return nullptr; | 1212 return nullptr; |
| 1219 | 1213 |
| 1220 auto it = m_TransferFuncMap.find(pObj); | 1214 auto it = m_TransferFuncMap.find(pObj); |
| 1221 if (it != m_TransferFuncMap.end()) { | 1215 if (it != m_TransferFuncMap.end()) { |
| 1222 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = it->second; | 1216 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = it->second; |
| 1223 return pTransferCounter->AddRef(); | 1217 return pTransferCounter->AddRef(); |
| 1224 } | 1218 } |
| 1225 | 1219 |
| 1226 CPDF_Function* pFuncs[3] = {nullptr, nullptr, nullptr}; | 1220 nonstd::unique_ptr<CPDF_Function> pFuncs[3]; |
| 1227 FX_BOOL bUniTransfer = TRUE; | 1221 FX_BOOL bUniTransfer = TRUE; |
| 1228 FX_BOOL bIdentity = TRUE; | 1222 FX_BOOL bIdentity = TRUE; |
| 1229 if (CPDF_Array* pArray = pObj->AsArray()) { | 1223 if (CPDF_Array* pArray = pObj->AsArray()) { |
| 1230 bUniTransfer = FALSE; | 1224 bUniTransfer = FALSE; |
| 1231 if (pArray->GetCount() < 3) | 1225 if (pArray->GetCount() < 3) |
| 1232 return nullptr; | 1226 return nullptr; |
| 1233 | 1227 |
| 1234 for (FX_DWORD i = 0; i < 3; ++i) { | 1228 for (FX_DWORD i = 0; i < 3; ++i) { |
| 1235 pFuncs[2 - i] = CPDF_Function::Load(pArray->GetElementValue(i)); | 1229 pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetElementValue(i))); |
| 1236 if (!pFuncs[2 - i]) { | 1230 if (!pFuncs[2 - i]) |
| 1237 return nullptr; | 1231 return nullptr; |
| 1238 } | |
| 1239 } | 1232 } |
| 1240 } else { | 1233 } else { |
| 1241 pFuncs[0] = CPDF_Function::Load(pObj); | 1234 pFuncs[0].reset(CPDF_Function::Load(pObj)); |
| 1242 if (!pFuncs[0]) { | 1235 if (!pFuncs[0]) |
| 1243 return nullptr; | 1236 return nullptr; |
| 1244 } | |
| 1245 } | 1237 } |
| 1246 CPDF_TransferFunc* pTransfer = new CPDF_TransferFunc; | 1238 CPDF_TransferFunc* pTransfer = new CPDF_TransferFunc(m_pPDFDoc); |
| 1247 pTransfer->m_pPDFDoc = m_pPDFDoc; | |
| 1248 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = | 1239 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = |
| 1249 new CPDF_CountedObject<CPDF_TransferFunc>(pTransfer); | 1240 new CPDF_CountedObject<CPDF_TransferFunc>(pTransfer); |
| 1250 m_TransferFuncMap[pObj] = pTransferCounter; | 1241 m_TransferFuncMap[pObj] = pTransferCounter; |
| 1251 static const int kMaxOutputs = 16; | 1242 static const int kMaxOutputs = 16; |
| 1252 FX_FLOAT output[kMaxOutputs]; | 1243 FX_FLOAT output[kMaxOutputs]; |
| 1253 FXSYS_memset(output, 0, sizeof(output)); | 1244 FXSYS_memset(output, 0, sizeof(output)); |
| 1254 FX_FLOAT input; | 1245 FX_FLOAT input; |
| 1255 int noutput; | 1246 int noutput; |
| 1256 for (int v = 0; v < 256; ++v) { | 1247 for (int v = 0; v < 256; ++v) { |
| 1257 input = (FX_FLOAT)v / 255.0f; | 1248 input = (FX_FLOAT)v / 255.0f; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1271 int o = FXSYS_round(output[0] * 255); | 1262 int o = FXSYS_round(output[0] * 255); |
| 1272 if (o != v) | 1263 if (o != v) |
| 1273 bIdentity = FALSE; | 1264 bIdentity = FALSE; |
| 1274 pTransfer->m_Samples[i * 256 + v] = o; | 1265 pTransfer->m_Samples[i * 256 + v] = o; |
| 1275 } else { | 1266 } else { |
| 1276 pTransfer->m_Samples[i * 256 + v] = v; | 1267 pTransfer->m_Samples[i * 256 + v] = v; |
| 1277 } | 1268 } |
| 1278 } | 1269 } |
| 1279 } | 1270 } |
| 1280 } | 1271 } |
| 1281 for (int i = 0; i < 3; ++i) | |
| 1282 delete pFuncs[i]; | |
| 1283 | 1272 |
| 1284 pTransfer->m_bIdentity = bIdentity; | 1273 pTransfer->m_bIdentity = bIdentity; |
| 1285 return pTransferCounter->AddRef(); | 1274 return pTransferCounter->AddRef(); |
| 1286 } | 1275 } |
| 1287 | 1276 |
| 1288 void CPDF_DocRenderData::ReleaseTransferFunc(CPDF_Object* pObj) { | 1277 void CPDF_DocRenderData::ReleaseTransferFunc(CPDF_Object* pObj) { |
| 1289 auto it = m_TransferFuncMap.find(pObj); | 1278 auto it = m_TransferFuncMap.find(pObj); |
| 1290 if (it != m_TransferFuncMap.end()) | 1279 if (it != m_TransferFuncMap.end()) |
| 1291 it->second->RemoveRef(); | 1280 it->second->RemoveRef(); |
| 1292 } | 1281 } |
| 1293 CPDF_RenderConfig::CPDF_RenderConfig() { | 1282 CPDF_RenderConfig::CPDF_RenderConfig() { |
| 1294 m_HalftoneLimit = 0; | 1283 m_HalftoneLimit = 0; |
| 1295 m_RenderStepLimit = 100; | 1284 m_RenderStepLimit = 100; |
| 1296 } | 1285 } |
| 1297 CPDF_RenderConfig::~CPDF_RenderConfig() {} | 1286 CPDF_RenderConfig::~CPDF_RenderConfig() {} |
| 1298 CPDF_DeviceBuffer::CPDF_DeviceBuffer() { | 1287 |
| 1299 m_pBitmap = NULL; | 1288 CPDF_DeviceBuffer::CPDF_DeviceBuffer() |
| 1300 m_pDevice = NULL; | 1289 : m_pDevice(nullptr), m_pContext(nullptr), m_pObject(nullptr) {} |
| 1301 m_pContext = NULL; | 1290 |
| 1302 m_pObject = NULL; | 1291 CPDF_DeviceBuffer::~CPDF_DeviceBuffer() { |
| 1303 } | 1292 } |
| 1304 CPDF_DeviceBuffer::~CPDF_DeviceBuffer() { | 1293 |
| 1305 delete m_pBitmap; | |
| 1306 } | |
| 1307 FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, | 1294 FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, |
| 1308 CFX_RenderDevice* pDevice, | 1295 CFX_RenderDevice* pDevice, |
| 1309 FX_RECT* pRect, | 1296 FX_RECT* pRect, |
| 1310 const CPDF_PageObject* pObj, | 1297 const CPDF_PageObject* pObj, |
| 1311 int max_dpi) { | 1298 int max_dpi) { |
| 1312 m_pDevice = pDevice; | 1299 m_pDevice = pDevice; |
| 1313 m_pContext = pContext; | 1300 m_pContext = pContext; |
| 1314 m_Rect = *pRect; | 1301 m_Rect = *pRect; |
| 1315 m_pObject = pObj; | 1302 m_pObject = pObj; |
| 1316 m_Matrix.TranslateI(-pRect->left, -pRect->top); | 1303 m_Matrix.TranslateI(-pRect->left, -pRect->top); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1330 } | 1317 } |
| 1331 } | 1318 } |
| 1332 #endif | 1319 #endif |
| 1333 CFX_Matrix ctm = m_pDevice->GetCTM(); | 1320 CFX_Matrix ctm = m_pDevice->GetCTM(); |
| 1334 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); | 1321 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); |
| 1335 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); | 1322 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); |
| 1336 m_Matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); | 1323 m_Matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); |
| 1337 CFX_FloatRect rect(*pRect); | 1324 CFX_FloatRect rect(*pRect); |
| 1338 m_Matrix.TransformRect(rect); | 1325 m_Matrix.TransformRect(rect); |
| 1339 FX_RECT bitmap_rect = rect.GetOutterRect(); | 1326 FX_RECT bitmap_rect = rect.GetOutterRect(); |
| 1340 m_pBitmap = new CFX_DIBitmap; | 1327 m_pBitmap.reset(new CFX_DIBitmap); |
| 1341 m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb); | 1328 m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb); |
| 1342 return TRUE; | 1329 return TRUE; |
| 1343 } | 1330 } |
| 1344 void CPDF_DeviceBuffer::OutputToDevice() { | 1331 void CPDF_DeviceBuffer::OutputToDevice() { |
| 1345 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { | 1332 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { |
| 1346 if (m_Matrix.a == 1.0f && m_Matrix.d == 1.0f) { | 1333 if (m_Matrix.a == 1.0f && m_Matrix.d == 1.0f) { |
| 1347 m_pDevice->SetDIBits(m_pBitmap, m_Rect.left, m_Rect.top); | 1334 m_pDevice->SetDIBits(m_pBitmap.get(), m_Rect.left, m_Rect.top); |
| 1348 } else { | 1335 } else { |
| 1349 m_pDevice->StretchDIBits(m_pBitmap, m_Rect.left, m_Rect.top, | 1336 m_pDevice->StretchDIBits(m_pBitmap.get(), m_Rect.left, m_Rect.top, |
| 1350 m_Rect.Width(), m_Rect.Height()); | 1337 m_Rect.Width(), m_Rect.Height()); |
| 1351 } | 1338 } |
| 1352 } else { | 1339 } else { |
| 1353 CFX_DIBitmap buffer; | 1340 CFX_DIBitmap buffer; |
| 1354 m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(), | 1341 m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(), |
| 1355 m_pBitmap->GetHeight()); | 1342 m_pBitmap->GetHeight()); |
| 1356 m_pContext->GetBackground(&buffer, m_pObject, NULL, &m_Matrix); | 1343 m_pContext->GetBackground(&buffer, m_pObject, NULL, &m_Matrix); |
| 1357 buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(), | 1344 buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(), |
| 1358 m_pBitmap, 0, 0); | 1345 m_pBitmap.get(), 0, 0); |
| 1359 m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(), | 1346 m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(), |
| 1360 m_Rect.Height()); | 1347 m_Rect.Height()); |
| 1361 } | 1348 } |
| 1362 } | 1349 } |
| 1363 CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer() { | 1350 |
| 1364 m_pBitmapDevice = NULL; | 1351 CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer() {} |
| 1365 } | 1352 |
| 1366 CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() { | 1353 CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() {} |
| 1367 delete m_pBitmapDevice; | 1354 |
| 1368 } | |
| 1369 #define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024) | 1355 #define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024) |
| 1370 FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, | 1356 FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, |
| 1371 CFX_RenderDevice* pDevice, | 1357 CFX_RenderDevice* pDevice, |
| 1372 FX_RECT* pRect, | 1358 FX_RECT* pRect, |
| 1373 const CPDF_PageObject* pObj, | 1359 const CPDF_PageObject* pObj, |
| 1374 const CPDF_RenderOptions* pOptions, | 1360 const CPDF_RenderOptions* pOptions, |
| 1375 int max_dpi) { | 1361 int max_dpi) { |
| 1376 FXSYS_assert(pRect != NULL); | 1362 FXSYS_assert(pRect != NULL); |
| 1377 m_pDevice = pDevice; | 1363 m_pDevice = pDevice; |
| 1378 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { | 1364 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1389 pDevice->GetDeviceCaps(FXDC_PIXEL_WIDTH) * 254 / (horz_size * 10); | 1375 pDevice->GetDeviceCaps(FXDC_PIXEL_WIDTH) * 254 / (horz_size * 10); |
| 1390 int dpiv = | 1376 int dpiv = |
| 1391 pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10); | 1377 pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10); |
| 1392 if (dpih > max_dpi) { | 1378 if (dpih > max_dpi) { |
| 1393 m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f); | 1379 m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f); |
| 1394 } | 1380 } |
| 1395 if (dpiv > max_dpi) { | 1381 if (dpiv > max_dpi) { |
| 1396 m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); | 1382 m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); |
| 1397 } | 1383 } |
| 1398 } | 1384 } |
| 1399 m_pBitmapDevice = new CFX_FxgeDevice; | 1385 m_pBitmapDevice.reset(new CFX_FxgeDevice); |
| 1400 FXDIB_Format dibFormat = FXDIB_Rgb; | 1386 FXDIB_Format dibFormat = FXDIB_Rgb; |
| 1401 int32_t bpp = 24; | 1387 int32_t bpp = 24; |
| 1402 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) { | 1388 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) { |
| 1403 dibFormat = FXDIB_Argb; | 1389 dibFormat = FXDIB_Argb; |
| 1404 bpp = 32; | 1390 bpp = 32; |
| 1405 } | 1391 } |
| 1406 CFX_FloatRect rect; | 1392 CFX_FloatRect rect; |
| 1407 int32_t iWidth, iHeight, iPitch; | 1393 int32_t iWidth, iHeight, iPitch; |
| 1408 while (1) { | 1394 while (1) { |
| 1409 rect = *pRect; | 1395 rect = *pRect; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1440 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) { | 1426 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) { |
| 1441 CPDF_Dictionary* pOCG = | 1427 CPDF_Dictionary* pOCG = |
| 1442 ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); | 1428 ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); |
| 1443 if (!CheckOCGVisible(pOCG)) { | 1429 if (!CheckOCGVisible(pOCG)) { |
| 1444 return FALSE; | 1430 return FALSE; |
| 1445 } | 1431 } |
| 1446 } | 1432 } |
| 1447 } | 1433 } |
| 1448 return TRUE; | 1434 return TRUE; |
| 1449 } | 1435 } |
| OLD | NEW |