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/fxge/include/cfx_pathdata.h" | 7 #include "core/fxge/include/cfx_pathdata.h" |
8 #include "core/fxge/include/fx_ge.h" | 8 #include "core/fxge/include/fx_ge.h" |
9 #include "core/fxge/include/ifx_renderdevicedriver.h" | 9 #include "core/fxge/include/ifx_renderdevicedriver.h" |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, fill_color, fill_mode, | 163 DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, fill_color, fill_mode, |
164 blend_type); | 164 blend_type); |
165 return TRUE; | 165 return TRUE; |
166 } | 166 } |
167 if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && | 167 if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && |
168 stroke_alpha == 0) { | 168 stroke_alpha == 0) { |
169 CFX_FloatRect rect_f; | 169 CFX_FloatRect rect_f; |
170 if (!(fill_mode & FXFILL_RECT_AA) && | 170 if (!(fill_mode & FXFILL_RECT_AA) && |
171 pPathData->IsRect(pObject2Device, &rect_f)) { | 171 pPathData->IsRect(pObject2Device, &rect_f)) { |
172 FX_RECT rect_i = rect_f.GetOutterRect(); | 172 FX_RECT rect_i = rect_f.GetOuterRect(); |
173 | 173 |
174 // Depending on the top/bottom, left/right values of the rect it's | 174 // Depending on the top/bottom, left/right values of the rect it's |
175 // possible to overflow the Width() and Height() calculations. Check that | 175 // possible to overflow the Width() and Height() calculations. Check that |
176 // the rect will have valid dimension before continuing. | 176 // the rect will have valid dimension before continuing. |
177 if (!rect_i.Valid()) | 177 if (!rect_i.Valid()) |
178 return FALSE; | 178 return FALSE; |
179 | 179 |
180 int width = (int)FXSYS_ceil(rect_f.right - rect_f.left); | 180 int width = (int)FXSYS_ceil(rect_f.right - rect_f.left); |
181 if (width < 1) { | 181 if (width < 1) { |
182 width = 1; | 182 width = 1; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 pGraphState->m_MiterLimit); | 269 pGraphState->m_MiterLimit); |
270 } else { | 270 } else { |
271 bbox = pPathData->GetBoundingBox(); | 271 bbox = pPathData->GetBoundingBox(); |
272 } | 272 } |
273 if (pObject2Device) { | 273 if (pObject2Device) { |
274 bbox.Transform(pObject2Device); | 274 bbox.Transform(pObject2Device); |
275 } | 275 } |
276 CFX_Matrix ctm = GetCTM(); | 276 CFX_Matrix ctm = GetCTM(); |
277 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); | 277 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); |
278 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); | 278 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); |
279 FX_RECT rect = bbox.GetOutterRect(); | 279 FX_RECT rect = bbox.GetOuterRect(); |
280 CFX_DIBitmap bitmap, Backdrop; | 280 CFX_DIBitmap bitmap, Backdrop; |
281 if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), | 281 if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), |
282 FXSYS_round(rect.Height() * fScaleY))) { | 282 FXSYS_round(rect.Height() * fScaleY))) { |
283 return FALSE; | 283 return FALSE; |
284 } | 284 } |
285 if (bitmap.HasAlpha()) { | 285 if (bitmap.HasAlpha()) { |
286 bitmap.Clear(0); | 286 bitmap.Clear(0); |
287 Backdrop.Copy(&bitmap); | 287 Backdrop.Copy(&bitmap); |
288 } else { | 288 } else { |
289 if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top)) | 289 if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top)) |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 void CFX_RenderDevice::CancelDIBits(void* handle) { | 495 void CFX_RenderDevice::CancelDIBits(void* handle) { |
496 m_pDeviceDriver->CancelDIBits(handle); | 496 m_pDeviceDriver->CancelDIBits(handle); |
497 } | 497 } |
498 | 498 |
499 #ifdef _SKIA_SUPPORT_ | 499 #ifdef _SKIA_SUPPORT_ |
500 | 500 |
501 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { | 501 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { |
502 SkASSERT(0); | 502 SkASSERT(0); |
503 } | 503 } |
504 #endif | 504 #endif |
OLD | NEW |