| 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_renderstatus.h" | 7 #include "core/fpdfapi/render/cpdf_renderstatus.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 CPDF_RenderOptions options; | 891 CPDF_RenderOptions options; |
| 892 if (!pPattern->colored()) | 892 if (!pPattern->colored()) |
| 893 options.m_ColorMode = RENDER_COLOR_ALPHA; | 893 options.m_ColorMode = RENDER_COLOR_ALPHA; |
| 894 | 894 |
| 895 flags |= RENDER_FORCE_HALFTONE; | 895 flags |= RENDER_FORCE_HALFTONE; |
| 896 options.m_Flags = flags; | 896 options.m_Flags = flags; |
| 897 CPDF_RenderContext context(pDoc, pCache); | 897 CPDF_RenderContext context(pDoc, pCache); |
| 898 context.AppendLayer(pPattern->form(), &mtPattern2Bitmap); | 898 context.AppendLayer(pPattern->form(), &mtPattern2Bitmap); |
| 899 context.Render(&bitmap_device, &options, nullptr); | 899 context.Render(&bitmap_device, &options, nullptr); |
| 900 #if defined _SKIA_SUPPORT_PATHS_ | 900 #if defined _SKIA_SUPPORT_PATHS_ |
| 901 bitmap_device.Flush(); |
| 901 pBitmap->UnPreMultiply(); | 902 pBitmap->UnPreMultiply(); |
| 902 #endif | 903 #endif |
| 903 return pBitmap; | 904 return pBitmap; |
| 904 } | 905 } |
| 905 | 906 |
| 906 bool IsAvailableMatrix(const CFX_Matrix& matrix) { | 907 bool IsAvailableMatrix(const CFX_Matrix& matrix) { |
| 907 if (matrix.a == 0 || matrix.d == 0) | 908 if (matrix.a == 0 || matrix.d == 0) |
| 908 return matrix.b != 0 && matrix.c != 0; | 909 return matrix.b != 0 && matrix.c != 0; |
| 909 | 910 |
| 910 if (matrix.b == 0 || matrix.c == 0) | 911 if (matrix.b == 0 || matrix.c == 0) |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix, | 1547 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix, |
| 1547 textobj->m_GraphState.GetObject(), (FX_ARGB)-1, 0, nullptr, 0); | 1548 textobj->m_GraphState.GetObject(), (FX_ARGB)-1, 0, nullptr, 0); |
| 1548 } | 1549 } |
| 1549 } | 1550 } |
| 1550 CPDF_RenderStatus bitmap_render; | 1551 CPDF_RenderStatus bitmap_render; |
| 1551 bitmap_render.Initialize(m_pContext, &bitmap_device, nullptr, m_pStopObj, | 1552 bitmap_render.Initialize(m_pContext, &bitmap_device, nullptr, m_pStopObj, |
| 1552 nullptr, nullptr, &m_Options, 0, m_bDropObjects, | 1553 nullptr, nullptr, &m_Options, 0, m_bDropObjects, |
| 1553 pFormResource, true); | 1554 pFormResource, true); |
| 1554 bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); | 1555 bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); |
| 1555 #if defined _SKIA_SUPPORT_PATHS_ | 1556 #if defined _SKIA_SUPPORT_PATHS_ |
| 1557 bitmap_device.Flush(); |
| 1556 bitmap->UnPreMultiply(); | 1558 bitmap->UnPreMultiply(); |
| 1557 #endif | 1559 #endif |
| 1558 m_bStopped = bitmap_render.m_bStopped; | 1560 m_bStopped = bitmap_render.m_bStopped; |
| 1559 if (pSMaskDict) { | 1561 if (pSMaskDict) { |
| 1560 CFX_Matrix smask_matrix = *pPageObj->m_GeneralState.GetSMaskMatrix(); | 1562 CFX_Matrix smask_matrix = *pPageObj->m_GeneralState.GetSMaskMatrix(); |
| 1561 smask_matrix.Concat(*pObj2Device); | 1563 smask_matrix.Concat(*pObj2Device); |
| 1562 std::unique_ptr<CFX_DIBSource> pSMaskSource = | 1564 std::unique_ptr<CFX_DIBSource> pSMaskSource = |
| 1563 LoadSMask(pSMaskDict, &rect, &smask_matrix); | 1565 LoadSMask(pSMaskDict, &rect, &smask_matrix); |
| 1564 if (pSMaskSource) | 1566 if (pSMaskSource) |
| 1565 bitmap->MultiplyAlpha(pSMaskSource.get()); | 1567 bitmap->MultiplyAlpha(pSMaskSource.get()); |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 } else if (pFunc) { | 2627 } else if (pFunc) { |
| 2626 int size = dest_pitch * height; | 2628 int size = dest_pitch * height; |
| 2627 for (int i = 0; i < size; i++) { | 2629 for (int i = 0; i < size; i++) { |
| 2628 dest_buf[i] = transfers[src_buf[i]]; | 2630 dest_buf[i] = transfers[src_buf[i]]; |
| 2629 } | 2631 } |
| 2630 } else { | 2632 } else { |
| 2631 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); | 2633 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); |
| 2632 } | 2634 } |
| 2633 return pMask; | 2635 return pMask; |
| 2634 } | 2636 } |
| OLD | NEW |