From ba998f2ddc5a904376bfdb118976868b9ee2b6e8 Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Fri, 12 Oct 2012 11:33:56 +0000 Subject: Turn on GPU AA clipping https://codereview.appspot.com/6638048/ git-svn-id: http://skia.googlecode.com/svn/trunk@5909 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/GrClipMaskCache.h | 5 ++--- src/gpu/GrClipMaskManager.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gpu/GrClipMaskCache.h b/src/gpu/GrClipMaskCache.h index f1152cc6be..6722d70362 100644 --- a/src/gpu/GrClipMaskCache.h +++ b/src/gpu/GrClipMaskCache.h @@ -31,7 +31,7 @@ public: } } - bool canReuse(const SkClipStack& clip, int width, int height) { + bool canReuse(const SkClipStack& clip, const GrIRect& devBounds) { if (fStack.empty()) { GrAssert(false); @@ -41,8 +41,7 @@ public: GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); if (back->fLastMask.texture() && - back->fLastMask.texture()->width() >= width && - back->fLastMask.texture()->height() >= height && + back->fLastBound == devBounds && clip == back->fLastClip) { return true; } diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 5f1f0e3899..322fba146a 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -20,8 +20,8 @@ GR_DEFINE_RESOURCE_CACHE_DOMAIN(GrClipMaskManager, GetAlphaMaskDomain) -//#define GR_AA_CLIP 1 -//#define GR_SW_CLIP 1 +#define GR_AA_CLIP 1 +#define GR_SW_CLIP 1 //////////////////////////////////////////////////////////////////////////////// namespace { @@ -565,9 +565,7 @@ bool GrClipMaskManager::clipMaskPreamble(const GrClipData& clipDataIn, // TODO: make sure we don't outset if bounds are still 0,0 @ min - if (fAACache.canReuse(*clipDataIn.fClipStack, - devResultBounds->width(), - devResultBounds->height())) { + if (fAACache.canReuse(*clipDataIn.fClipStack, *devResultBounds)) { *result = fAACache.getLastMask(); fAACache.getLastBound(devResultBounds); return true; @@ -1163,6 +1161,8 @@ bool GrClipMaskManager::createSoftwareClipMask(const GrClipData& clipDataIn, if (SkRegion::kReverseDifference_Op == op) { SkRect temp; temp.set(*devResultBounds); + temp.offset(SkIntToScalar(clipDataIn.fOrigin.fX), + SkIntToScalar(clipDataIn.fOrigin.fX)); // invert the entire scene helper.draw(temp, SkRegion::kXOR_Op, false, 0xFF); -- cgit v1.2.3