Make GMs aware of what tool they're being run in.
Add a saveLayer set of draws to convex_poly_clip and fix GPU bug where polygon clips don't account for the translation between clip and device space.
BUG=skia:2051
R=robertphillips@google.com, reed@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/148283017
git-svn-id: http://skia.googlecode.com/svn/trunk@13371 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index c1c5973..adb6cee 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -158,18 +158,23 @@
// clips against the edges.
if (1 == elements.count() && SkClipStack::Element::kPath_Type == elements.tail()->getType() &&
SkRegion::kReplace_Op == elements.tail()->getOp()) {
- const SkPath& p = elements.tail()->getPath();
+ const SkPath& path = elements.tail()->getPath();
bool isAA = GR_AA_CLIP && elements.tail()->isAA();
SkAutoTUnref<GrEffectRef> effect;
if (rt->isMultisampled()) {
// A coverage effect for AA clipping won't play nicely with MSAA.
if (!isAA) {
- effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect::kFillNoAA_EdgeType, p));
+ SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX),
+ SkIntToScalar(-clipDataIn->fOrigin.fY) };
+ effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect::kFillNoAA_EdgeType,
+ path, &offset));
}
} else {
+ SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX),
+ SkIntToScalar(-clipDataIn->fOrigin.fY) };
GrConvexPolyEffect::EdgeType type = isAA ? GrConvexPolyEffect::kFillAA_EdgeType :
GrConvexPolyEffect::kFillNoAA_EdgeType;
- effect.reset(GrConvexPolyEffect::Create(type, p));
+ effect.reset(GrConvexPolyEffect::Create(type, path, &offset));
}
if (effect) {
are->set(fGpu->drawState());