OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/render/cpdf_imagerenderer.h" | 7 #include "core/fpdfapi/render/cpdf_imagerenderer.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "core/fpdfapi/parser/cpdf_document.h" | 21 #include "core/fpdfapi/parser/cpdf_document.h" |
22 #include "core/fpdfapi/render/cpdf_pagerendercache.h" | 22 #include "core/fpdfapi/render/cpdf_pagerendercache.h" |
23 #include "core/fpdfapi/render/cpdf_rendercontext.h" | 23 #include "core/fpdfapi/render/cpdf_rendercontext.h" |
24 #include "core/fpdfapi/render/cpdf_renderstatus.h" | 24 #include "core/fpdfapi/render/cpdf_renderstatus.h" |
25 #include "core/fpdfapi/render/cpdf_transferfunc.h" | 25 #include "core/fpdfapi/render/cpdf_transferfunc.h" |
26 #include "core/fpdfapi/render/render_int.h" | 26 #include "core/fpdfapi/render/render_int.h" |
27 #include "core/fpdfdoc/cpdf_occontext.h" | 27 #include "core/fpdfdoc/cpdf_occontext.h" |
28 #include "core/fxcrt/fx_safe_types.h" | 28 #include "core/fxcrt/fx_safe_types.h" |
29 #include "core/fxge/cfx_fxgedevice.h" | 29 #include "core/fxge/cfx_fxgedevice.h" |
30 #include "core/fxge/cfx_pathdata.h" | 30 #include "core/fxge/cfx_pathdata.h" |
| 31 #include "third_party/base/ptr_util.h" |
31 | 32 |
32 #ifdef _SKIA_SUPPORT_ | 33 #ifdef _SKIA_SUPPORT_ |
33 #include "core/fxge/skia/fx_skia_device.h" | 34 #include "core/fxge/skia/fx_skia_device.h" |
34 #endif | 35 #endif |
35 | 36 |
36 CPDF_ImageRenderer::CPDF_ImageRenderer() { | 37 CPDF_ImageRenderer::CPDF_ImageRenderer() { |
37 m_pRenderStatus = nullptr; | 38 m_pRenderStatus = nullptr; |
38 m_pImageObject = nullptr; | 39 m_pImageObject = nullptr; |
39 m_Result = true; | 40 m_Result = true; |
40 m_Status = 0; | 41 m_Status = 0; |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || | 431 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || |
431 (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { | 432 (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { |
432 if (NotDrawing()) { | 433 if (NotDrawing()) { |
433 m_Result = false; | 434 m_Result = false; |
434 return false; | 435 return false; |
435 } | 436 } |
436 | 437 |
437 FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); | 438 FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); |
438 clip_box.Intersect(image_rect); | 439 clip_box.Intersect(image_rect); |
439 m_Status = 2; | 440 m_Status = 2; |
440 m_pTransformer.reset(new CFX_ImageTransformer(m_pDIBSource, &m_ImageMatrix, | 441 m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>( |
441 m_Flags, &clip_box)); | 442 m_pDIBSource, &m_ImageMatrix, m_Flags, &clip_box); |
442 m_pTransformer->Start(); | 443 m_pTransformer->Start(); |
443 return true; | 444 return true; |
444 } | 445 } |
445 if (m_ImageMatrix.a < 0) | 446 if (m_ImageMatrix.a < 0) |
446 dest_width = -dest_width; | 447 dest_width = -dest_width; |
447 | 448 |
448 if (m_ImageMatrix.d > 0) | 449 if (m_ImageMatrix.d > 0) |
449 dest_height = -dest_height; | 450 dest_height = -dest_height; |
450 | 451 |
451 int dest_left = dest_width > 0 ? image_rect.left : image_rect.right; | 452 int dest_left = dest_width > 0 ? image_rect.left : image_rect.right; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 | 559 |
559 if (m_Status == 4) { | 560 if (m_Status == 4) { |
560 if (m_Loader.Continue(pPause)) | 561 if (m_Loader.Continue(pPause)) |
561 return true; | 562 return true; |
562 | 563 |
563 if (StartRenderDIBSource()) | 564 if (StartRenderDIBSource()) |
564 return Continue(pPause); | 565 return Continue(pPause); |
565 } | 566 } |
566 return false; | 567 return false; |
567 } | 568 } |
OLD | NEW |