fix a bug in scrolling BitmapText gpu cached textblobs
authorjoshualitt <joshualitt@chromium.org>
Mon, 27 Apr 2015 16:36:55 +0000 (09:36 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 27 Apr 2015 16:36:55 +0000 (09:36 -0700)
BUG=skia:

Review URL: https://codereview.chromium.org/1103243002

src/gpu/GrAtlasTextContext.cpp
src/gpu/GrAtlasTextContext.h
src/gpu/GrTextBlobCache.cpp

index 56ad9d2..8e4b663 100644 (file)
@@ -307,23 +307,10 @@ bool GrAtlasTextContext::MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTr
                           viewMatrix.getSkewY() * (x - blob.fX) +
                           viewMatrix.getScaleY() * (y - blob.fY) -
                           blob.fViewMatrix.getTranslateY();
-        if (SkScalarFraction(transX) > SK_ScalarNearlyZero ||
-            SkScalarFraction(transY) > SK_ScalarNearlyZero) {
+        if (!SkScalarIsInt(transX) || !SkScalarIsInt(transY) ) {
             return true;
         }
 
-#ifdef SK_DEBUG
-        static const SkScalar kMinDiscernableTranslation = 0.0625;
-        // As a safeguard when debugging, we store the total error across all translations and print
-        // if the error becomes discernable.  This is pretty unlikely to occur given the tight
-        // bounds above on translation
-        blob.fTotalXError += SkScalarAbs(SkScalarFraction(transX));
-        blob.fTotalYError += SkScalarAbs(SkScalarFraction(transY));
-        if (blob.fTotalXError > kMinDiscernableTranslation ||
-            blob.fTotalYError > kMinDiscernableTranslation) {
-            SkDebugf("Exceeding error threshold for bitmap text translation");
-        }
-#endif
         (*outTransX) = transX;
         (*outTransY) = transY;
     } else if (blob.hasDistanceField()) {
index 1a24e80..c0b8b00 100644 (file)
@@ -193,10 +193,6 @@ private:
         SkTArray<BigGlyph> fBigGlyphs;
         Key fKey;
         SkMatrix fViewMatrix;
-#ifdef SK_DEBUG
-        mutable SkScalar fTotalXError;
-        mutable SkScalar fTotalYError;
-#endif
         SkColor fPaintColor;
         SkScalar fX;
         SkScalar fY;
index d2153bd..d66f432 100644 (file)
@@ -36,11 +36,6 @@ GrAtlasTextContext::BitmapTextBlob* GrTextBlobCache::createBlob(int glyphCount,
     }
     cacheBlob->fRunCount = runCount;
     cacheBlob->fPool = &fPool;
-
-#ifdef SK_DEBUG
-    cacheBlob->fTotalXError = 0;
-    cacheBlob->fTotalYError = 0;
-#endif
     return cacheBlob;
 }