fix for blur large glyphs problems
authorjoshualitt <joshualitt@chromium.org>
Wed, 13 May 2015 19:15:06 +0000 (12:15 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 13 May 2015 19:15:06 +0000 (12:15 -0700)
BUG=skia:

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

src/gpu/GrAtlasTextContext.cpp
src/gpu/SkGpuDevice.cpp

index 58244e78c212b7774309a3819129b4304a6cd9be..22436f7c1223a12c3f6927271473cc5ceea79ed0 100644 (file)
@@ -2147,13 +2147,24 @@ inline void GrAtlasTextContext::flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRend
                                                const SkPaint& skPaint,
                                                SkScalar transX, SkScalar transY,
                                                const SkIRect& clipBounds) {
+    if (!cacheBlob->fBigGlyphs.count()) {
+        return;
+    }
+
+    SkMatrix pathMatrix;
+    if (!cacheBlob->fViewMatrix.invert(&pathMatrix)) {
+        SkDebugf("could not invert viewmatrix\n");
+        return;
+    }
+
     for (int i = 0; i < cacheBlob->fBigGlyphs.count(); i++) {
         BitmapTextBlob::BigGlyph& bigGlyph = cacheBlob->fBigGlyphs[i];
         bigGlyph.fVx += transX;
         bigGlyph.fVy += transY;
-        SkMatrix translate;
-        translate.setTranslate(bigGlyph.fVx, bigGlyph.fVy);
-        fGpuDevice->internalDrawPath(bigGlyph.fPath, skPaint, SkMatrix::I(), &translate, clipBounds,
+        SkMatrix translate = cacheBlob->fViewMatrix;
+        translate.postTranslate(bigGlyph.fVx, bigGlyph.fVy);
+
+        fGpuDevice->internalDrawPath(bigGlyph.fPath, skPaint, translate, &pathMatrix, clipBounds,
                                      false);
     }
 }
index 7a50e0409cf016e0cfe3b360c0ab4076430830fb..7b363635e29369306f8eb49dbd0ec4b5bcb11b15 100644 (file)
@@ -785,9 +785,9 @@ void SkGpuDevice::internalDrawPath(const SkPath& origSrcPath, const SkPaint& pai
     SkMatrix viewMatrix = origViewMatrix;
 
     if (prePathMatrix) {
-        // stroking and path effects are supposed to be applied *after* the prePathMatrix.
-        // The pre-path-matrix also should not affect shadeing.
-        if (NULL == pathEffect && NULL == paint.getShader() &&
+        // stroking, path effects, and blurs are supposed to be applied *after* the prePathMatrix.
+        // The pre-path-matrix also should not affect shading.
+        if (NULL == paint.getMaskFilter() && NULL == pathEffect && NULL == paint.getShader() &&
             (strokeInfo.getStrokeRec().isFillStyle() ||
              strokeInfo.getStrokeRec().isHairlineStyle())) {
             viewMatrix.preConcat(*prePathMatrix);