diff options
author | 2017-02-10 21:45:43 +0000 | |
---|---|---|
committer | 2017-02-10 21:45:59 +0000 | |
commit | 8600b1b3d622969039e11a9f5dee2795b96490fc (patch) | |
tree | 6b6cf2481e10f0629ec91cc740af446298036e9b /src/gpu | |
parent | 6e83b13c226246041a33dc7bf0e92626581b5e79 (diff) |
Revert "Use SDF path miplevels based on the original path's size."
This reverts commit 6e83b13c226246041a33dc7bf0e92626581b5e79.
Reason for revert: Fractional path sizes are causing asserts on the bots.
Original change's description:
> Use SDF path miplevels based on the original path's size.
>
> Should produce sharper results than arbitrary fixed sizes.
> Adds a new test to pathfill GM.
>
> BUG=chromium:682918
>
> Change-Id: I5a394098665d01e995a244fde278236f1471e6c9
> Reviewed-on: https://skia-review.googlesource.com/8328
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
>
TBR=jvanverth@google.com,bsalomon@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:682918
Change-Id: I4a52df808ef3f769d0e6f75785148d46936a6747
Reviewed-on: https://skia-review.googlesource.com/8342
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/ops/GrAADistanceFieldPathRenderer.cpp | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp index e1a04396eb..f817f86357 100644 --- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp @@ -10,7 +10,6 @@ #include "GrBuffer.h" #include "GrContext.h" -#include "GrDistanceFieldGenFromVector.h" #include "GrDrawOpTest.h" #include "GrOpFlushState.h" #include "GrPipelineBuilder.h" @@ -21,10 +20,10 @@ #include "effects/GrDistanceFieldGeoProc.h" #include "ops/GrMeshDrawOp.h" +#include "SkPathOps.h" #include "SkAutoMalloc.h" #include "SkDistanceFieldGen.h" -#include "SkMathPriv.h" -#include "SkPathOps.h" +#include "GrDistanceFieldGenFromVector.h" #define ATLAS_TEXTURE_WIDTH 2048 #define ATLAS_TEXTURE_HEIGHT 2048 @@ -40,12 +39,9 @@ static int g_NumFreedShapes = 0; #endif // mip levels -static const int kMinMIP = 16; -static const int kMinMIPLog = 4; -static const int kMaxMIP = 162; - -static const int kMaxDim = 73; -static const int kMaxSize = 2*kMaxMIP; +static const int kSmallMIP = 32; +static const int kMediumMIP = 73; +static const int kLargeMIP = 162; // Callback to clear out internal path cache when eviction occurs void GrAADistanceFieldPathRenderer::HandleEviction(GrDrawOpAtlas::AtlasID id, void* pr) { @@ -111,14 +107,14 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c return false; } - // Only support paths with bounds within kMaxDim by kMaxDim, - // scaled to have bounds within kMaxSize by kMaxSize. + // Only support paths with bounds within kMediumMIP by kMediumMIP, + // scaled to have bounds within 2.0f*kLargeMIP by 2.0f*kLargeMIP. // The goal is to accelerate rendering of lots of small paths that may be scaling. SkScalar maxScale = args.fViewMatrix->getMaxScale(); SkRect bounds = args.fShape->styledBounds(); SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height()); - return maxDim <= kMaxDim && maxDim * maxScale <= kMaxSize; + return maxDim <= kMediumMIP && maxDim * maxScale <= 2.0f*kLargeMIP; } //////////////////////////////////////////////////////////////////////////////// @@ -245,28 +241,20 @@ private: const SkRect& bounds = args.fShape.bounds(); SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height()); SkScalar size = maxScale * maxDim; - // We try to create the DF at a power of two scaled path resolution (1/2, 1, 2, 4, etc) - // In the majority of cases this will yield a crisper rendering. - SkScalar mipScale = 1.0f; - // for small paths, scale up to a min size between kMinMIP and 2*kMinMIP - if (maxDim < kMinMIP) { - mipScale = SkIntToScalar(1 << (kMinMIPLog - SkPrevLog2(maxDim))); - // for larger paths, initial scale is half the original - // gives us a size between kMinMIP and kMaxDim/2 (or close to (kMinMIP, 2*kMinMIP]) - } else if (maxDim > 2*kMinMIP) { - mipScale = 0.5f; - } - SkScalar smallMipSize = mipScale*maxDim; - SkScalar desiredDimension; - if (size <= smallMipSize) { - desiredDimension = smallMipSize; - } else if (size <= 2*smallMipSize) { - desiredDimension = 2*smallMipSize; - } else if (size <= 4*smallMipSize) { - desiredDimension = 4*smallMipSize; + // For minimizing (or the common case of identity) transforms, we try to + // create the DF at the appropriately sized native src-space path resolution. + // In the majority of cases this will yield a crisper rendering. + if (size <= maxDim && maxDim < kSmallMIP) { + desiredDimension = maxDim; + } else if (size <= kSmallMIP) { + desiredDimension = kSmallMIP; + } else if (size <= maxDim) { + desiredDimension = maxDim; + } else if (size <= kMediumMIP) { + desiredDimension = kMediumMIP; } else { - desiredDimension = kMaxMIP; + desiredDimension = kLargeMIP; } // check to see if path is cached |