summaryrefslogtreecommitdiff
path: root/core/fxge/skia
diff options
context:
space:
mode:
authorCary Clark <caryclark@skia.org>2017-07-05 13:23:57 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-05 19:58:59 +0000
commitecc238c9487288e1f3bfe8973245011f2eb0bcf2 (patch)
tree97fec33f3378e651f4e0a476d2115cf2c65c53db /core/fxge/skia
parenta9e28433600816a20406709c5652ba91697bc387 (diff)
downloadpdfium-ecc238c9487288e1f3bfe8973245011f2eb0bcf2.tar.xz
set clip rect
clip rect should mirror existing construction Also found tracing. Keep the clip rect in sync with its expected value for compatibility. R=dsinclair@chromium.org,npm@chromium.org Bug: 736703 Change-Id: I57bab209f5e1febb5fbcd91860b43296063f1f80 Reviewed-on: https://pdfium-review.googlesource.com/7275 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'core/fxge/skia')
-rw-r--r--core/fxge/skia/fx_skia_device.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index ab026f6cc4..2d60f74e86 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -861,12 +861,29 @@ class SkiaState {
if (m_debugDisable)
return false;
Dump(__func__);
- SkPath skClipPath = BuildPath(pPathData);
- skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE
- ? SkPath::kEvenOdd_FillType
- : SkPath::kWinding_FillType);
- SkMatrix skMatrix = ToSkMatrix(*pMatrix);
- skClipPath.transform(skMatrix);
+ SkPath skClipPath;
+ if (pPathData->GetPoints().size() == 5 ||
+ pPathData->GetPoints().size() == 4) {
+ CFX_FloatRect rectf;
+ if (pPathData->IsRect(pMatrix, &rectf)) {
+ rectf.Intersect(CFX_FloatRect(
+ 0, 0,
+ static_cast<float>(m_pDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ static_cast<float>(m_pDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT))));
+ FX_RECT outer = rectf.GetOuterRect();
+ // note that PDF's y-axis goes up; Skia's y-axis goes down
+ skClipPath.addRect({(float)outer.left, (float)outer.bottom,
+ (float)outer.right, (float)outer.top});
+ }
+ }
+ if (skClipPath.isEmpty()) {
+ skClipPath = BuildPath(pPathData);
+ skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE
+ ? SkPath::kEvenOdd_FillType
+ : SkPath::kWinding_FillType);
+ SkMatrix skMatrix = ToSkMatrix(*pMatrix);
+ skClipPath.transform(skMatrix);
+ }
return SetClip(skClipPath);
}