Fix overoptimization in distance field code on N7 and N10.
authorjvanverth <jvanverth@google.com>
Fri, 5 Dec 2014 15:56:53 +0000 (07:56 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 5 Dec 2014 15:56:54 +0000 (07:56 -0800)
BUG=skia:3188

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

src/gpu/GrDistanceFieldTextContext.cpp

index e5374f2a45abcb0742c0a2c8942ee643a21bce34..5b679d1c80cad90fb80f7ba6d41a83137bbb51d8 100755 (executable)
@@ -519,32 +519,36 @@ bool GrDistanceFieldTextContext::appendGlyph(GrGlyph::PackedID packed,
         return true;
     }
 
-    if (NULL == glyph->fPlot && !uploadGlyph(glyph, scaler)) {
-        if (NULL == glyph->fPath) {
-            SkPath* path = SkNEW(SkPath);
-            if (!scaler->getGlyphPath(glyph->glyphID(), path)) {
-                // flag the glyph as being dead?
-                delete path;
-                return true;
+    if (NULL == glyph->fPlot) {
+        // needs to be a separate conditional to avoid over-optimization
+        // on Nexus 7 and Nexus 10
+        if (!uploadGlyph(glyph, scaler)) {
+            if (NULL == glyph->fPath) {
+                SkPath* path = SkNEW(SkPath);
+                if (!scaler->getGlyphPath(glyph->glyphID(), path)) {
+                    // flag the glyph as being dead?
+                    delete path;
+                    return true;
+                }
+                glyph->fPath = path;
             }
-            glyph->fPath = path;
-        }
 
-        // flush any accumulated draws before drawing this glyph as a path.
-        this->flush();
+            // flush any accumulated draws before drawing this glyph as a path.
+            this->flush();
 
-        GrContext::AutoMatrix am;
-        SkMatrix ctm;
-        ctm.setScale(fTextRatio, fTextRatio);
-        ctm.postTranslate(sx - dx, sy - dy);
-        GrPaint tmpPaint(fPaint);
-        am.setPreConcat(fContext, ctm, &tmpPaint);
-        GrStrokeInfo strokeInfo(SkStrokeRec::kFill_InitStyle);
-        fContext->drawPath(tmpPaint, *glyph->fPath, strokeInfo);
-
-        // remove this glyph from the vertices we need to allocate
-        fTotalVertexCount -= kVerticesPerGlyph;
-        return true;
+            GrContext::AutoMatrix am;
+            SkMatrix ctm;
+            ctm.setScale(fTextRatio, fTextRatio);
+            ctm.postTranslate(sx - dx, sy - dy);
+            GrPaint tmpPaint(fPaint);
+            am.setPreConcat(fContext, ctm, &tmpPaint);
+            GrStrokeInfo strokeInfo(SkStrokeRec::kFill_InitStyle);
+            fContext->drawPath(tmpPaint, *glyph->fPath, strokeInfo);
+
+            // remove this glyph from the vertices we need to allocate
+            fTotalVertexCount -= kVerticesPerGlyph;
+            return true;
+        }
     }
 
     SkASSERT(glyph->fPlot);