use utils for deprecated TextAlign
Bug: skia:8493
Change-Id: Ie7162d6e9099ce6499f05024205bd39fdd944c2b
Reviewed-on: https://skia-review.googlesource.com/c/165300
Auto-Submit: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/samplecode/SampleAtlas.cpp b/samplecode/SampleAtlas.cpp
index a6ab820..28508cd 100644
--- a/samplecode/SampleAtlas.cpp
+++ b/samplecode/SampleAtlas.cpp
@@ -13,6 +13,7 @@
#include "SkRandom.h"
#include "SkRSXform.h"
#include "SkSurface.h"
+#include "SkTextUtils.h"
typedef void (*DrawAtlasProc)(SkCanvas*, SkImage*, const SkRSXform[], const SkRect[],
const SkColor[], int, const SkRect*, const SkPaint*);
@@ -50,14 +51,14 @@
const SkScalar half = cellSize * SK_ScalarHalf;
const char* s = "01234567890!@#$%^&*=+<>?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
paint.setTextSize(28);
- paint.setTextAlign(SkPaint::kCenter_Align);
int i = 0;
for (int y = 0; y < atlasSize; y += cellSize) {
for (int x = 0; x < atlasSize; x += cellSize) {
paint.setColor(rand.nextU());
paint.setAlpha(0xFF);
int index = i % strlen(s);
- canvas->drawText(&s[index], 1, x + half, y + half + half/2, paint);
+ SkTextUtils::DrawText(canvas, &s[index], 1, x + half, y + half + half/2, paint,
+ SkPaint::kCenter_Align);
i += 1;
}
}