| 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 "core/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 CFX_DIBitmap* pBitmap, | 745 CFX_DIBitmap* pBitmap, |
| 746 CFX_Matrix* pObject2Bitmap, | 746 CFX_Matrix* pObject2Bitmap, |
| 747 CPDF_Stream* pShadingStream, | 747 CPDF_Stream* pShadingStream, |
| 748 const std::vector<std::unique_ptr<CPDF_Function>>& funcs, | 748 const std::vector<std::unique_ptr<CPDF_Function>>& funcs, |
| 749 CPDF_ColorSpace* pCS, | 749 CPDF_ColorSpace* pCS, |
| 750 int fill_mode, | 750 int fill_mode, |
| 751 int alpha) { | 751 int alpha) { |
| 752 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); | 752 ASSERT(pBitmap->GetFormat() == FXDIB_Argb); |
| 753 | 753 |
| 754 CFX_FxgeDevice device; | 754 CFX_FxgeDevice device; |
| 755 device.Attach(pBitmap); | 755 device.Attach(pBitmap, false, nullptr, false); |
| 756 CPDF_MeshStream stream(funcs, pCS); | 756 CPDF_MeshStream stream(funcs, pCS); |
| 757 if (!stream.Load(pShadingStream)) | 757 if (!stream.Load(pShadingStream)) |
| 758 return; | 758 return; |
| 759 if (!CheckCoonTensorPara(stream)) | 759 if (!CheckCoonTensorPara(stream)) |
| 760 return; | 760 return; |
| 761 | 761 |
| 762 CPDF_PatchDrawer patch; | 762 CPDF_PatchDrawer patch; |
| 763 patch.alpha = alpha; | 763 patch.alpha = alpha; |
| 764 patch.pDevice = &device; | 764 patch.pDevice = &device; |
| 765 patch.fill_mode = fill_mode; | 765 patch.fill_mode = fill_mode; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 const CFX_Matrix* pObject2Device, | 823 const CFX_Matrix* pObject2Device, |
| 824 int width, | 824 int width, |
| 825 int height, | 825 int height, |
| 826 int flags) { | 826 int flags) { |
| 827 std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap); | 827 std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap); |
| 828 if (!pBitmap->Create(width, height, | 828 if (!pBitmap->Create(width, height, |
| 829 pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) { | 829 pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) { |
| 830 return std::unique_ptr<CFX_DIBitmap>(); | 830 return std::unique_ptr<CFX_DIBitmap>(); |
| 831 } | 831 } |
| 832 CFX_FxgeDevice bitmap_device; | 832 CFX_FxgeDevice bitmap_device; |
| 833 bitmap_device.Attach(pBitmap.get()); | 833 bitmap_device.Attach(pBitmap.get(), false, nullptr, false); |
| 834 pBitmap->Clear(0); | 834 pBitmap->Clear(0); |
| 835 CFX_FloatRect cell_bbox = pPattern->bbox(); | 835 CFX_FloatRect cell_bbox = pPattern->bbox(); |
| 836 pPattern->pattern_to_form()->TransformRect(cell_bbox); | 836 pPattern->pattern_to_form()->TransformRect(cell_bbox); |
| 837 pObject2Device->TransformRect(cell_bbox); | 837 pObject2Device->TransformRect(cell_bbox); |
| 838 CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height); | 838 CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height); |
| 839 CFX_Matrix mtAdjust; | 839 CFX_Matrix mtAdjust; |
| 840 mtAdjust.MatchRect(bitmap_rect, cell_bbox); | 840 mtAdjust.MatchRect(bitmap_rect, cell_bbox); |
| 841 CFX_Matrix mtPattern2Bitmap = *pObject2Device; | 841 CFX_Matrix mtPattern2Bitmap = *pObject2Device; |
| 842 mtPattern2Bitmap.Concat(mtAdjust); | 842 mtPattern2Bitmap.Concat(mtAdjust); |
| 843 CPDF_RenderOptions options; | 843 CPDF_RenderOptions options; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 } | 1207 } |
| 1208 } | 1208 } |
| 1209 if (bStroke) { | 1209 if (bStroke) { |
| 1210 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); | 1210 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); |
| 1211 if (StrokeColor.IsPattern()) { | 1211 if (StrokeColor.IsPattern()) { |
| 1212 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); | 1212 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); |
| 1213 bStroke = FALSE; | 1213 bStroke = FALSE; |
| 1214 } | 1214 } |
| 1215 } | 1215 } |
| 1216 } | 1216 } |
| OLD | NEW |