| 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 "core/fpdfapi/fpdf_page/cpdf_graphicstates.h" | 9 #include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h" |
| 10 #include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" | 10 #include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" |
| 11 #include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h" | |
| 12 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" | 11 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
| 13 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" | 12 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" |
| 14 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" | 13 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
| 15 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" | 14 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" |
| 16 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" | 15 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" |
| 17 #include "core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h" | 16 #include "core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h" |
| 18 #include "core/fpdfapi/fpdf_page/pageint.h" | 17 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 19 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 18 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 20 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 19 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
| 21 #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" | 20 #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 } else if (pPageObj->IsImage()) { | 939 } else if (pPageObj->IsImage()) { |
| 941 m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device)); | 940 m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device)); |
| 942 } else { | 941 } else { |
| 943 return; | 942 return; |
| 944 } | 943 } |
| 945 FX_RECT rect; | 944 FX_RECT rect; |
| 946 if (GetObjectClippedRect(pPageObj, pObj2Device, FALSE, rect)) { | 945 if (GetObjectClippedRect(pPageObj, pObj2Device, FALSE, rect)) { |
| 947 m_pDevice->RestoreState(); | 946 m_pDevice->RestoreState(); |
| 948 return; | 947 return; |
| 949 } | 948 } |
| 950 CFX_Matrix matrix = pattern->m_Pattern2Form; | 949 CFX_Matrix matrix = *pattern->pattern_to_form(); |
| 951 matrix.Concat(*pObj2Device); | 950 matrix.Concat(*pObj2Device); |
| 952 GetScaledMatrix(matrix); | 951 GetScaledMatrix(matrix); |
| 953 int alpha = pPageObj->m_GeneralState.GetAlpha(bStroke); | 952 int alpha = pPageObj->m_GeneralState.GetAlpha(bStroke); |
| 954 DrawShading(pattern, &matrix, rect, alpha, | 953 DrawShading(pattern, &matrix, rect, alpha, |
| 955 m_Options.m_ColorMode == RENDER_COLOR_ALPHA); | 954 m_Options.m_ColorMode == RENDER_COLOR_ALPHA); |
| 956 m_pDevice->RestoreState(); | 955 m_pDevice->RestoreState(); |
| 957 } | 956 } |
| 958 FX_BOOL CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj, | 957 FX_BOOL CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj, |
| 959 const CFX_Matrix* pObj2Device) { | 958 const CFX_Matrix* pObj2Device) { |
| 960 FX_RECT rect = pShadingObj->GetBBox(pObj2Device); | 959 FX_RECT rect = pShadingObj->GetBBox(pObj2Device); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 972 } | 971 } |
| 973 static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc, | 972 static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc, |
| 974 CPDF_PageRenderCache* pCache, | 973 CPDF_PageRenderCache* pCache, |
| 975 CPDF_TilingPattern* pPattern, | 974 CPDF_TilingPattern* pPattern, |
| 976 const CFX_Matrix* pObject2Device, | 975 const CFX_Matrix* pObject2Device, |
| 977 int width, | 976 int width, |
| 978 int height, | 977 int height, |
| 979 int flags) { | 978 int flags) { |
| 980 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; | 979 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
| 981 if (!pBitmap->Create(width, height, | 980 if (!pBitmap->Create(width, height, |
| 982 pPattern->m_bColored ? FXDIB_Argb : FXDIB_8bppMask)) { | 981 pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) { |
| 983 delete pBitmap; | 982 delete pBitmap; |
| 984 return NULL; | 983 return NULL; |
| 985 } | 984 } |
| 986 CFX_FxgeDevice bitmap_device; | 985 CFX_FxgeDevice bitmap_device; |
| 987 bitmap_device.Attach(pBitmap); | 986 bitmap_device.Attach(pBitmap); |
| 988 pBitmap->Clear(0); | 987 pBitmap->Clear(0); |
| 989 CFX_FloatRect cell_bbox = pPattern->m_BBox; | 988 CFX_FloatRect cell_bbox = pPattern->bbox(); |
| 990 pPattern->m_Pattern2Form.TransformRect(cell_bbox); | 989 pPattern->pattern_to_form()->TransformRect(cell_bbox); |
| 991 pObject2Device->TransformRect(cell_bbox); | 990 pObject2Device->TransformRect(cell_bbox); |
| 992 CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height); | 991 CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height); |
| 993 CFX_Matrix mtAdjust; | 992 CFX_Matrix mtAdjust; |
| 994 mtAdjust.MatchRect(bitmap_rect, cell_bbox); | 993 mtAdjust.MatchRect(bitmap_rect, cell_bbox); |
| 995 CFX_Matrix mtPattern2Bitmap = *pObject2Device; | 994 CFX_Matrix mtPattern2Bitmap = *pObject2Device; |
| 996 mtPattern2Bitmap.Concat(mtAdjust); | 995 mtPattern2Bitmap.Concat(mtAdjust); |
| 997 CPDF_RenderOptions options; | 996 CPDF_RenderOptions options; |
| 998 if (!pPattern->m_bColored) { | 997 if (!pPattern->colored()) |
| 999 options.m_ColorMode = RENDER_COLOR_ALPHA; | 998 options.m_ColorMode = RENDER_COLOR_ALPHA; |
| 1000 } | 999 |
| 1001 flags |= RENDER_FORCE_HALFTONE; | 1000 flags |= RENDER_FORCE_HALFTONE; |
| 1002 options.m_Flags = flags; | 1001 options.m_Flags = flags; |
| 1003 CPDF_RenderContext context(pDoc, pCache); | 1002 CPDF_RenderContext context(pDoc, pCache); |
| 1004 context.AppendLayer(pPattern->m_pForm, &mtPattern2Bitmap); | 1003 context.AppendLayer(pPattern->form(), &mtPattern2Bitmap); |
| 1005 context.Render(&bitmap_device, &options, nullptr); | 1004 context.Render(&bitmap_device, &options, nullptr); |
| 1006 return pBitmap; | 1005 return pBitmap; |
| 1007 } | 1006 } |
| 1008 void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, | 1007 void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, |
| 1009 const CPDF_PageObject* pPageObj, | 1008 const CPDF_PageObject* pPageObj, |
| 1010 const CFX_Matrix* pObj2Device, | 1009 const CFX_Matrix* pObj2Device, |
| 1011 FX_BOOL bStroke) { | 1010 FX_BOOL bStroke) { |
| 1012 if (!pPattern->Load()) { | 1011 if (!pPattern->Load()) { |
| 1013 return; | 1012 return; |
| 1014 } | 1013 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1026 FX_RECT clip_box = m_pDevice->GetClipBox(); | 1025 FX_RECT clip_box = m_pDevice->GetClipBox(); |
| 1027 if (clip_box.IsEmpty()) { | 1026 if (clip_box.IsEmpty()) { |
| 1028 m_pDevice->RestoreState(); | 1027 m_pDevice->RestoreState(); |
| 1029 return; | 1028 return; |
| 1030 } | 1029 } |
| 1031 CFX_Matrix dCTM = m_pDevice->GetCTM(); | 1030 CFX_Matrix dCTM = m_pDevice->GetCTM(); |
| 1032 FX_FLOAT sa = FXSYS_fabs(dCTM.a); | 1031 FX_FLOAT sa = FXSYS_fabs(dCTM.a); |
| 1033 FX_FLOAT sd = FXSYS_fabs(dCTM.d); | 1032 FX_FLOAT sd = FXSYS_fabs(dCTM.d); |
| 1034 clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); | 1033 clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); |
| 1035 clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); | 1034 clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); |
| 1036 CFX_Matrix mtPattern2Device = pPattern->m_Pattern2Form; | 1035 CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form(); |
| 1037 mtPattern2Device.Concat(*pObj2Device); | 1036 mtPattern2Device.Concat(*pObj2Device); |
| 1038 GetScaledMatrix(mtPattern2Device); | 1037 GetScaledMatrix(mtPattern2Device); |
| 1039 FX_BOOL bAligned = FALSE; | 1038 FX_BOOL bAligned = FALSE; |
| 1040 if (pPattern->m_BBox.left == 0 && pPattern->m_BBox.bottom == 0 && | 1039 if (pPattern->bbox().left == 0 && pPattern->bbox().bottom == 0 && |
| 1041 pPattern->m_BBox.right == pPattern->m_XStep && | 1040 pPattern->bbox().right == pPattern->x_step() && |
| 1042 pPattern->m_BBox.top == pPattern->m_YStep && | 1041 pPattern->bbox().top == pPattern->y_step() && |
| 1043 (mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated())) { | 1042 (mtPattern2Device.IsScaled() || mtPattern2Device.Is90Rotated())) { |
| 1044 bAligned = TRUE; | 1043 bAligned = TRUE; |
| 1045 } | 1044 } |
| 1046 CFX_FloatRect cell_bbox = pPattern->m_BBox; | 1045 CFX_FloatRect cell_bbox = pPattern->bbox(); |
| 1047 mtPattern2Device.TransformRect(cell_bbox); | 1046 mtPattern2Device.TransformRect(cell_bbox); |
| 1048 int width = (int)FXSYS_ceil(cell_bbox.Width()); | 1047 int width = (int)FXSYS_ceil(cell_bbox.Width()); |
| 1049 int height = (int)FXSYS_ceil(cell_bbox.Height()); | 1048 int height = (int)FXSYS_ceil(cell_bbox.Height()); |
| 1050 if (width == 0) { | 1049 if (width == 0) { |
| 1051 width = 1; | 1050 width = 1; |
| 1052 } | 1051 } |
| 1053 if (height == 0) { | 1052 if (height == 0) { |
| 1054 height = 1; | 1053 height = 1; |
| 1055 } | 1054 } |
| 1056 int min_col, max_col, min_row, max_row; | 1055 int min_col, max_col, min_row, max_row; |
| 1057 CFX_Matrix mtDevice2Pattern; | 1056 CFX_Matrix mtDevice2Pattern; |
| 1058 mtDevice2Pattern.SetReverse(mtPattern2Device); | 1057 mtDevice2Pattern.SetReverse(mtPattern2Device); |
| 1059 CFX_FloatRect clip_box_p(clip_box); | 1058 CFX_FloatRect clip_box_p(clip_box); |
| 1060 clip_box_p.Transform(&mtDevice2Pattern); | 1059 clip_box_p.Transform(&mtDevice2Pattern); |
| 1061 | 1060 |
| 1062 min_col = (int)FXSYS_ceil((clip_box_p.left - pPattern->m_BBox.right) / | 1061 min_col = (int)FXSYS_ceil((clip_box_p.left - pPattern->bbox().right) / |
| 1063 pPattern->m_XStep); | 1062 pPattern->x_step()); |
| 1064 max_col = (int)FXSYS_floor((clip_box_p.right - pPattern->m_BBox.left) / | 1063 max_col = (int)FXSYS_floor((clip_box_p.right - pPattern->bbox().left) / |
| 1065 pPattern->m_XStep); | 1064 pPattern->x_step()); |
| 1066 min_row = (int)FXSYS_ceil((clip_box_p.bottom - pPattern->m_BBox.top) / | 1065 min_row = (int)FXSYS_ceil((clip_box_p.bottom - pPattern->bbox().top) / |
| 1067 pPattern->m_YStep); | 1066 pPattern->y_step()); |
| 1068 max_row = (int)FXSYS_floor((clip_box_p.top - pPattern->m_BBox.bottom) / | 1067 max_row = (int)FXSYS_floor((clip_box_p.top - pPattern->bbox().bottom) / |
| 1069 pPattern->m_YStep); | 1068 pPattern->y_step()); |
| 1070 | 1069 |
| 1071 if (width > clip_box.Width() || height > clip_box.Height() || | 1070 if (width > clip_box.Width() || height > clip_box.Height() || |
| 1072 width * height > clip_box.Width() * clip_box.Height()) { | 1071 width * height > clip_box.Width() * clip_box.Height()) { |
| 1073 CPDF_GraphicStates* pStates = NULL; | 1072 CPDF_GraphicStates* pStates = NULL; |
| 1074 if (!pPattern->m_bColored) { | 1073 if (!pPattern->colored()) |
| 1075 pStates = CloneObjStates(pPageObj, bStroke); | 1074 pStates = CloneObjStates(pPageObj, bStroke); |
| 1076 } | 1075 |
| 1077 CPDF_Dictionary* pFormResource = NULL; | 1076 CPDF_Dictionary* pFormResource = nullptr; |
| 1078 if (pPattern->m_pForm->m_pFormDict) { | 1077 if (pPattern->form()->m_pFormDict) |
| 1079 pFormResource = pPattern->m_pForm->m_pFormDict->GetDictBy("Resources"); | 1078 pFormResource = pPattern->form()->m_pFormDict->GetDictBy("Resources"); |
| 1080 } | 1079 |
| 1081 for (int col = min_col; col <= max_col; col++) | 1080 for (int col = min_col; col <= max_col; col++) |
| 1082 for (int row = min_row; row <= max_row; row++) { | 1081 for (int row = min_row; row <= max_row; row++) { |
| 1083 FX_FLOAT orig_x, orig_y; | 1082 FX_FLOAT orig_x, orig_y; |
| 1084 orig_x = col * pPattern->m_XStep; | 1083 orig_x = col * pPattern->x_step(); |
| 1085 orig_y = row * pPattern->m_YStep; | 1084 orig_y = row * pPattern->y_step(); |
| 1086 mtPattern2Device.Transform(orig_x, orig_y); | 1085 mtPattern2Device.Transform(orig_x, orig_y); |
| 1087 CFX_Matrix matrix = *pObj2Device; | 1086 CFX_Matrix matrix = *pObj2Device; |
| 1088 matrix.Translate(orig_x - mtPattern2Device.e, | 1087 matrix.Translate(orig_x - mtPattern2Device.e, |
| 1089 orig_y - mtPattern2Device.f); | 1088 orig_y - mtPattern2Device.f); |
| 1090 m_pDevice->SaveState(); | 1089 m_pDevice->SaveState(); |
| 1091 CPDF_RenderStatus status; | 1090 CPDF_RenderStatus status; |
| 1092 status.Initialize(m_pContext, m_pDevice, NULL, NULL, this, pStates, | 1091 status.Initialize(m_pContext, m_pDevice, nullptr, nullptr, this, |
| 1093 &m_Options, pPattern->m_pForm->m_Transparency, | 1092 pStates, &m_Options, pPattern->form()->m_Transparency, |
| 1094 m_bDropObjects, pFormResource); | 1093 m_bDropObjects, pFormResource); |
| 1095 status.RenderObjectList(pPattern->m_pForm, &matrix); | 1094 status.RenderObjectList(pPattern->form(), &matrix); |
| 1096 m_pDevice->RestoreState(); | 1095 m_pDevice->RestoreState(); |
| 1097 } | 1096 } |
| 1098 m_pDevice->RestoreState(); | 1097 m_pDevice->RestoreState(); |
| 1099 delete pStates; | 1098 delete pStates; |
| 1100 return; | 1099 return; |
| 1101 } | 1100 } |
| 1102 if (bAligned) { | 1101 if (bAligned) { |
| 1103 int orig_x = FXSYS_round(mtPattern2Device.e); | 1102 int orig_x = FXSYS_round(mtPattern2Device.e); |
| 1104 int orig_y = FXSYS_round(mtPattern2Device.f); | 1103 int orig_y = FXSYS_round(mtPattern2Device.f); |
| 1105 min_col = (clip_box.left - orig_x) / width; | 1104 min_col = (clip_box.left - orig_x) / width; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 } | 1149 } |
| 1151 screen.Clear(0); | 1150 screen.Clear(0); |
| 1152 uint32_t* src_buf = (uint32_t*)pPatternBitmap->GetBuffer(); | 1151 uint32_t* src_buf = (uint32_t*)pPatternBitmap->GetBuffer(); |
| 1153 for (int col = min_col; col <= max_col; col++) { | 1152 for (int col = min_col; col <= max_col; col++) { |
| 1154 for (int row = min_row; row <= max_row; row++) { | 1153 for (int row = min_row; row <= max_row; row++) { |
| 1155 int start_x, start_y; | 1154 int start_x, start_y; |
| 1156 if (bAligned) { | 1155 if (bAligned) { |
| 1157 start_x = FXSYS_round(mtPattern2Device.e) + col * width - clip_box.left; | 1156 start_x = FXSYS_round(mtPattern2Device.e) + col * width - clip_box.left; |
| 1158 start_y = FXSYS_round(mtPattern2Device.f) + row * height - clip_box.top; | 1157 start_y = FXSYS_round(mtPattern2Device.f) + row * height - clip_box.top; |
| 1159 } else { | 1158 } else { |
| 1160 FX_FLOAT orig_x = col * pPattern->m_XStep; | 1159 FX_FLOAT orig_x = col * pPattern->x_step(); |
| 1161 FX_FLOAT orig_y = row * pPattern->m_YStep; | 1160 FX_FLOAT orig_y = row * pPattern->y_step(); |
| 1162 mtPattern2Device.Transform(orig_x, orig_y); | 1161 mtPattern2Device.Transform(orig_x, orig_y); |
| 1163 start_x = FXSYS_round(orig_x + left_offset) - clip_box.left; | 1162 start_x = FXSYS_round(orig_x + left_offset) - clip_box.left; |
| 1164 start_y = FXSYS_round(orig_y + top_offset) - clip_box.top; | 1163 start_y = FXSYS_round(orig_y + top_offset) - clip_box.top; |
| 1165 } | 1164 } |
| 1166 if (width == 1 && height == 1) { | 1165 if (width == 1 && height == 1) { |
| 1167 if (start_x < 0 || start_x >= clip_box.Width() || start_y < 0 || | 1166 if (start_x < 0 || start_x >= clip_box.Width() || start_y < 0 || |
| 1168 start_y >= clip_box.Height()) { | 1167 start_y >= clip_box.Height()) { |
| 1169 continue; | 1168 continue; |
| 1170 } | 1169 } |
| 1171 uint32_t* dest_buf = | 1170 uint32_t* dest_buf = |
| 1172 (uint32_t*)(screen.GetBuffer() + screen.GetPitch() * start_y + | 1171 (uint32_t*)(screen.GetBuffer() + screen.GetPitch() * start_y + |
| 1173 start_x * 4); | 1172 start_x * 4); |
| 1174 if (pPattern->m_bColored) { | 1173 if (pPattern->colored()) |
| 1175 *dest_buf = *src_buf; | 1174 *dest_buf = *src_buf; |
| 1176 } else { | 1175 else |
| 1177 *dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffffff); | 1176 *dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffffff); |
| 1178 } | |
| 1179 } else { | 1177 } else { |
| 1180 if (pPattern->m_bColored) { | 1178 if (pPattern->colored()) { |
| 1181 screen.CompositeBitmap(start_x, start_y, width, height, | 1179 screen.CompositeBitmap(start_x, start_y, width, height, |
| 1182 pPatternBitmap, 0, 0); | 1180 pPatternBitmap, 0, 0); |
| 1183 } else { | 1181 } else { |
| 1184 screen.CompositeMask(start_x, start_y, width, height, pPatternBitmap, | 1182 screen.CompositeMask(start_x, start_y, width, height, pPatternBitmap, |
| 1185 fill_argb, 0, 0); | 1183 fill_argb, 0, 0); |
| 1186 } | 1184 } |
| 1187 } | 1185 } |
| 1188 } | 1186 } |
| 1189 } | 1187 } |
| 1190 CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255, | 1188 CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255, |
| 1191 FXDIB_BLEND_NORMAL, FALSE); | 1189 FXDIB_BLEND_NORMAL, FALSE); |
| 1192 m_pDevice->RestoreState(); | 1190 m_pDevice->RestoreState(); |
| 1193 delete pPatternBitmap; | 1191 delete pPatternBitmap; |
| 1194 } | 1192 } |
| 1193 |
| 1195 void CPDF_RenderStatus::DrawPathWithPattern(const CPDF_PathObject* pPathObj, | 1194 void CPDF_RenderStatus::DrawPathWithPattern(const CPDF_PathObject* pPathObj, |
| 1196 const CFX_Matrix* pObj2Device, | 1195 const CFX_Matrix* pObj2Device, |
| 1197 CPDF_Color* pColor, | 1196 CPDF_Color* pColor, |
| 1198 FX_BOOL bStroke) { | 1197 FX_BOOL bStroke) { |
| 1199 CPDF_Pattern* pattern = pColor->GetPattern(); | 1198 CPDF_Pattern* pattern = pColor->GetPattern(); |
| 1200 if (!pattern) { | 1199 if (!pattern) |
| 1201 return; | 1200 return; |
| 1202 } | 1201 |
| 1203 if (pattern->m_PatternType == CPDF_Pattern::TILING) { | 1202 if (CPDF_TilingPattern* pTilingPattern = pattern->AsTilingPattern()) |
| 1204 DrawTilingPattern(static_cast<CPDF_TilingPattern*>(pattern), pPathObj, | 1203 DrawTilingPattern(pTilingPattern, pPathObj, pObj2Device, bStroke); |
| 1205 pObj2Device, bStroke); | 1204 else if (CPDF_ShadingPattern* pShadingPattern = pattern->AsShadingPattern()) |
| 1206 } else { | 1205 DrawShadingPattern(pShadingPattern, pPathObj, pObj2Device, bStroke); |
| 1207 DrawShadingPattern(static_cast<CPDF_ShadingPattern*>(pattern), pPathObj, | |
| 1208 pObj2Device, bStroke); | |
| 1209 } | |
| 1210 } | 1206 } |
| 1207 |
| 1211 void CPDF_RenderStatus::ProcessPathPattern(const CPDF_PathObject* pPathObj, | 1208 void CPDF_RenderStatus::ProcessPathPattern(const CPDF_PathObject* pPathObj, |
| 1212 const CFX_Matrix* pObj2Device, | 1209 const CFX_Matrix* pObj2Device, |
| 1213 int& filltype, | 1210 int& filltype, |
| 1214 FX_BOOL& bStroke) { | 1211 FX_BOOL& bStroke) { |
| 1215 if (filltype) { | 1212 if (filltype) { |
| 1216 CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor(); | 1213 CPDF_Color& FillColor = *pPathObj->m_ColorState.GetFillColor(); |
| 1217 if (FillColor.m_pCS && FillColor.m_pCS->GetFamily() == PDFCS_PATTERN) { | 1214 if (FillColor.m_pCS && FillColor.m_pCS->GetFamily() == PDFCS_PATTERN) { |
| 1218 DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, FALSE); | 1215 DrawPathWithPattern(pPathObj, pObj2Device, &FillColor, FALSE); |
| 1219 filltype = 0; | 1216 filltype = 0; |
| 1220 } | 1217 } |
| 1221 } | 1218 } |
| 1222 if (bStroke) { | 1219 if (bStroke) { |
| 1223 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); | 1220 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); |
| 1224 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { | 1221 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { |
| 1225 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); | 1222 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); |
| 1226 bStroke = FALSE; | 1223 bStroke = FALSE; |
| 1227 } | 1224 } |
| 1228 } | 1225 } |
| 1229 } | 1226 } |
| OLD | NEW |