aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSoftwarePathRenderer.cpp
diff options
context:
space:
mode:
authorGravatar Stan Iliev <stani@google.com>2017-08-15 17:10:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-16 13:23:27 +0000
commit67cd67329184513ef1efc2d69071fa2a79c244e0 (patch)
treeabe21fdc5f108d41ce0cfcd33d4f1f7756d2f5fb /src/gpu/GrSoftwarePathRenderer.cpp
parent228276dabf8461ba8be7a0dc744cb3374e3c4f1e (diff)
Cache more aggressively in GrSoftwarePathRenderer for Android
Discard fractional translation from the cache key in GrSoftwarePathRenderer for Android framework. This improves cache hit ratio and speeds up draw frame 50th percentile for quick settings jank test by 0.7ms. This quality trade-off is fine and it is matching HWUI OpenGL renderer behavior. Bug: b/64487466 Change-Id: I865169aa2acbca80f1399da8bdd7f624f413295e Reviewed-on: https://skia-review.googlesource.com/34900 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Stan Iliev <stani@google.com>
Diffstat (limited to 'src/gpu/GrSoftwarePathRenderer.cpp')
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 8858bf90a2..7201c8bce4 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -186,19 +186,30 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
SkScalar sy = args.fViewMatrix->get(SkMatrix::kMScaleY);
SkScalar kx = args.fViewMatrix->get(SkMatrix::kMSkewX);
SkScalar ky = args.fViewMatrix->get(SkMatrix::kMSkewY);
+ static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ // Fractional translate does not affect caching on Android. This is done for better cache
+ // hit ratio and speed, but it is matching HWUI behavior, which doesn't consider the matrix
+ // at all when caching paths.
+ GrUniqueKey::Builder builder(&maskKey, kDomain, 4 + args.fShape->unstyledKeySize());
+#else
SkScalar tx = args.fViewMatrix->get(SkMatrix::kMTransX);
SkScalar ty = args.fViewMatrix->get(SkMatrix::kMTransY);
// Allow 8 bits each in x and y of subpixel positioning.
SkFixed fracX = SkScalarToFixed(SkScalarFraction(tx)) & 0x0000FF00;
SkFixed fracY = SkScalarToFixed(SkScalarFraction(ty)) & 0x0000FF00;
- static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey::Builder builder(&maskKey, kDomain, 5 + args.fShape->unstyledKeySize());
+#endif
builder[0] = SkFloat2Bits(sx);
builder[1] = SkFloat2Bits(sy);
builder[2] = SkFloat2Bits(kx);
builder[3] = SkFloat2Bits(ky);
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ args.fShape->writeUnstyledKey(&builder[4]);
+#else
builder[4] = fracX | (fracY >> 8);
args.fShape->writeUnstyledKey(&builder[5]);
+#endif
// FIXME: Doesn't the key need to consider whether we're using AA or not? In practice that
// should always be true, though.
}