remove (unused) scale parameter from measureText
authorreed <reed@google.com>
Tue, 26 Aug 2014 18:30:01 +0000 (11:30 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 26 Aug 2014 18:30:01 +0000 (11:30 -0700)
BUG=skia:
R=bungeman@google.com, djsollen@google.com

Author: reed@google.com

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

include/core/SkPaint.h
samplecode/SampleMeasure.cpp
src/core/SkPaint.cpp
tests/PaintTest.cpp

index 4d5c54ef589260bf1cdaa7a49065bca7529273d4..af5978d7b3fd41b1650af688e9fdf6ae54530a19 100644 (file)
@@ -862,12 +862,9 @@ public:
      *  @param length       Number of bytes of text to measure
      *  @param bounds       If not NULL, returns the bounds of the text,
      *                      relative to (0, 0).
-     *  @param scale        If not 0, return width as if the canvas were scaled
-     *                      by this value
      *  @return             The advance width of the text
      */
-    SkScalar measureText(const void* text, size_t length,
-                         SkRect* bounds, SkScalar scale = 0) const;
+    SkScalar measureText(const void* text, size_t length, SkRect* bounds) const;
 
     /** Return the width of the text. This will return the vertical measure
      *  if isVerticalText() is true, in which case the returned value should
@@ -878,7 +875,7 @@ public:
      *  @return         The advance width of the text
      */
     SkScalar measureText(const void* text, size_t length) const {
-        return this->measureText(text, length, NULL, 0);
+        return this->measureText(text, length, NULL);
     }
 
     /** Specify the direction the text buffer should be processed in breakText()
index 257f7d99e0ba9800afb047056eb94f5418ce2422..86f9b52516adfd49aaa7a11ac7560c66e065c68d 100644 (file)
 
 // exercise scale/linear/devkern
 struct Setting {
-    SkScalar    fScale;
     bool        fLinearText;
     bool        fDevKernText;
 };
 
-static const SkScalar ONE = SkIntToScalar(9999)/10000;
-
 static const Setting gSettings[] = {
-    { 0,            false,  false   },
-    { 0,            false,  true    },
-    { 0,            true,   false   },
-    { 0,            true,   true    },
-    { ONE,   false,  false   },
-    { ONE,   false,  true    },
-    { ONE,   true,   false   },
-    { ONE,   true,   true    }
+    { false,  false   },
+    { false,  true    },
+    { true,   false   },
+    { true,   true    },
 };
 
 static void doMeasure(SkCanvas* canvas, const SkPaint& paint, const char text[]) {
@@ -55,10 +48,9 @@ static void doMeasure(SkCanvas* canvas, const SkPaint& paint, const char text[])
     for (size_t i = 0; i < SK_ARRAY_COUNT(gSettings); i++) {
         p.setLinearText(gSettings[i].fLinearText);
         p.setDevKernText(gSettings[i].fDevKernText);
-        SkScalar scale = gSettings[i].fScale;
 
         int n = p.getTextWidths(text, len, widths, rects);
-        SkScalar w = p.measureText(text, len, &bounds, scale);
+        SkScalar w = p.measureText(text, len, &bounds);
 
         p.setStyle(SkPaint::kFill_Style);
         p.setColor(0x8888FF88);
index 954680b8dcb8a5eed5fb1eabac8139a8b1b1d6d8..d19efb0aa456bec8b00824df1a96afeb617eba97 100644 (file)
@@ -1100,8 +1100,7 @@ SkScalar SkPaint::measure_text(SkGlyphCache* cache,
     return Sk48Dot16ToScalar(x);
 }
 
-SkScalar SkPaint::measureText(const void* textData, size_t length,
-                              SkRect* bounds, SkScalar zoom) const {
+SkScalar SkPaint::measureText(const void* textData, size_t length, SkRect* bounds) const {
     const char* text = (const char*)textData;
     SkASSERT(text != NULL || length == 0);
 
@@ -1109,13 +1108,7 @@ SkScalar SkPaint::measureText(const void* textData, size_t length,
     const SkPaint& paint = canon.getPaint();
     SkScalar scale = canon.getScale();
 
-    SkMatrix zoomMatrix, *zoomPtr = NULL;
-    if (zoom) {
-        zoomMatrix.setScale(zoom, zoom);
-        zoomPtr = &zoomMatrix;
-    }
-
-    SkAutoGlyphCache    autoCache(paint, NULL, zoomPtr);
+    SkAutoGlyphCache    autoCache(paint, NULL, NULL);
     SkGlyphCache*       cache = autoCache.getCache();
 
     SkScalar width = 0;
index dbe701688d3907c7653ee2eff398fe64cb2c0443..51060577284c4dbc96643c1be033d08a48a710dc 100644 (file)
@@ -309,7 +309,7 @@ DEF_TEST(Paint_regression_measureText, reporter) {
     r.setLTRB(SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN);
 
     // test that the rect was reset
-    paint.measureText("", 0, &r, 1.0f);
+    paint.measureText("", 0, &r);
     REPORTER_ASSERT(reporter, r.isEmpty());
 }