sed s/drawSimpleText/drawString/
for f in $(git grep -l drawSimpleText); do sed -i 's/wSimpleText(\([[:alnum:]]\), strlen(\1), kUTF8_SkTextEncoding,/wString(\1,/g' "$f" sed -i 's/wSimpleText(\([[:alnum:]]*\)\.c_str(), \1\.size(), kUTF8_SkTextEncoding,/wString(\1,/g' "$f" done git checkout @~ include/core/SkCanvas.h samplecode/SampleCusp.cpp git cl format Change-Id: Ibc0c3afd30f86465a645fadb26177d61919f57fd Reviewed-on: https://skia-review.googlesource.com/c/181561 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com> Auto-Submit: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
5d6be8f755
commit
89a644b635
@ -29,8 +29,7 @@ namespace {
|
||||
SkFont font;
|
||||
SkRect bounds;
|
||||
font.measureText(errorText.c_str(), errorText.size(), kUTF8_SkTextEncoding, &bounds);
|
||||
canvas->drawSimpleText(errorText.c_str(), errorText.size(), kUTF8_SkTextEncoding,
|
||||
kOffset, bounds.height() + kOffset, font, paint);
|
||||
canvas->drawString(errorText, kOffset, bounds.height() + kOffset, font, paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar
|
||||
SkString str;
|
||||
str.appendScalar(k[i]);
|
||||
SkScalar width = font.measureText(str.c_str(), str.size(), kUTF8_SkTextEncoding);
|
||||
canvas->drawSimpleText(str.c_str(), str.size(), kUTF8_SkTextEncoding, x, y + font.getSize(), font, paint);
|
||||
canvas->drawString(str, x, y + font.getSize(), font, paint);
|
||||
x += width + SkIntToScalar(10);
|
||||
}
|
||||
}
|
||||
|
@ -133,19 +133,17 @@ protected:
|
||||
// get the bounds of the text in order to position it
|
||||
labelFont.measureText(inputLabel.c_str(), inputLabel.size(),
|
||||
kUTF8_SkTextEncoding, &inputLabelBounds);
|
||||
canvas->drawSimpleText(inputLabel.c_str(), inputLabel.size(), kUTF8_SkTextEncoding,
|
||||
renderRect.fRight + kPad,
|
||||
-inputLabelBounds.fTop, labelFont, labelPaint);
|
||||
canvas->drawString(inputLabel, renderRect.fRight + kPad, -inputLabelBounds.fTop,
|
||||
labelFont, labelPaint);
|
||||
// update the bounds to reflect the offset we used to draw it.
|
||||
inputLabelBounds.offset(renderRect.fRight + kPad, -inputLabelBounds.fTop);
|
||||
|
||||
SkRect procLabelBounds;
|
||||
labelFont.measureText(procLabel.c_str(), procLabel.size(),
|
||||
kUTF8_SkTextEncoding, &procLabelBounds);
|
||||
canvas->drawSimpleText(procLabel.c_str(), procLabel.size(), kUTF8_SkTextEncoding,
|
||||
renderRect.fRight + kPad,
|
||||
inputLabelBounds.fBottom + 2.f - procLabelBounds.fTop,
|
||||
labelFont, labelPaint);
|
||||
canvas->drawString(procLabel, renderRect.fRight + kPad,
|
||||
inputLabelBounds.fBottom + 2.f - procLabelBounds.fTop,
|
||||
labelFont, labelPaint);
|
||||
procLabelBounds.offset(renderRect.fRight + kPad,
|
||||
inputLabelBounds.fBottom + 2.f - procLabelBounds.fTop);
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
static SkScalar draw_string(SkCanvas* canvas, const SkString& text, SkScalar x,
|
||||
SkScalar y, const SkFont& font) {
|
||||
SkPaint paint;
|
||||
canvas->drawSimpleText(text.c_str(), text.size(), kUTF8_SkTextEncoding, x, y, font, paint);
|
||||
canvas->drawString(text, x, y, font, paint);
|
||||
return x + font.measureText(text.c_str(), text.size(), kUTF8_SkTextEncoding);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
static SkScalar drawString(SkCanvas* canvas, const SkString& text, SkScalar x,
|
||||
SkScalar y, const SkFont& font) {
|
||||
canvas->drawSimpleText(text.c_str(), text.size(), kUTF8_SkTextEncoding, x, y, font, SkPaint());
|
||||
canvas->drawString(text, x, y, font, SkPaint());
|
||||
return x + font.measureText(text.c_str(), text.size(), kUTF8_SkTextEncoding);
|
||||
}
|
||||
|
||||
@ -277,8 +277,7 @@ public:
|
||||
if (FLAGS_veryVerbose) {
|
||||
SkString name;
|
||||
font.getTypeface()->getFamilyName(&name);
|
||||
canvas->drawSimpleText(name.c_str(), name.size(), kUTF8_SkTextEncoding,
|
||||
fontBounds.fLeft, fontBounds.fBottom, labelFont, SkPaint());
|
||||
canvas->drawString(name, fontBounds.fLeft, fontBounds.fBottom, labelFont, SkPaint());
|
||||
}
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(str); ++i) {
|
||||
SkPath path;
|
||||
@ -292,8 +291,7 @@ public:
|
||||
if (FLAGS_veryVerbose) {
|
||||
SkString glyphStr;
|
||||
glyphStr.appendS32(str[i]);
|
||||
canvas->drawSimpleText(glyphStr.c_str(), glyphStr.size(), kUTF8_SkTextEncoding,
|
||||
location[i].fX, location[i].fY, labelFont, SkPaint());
|
||||
canvas->drawString(glyphStr, location[i].fX, location[i].fY, labelFont, SkPaint());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ static void draw_row_label(SkCanvas* canvas, int y, int yuvFormat) {
|
||||
font.measureText(rowLabel.c_str(), rowLabel.size(), kUTF8_SkTextEncoding, &textRect);
|
||||
y += kTileWidthHeight/2 + textRect.height()/2;
|
||||
|
||||
canvas->drawSimpleText(rowLabel.c_str(), rowLabel.size(), kUTF8_SkTextEncoding, 0, y, font, paint);
|
||||
canvas->drawString(rowLabel, 0, y, font, paint);
|
||||
}
|
||||
|
||||
static GrBackendTexture create_yuva_texture(GrGpu* gpu, const SkBitmap& bm,
|
||||
|
@ -611,10 +611,9 @@ struct UniControl {
|
||||
canvas->drawLine(fBounds.fLeft - 5, fYLo, fBounds.fRight + 5, fYLo, paints.fIndicator);
|
||||
SkString label;
|
||||
label.printf("%0.3g", fValLo);
|
||||
canvas->drawSimpleText(label.c_str(), label.size(), kUTF8_SkTextEncoding,
|
||||
fBounds.fLeft + 5, fYLo - 5, paints.fValueFont, paints.fValue);
|
||||
canvas->drawSimpleText(fName.c_str(), fName.size(), kUTF8_SkTextEncoding,
|
||||
fBounds.fLeft, fBounds.bottom() + 11, paints.fLabelFont, paints.fLabel);
|
||||
canvas->drawString(label, fBounds.fLeft + 5, fYLo - 5, paints.fValueFont, paints.fValue);
|
||||
canvas->drawString(fName, fBounds.fLeft, fBounds.bottom() + 11, paints.fLabelFont,
|
||||
paints.fLabel);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -126,8 +126,7 @@ protected:
|
||||
|
||||
font.setSize(16);
|
||||
// canvas->drawString(outString, 512.f, 540.f, paint);
|
||||
canvas->drawSimpleText(modeString.c_str(), modeString.size(), kUTF8_SkTextEncoding,
|
||||
768.f, 540.f, font, paint);
|
||||
canvas->drawString(modeString, 768.f, 540.f, font, paint);
|
||||
}
|
||||
|
||||
bool onAnimate(const SkAnimTimer& timer) override {
|
||||
|
@ -69,8 +69,8 @@ protected:
|
||||
draw_gradient2(canvas, SkRect::MakeXYWH(l, t, w, h), delta);
|
||||
SkString txt;
|
||||
txt.appendf("gap at \"tangent\" pt = %f", SkScalarToFloat(delta));
|
||||
canvas->drawSimpleText(txt.c_str(), txt.size(), kUTF8_SkTextEncoding,
|
||||
l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, SkFont(), SkPaint());
|
||||
canvas->drawString(txt, l + w / 2 + w * DELTA_SCALE * delta, t + h + SK_Scalar1 * 10,
|
||||
SkFont(), SkPaint());
|
||||
}
|
||||
|
||||
bool onAnimate(const SkAnimTimer& timer) override {
|
||||
|
@ -122,16 +122,13 @@ protected:
|
||||
100.0f * totArea / ((float)kWidth*kHeight),
|
||||
fCurRandRect,
|
||||
kNumRandRects);
|
||||
canvas->drawSimpleText(str.c_str(), str.size(), kUTF8_SkTextEncoding,
|
||||
50, kHeight + 50, blackBigFont, SkPaint());
|
||||
canvas->drawString(str, 50, kHeight + 50, blackBigFont, SkPaint());
|
||||
|
||||
str.printf("Press \'j\' to toggle rectanizer");
|
||||
canvas->drawSimpleText(str.c_str(), str.size(), kUTF8_SkTextEncoding,
|
||||
50, kHeight + 100, blackBigFont, SkPaint());
|
||||
canvas->drawString(str, 50, kHeight + 100, blackBigFont, SkPaint());
|
||||
|
||||
str.printf("Press \'h\' to toggle rects");
|
||||
canvas->drawSimpleText(str.c_str(), str.size(), kUTF8_SkTextEncoding,
|
||||
50, kHeight + 150, blackBigFont, SkPaint());
|
||||
canvas->drawString(str, 50, kHeight + 150, blackBigFont, SkPaint());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -151,7 +151,7 @@ protected:
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawRect(SkRect::MakeXYWH(0, 0, 200, 24), paint);
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
canvas->drawSimpleText(outString.c_str(), outString.size(), kUTF8_SkTextEncoding, 5, 15, font, paint);
|
||||
canvas->drawString(outString, 5, 15, font, paint);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -155,8 +155,7 @@ protected:
|
||||
|
||||
SkString str("9");
|
||||
|
||||
canvas->drawSimpleText(str.c_str(), str.size(), kUTF8_SkTextEncoding,
|
||||
x, y, font, SkPaint());
|
||||
canvas->drawString(str, x, y, font, SkPaint());
|
||||
drawdots(canvas, str, x, y, font);
|
||||
|
||||
if (false) {
|
||||
|
@ -90,7 +90,7 @@ protected:
|
||||
} else {
|
||||
failure.printf("Failed to decode %s", fCurrFile.c_str());
|
||||
}
|
||||
canvas->drawSimpleText(failure.c_str(), failure.size(), kUTF8_SkTextEncoding, 0, height, font, paint);
|
||||
canvas->drawString(failure, 0, height, font, paint);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -98,16 +98,16 @@ protected:
|
||||
SkString header(SkOSPath::Basename(fCurrFile.c_str()));
|
||||
header.appendf(" [%dx%d] %s", fBitmap.width(), fBitmap.height(),
|
||||
(fPremul ? "premultiplied" : "unpremultiplied"));
|
||||
canvas->drawSimpleText(header.c_str(), header.size(), kUTF8_SkTextEncoding, 0, height, font, paint);
|
||||
canvas->drawString(header, 0, height, font, paint);
|
||||
canvas->translate(0, height);
|
||||
|
||||
// Help messages
|
||||
header.printf("Press '%c' to move to the next image.'", fNextImageChar);
|
||||
canvas->drawSimpleText(header.c_str(), header.size(), kUTF8_SkTextEncoding, 0, height, font, paint);
|
||||
canvas->drawString(header, 0, height, font, paint);
|
||||
canvas->translate(0, height);
|
||||
|
||||
header.printf("Press '%c' to toggle premultiplied decode.", fTogglePremulChar);
|
||||
canvas->drawSimpleText(header.c_str(), header.size(), kUTF8_SkTextEncoding, 0, height, font, paint);
|
||||
canvas->drawString(header, 0, height, font, paint);
|
||||
|
||||
// Now draw the image itself.
|
||||
canvas->translate(height * 2, height * 2);
|
||||
|
@ -431,8 +431,7 @@ static void test_copy_on_write(skiatest::Reporter* reporter, SkSurface* surface)
|
||||
EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0))
|
||||
EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, testRect, nullptr))
|
||||
EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, nullptr))
|
||||
EXPECT_COPY_ON_WRITE(drawSimpleText(testText.c_str(), testText.size(), kUTF8_SkTextEncoding, \
|
||||
0, 1, SkFont(), testPaint))
|
||||
EXPECT_COPY_ON_WRITE(drawString(testText, 0, 1, SkFont(), testPaint))
|
||||
}
|
||||
DEF_TEST(SurfaceCopyOnWrite, reporter) {
|
||||
test_copy_on_write(reporter, create_surface().get());
|
||||
|
@ -153,8 +153,7 @@ void CommandSet::drawHelp(SkCanvas* canvas) {
|
||||
canvas->drawSimpleText(cmd.fKeyName.c_str(), cmd.fKeyName.size(), kUTF8_SkTextEncoding,
|
||||
x, y, font, paint);
|
||||
SkString text = SkStringPrintf(": %s", cmd.fDescription.c_str());
|
||||
canvas->drawSimpleText(text.c_str(), text.size(), kUTF8_SkTextEncoding,
|
||||
x + keyWidth, y, font, paint);
|
||||
canvas->drawString(text, x + keyWidth, y, font, paint);
|
||||
y += font.getSize() + 2;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user