aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-06-28 12:00:35 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-28 12:00:47 +0000
commit385804514edf602f978975c825b78692a044c6b9 (patch)
tree891790d5b77fa447c75ec9a25487ecd8ae22c332 /tests
parente97bb26893a1c24deeb38b818a1f4c1638a9983d (diff)
Revert "Remove drawTextBlob from device use drawGlyphRunList"
This reverts commit e2e52e46ca63540d429656baeee48fd3a402be26. Reason for revert: See if this is blocking the Chrome roll Original change's description: > Remove drawTextBlob from device use drawGlyphRunList > > Convert all backends to use GlyphRunList instead of > text blobs. If the device did not originally implement > drawTextBlob it will be simulated by drawPosText on the > device. > > Other changes: > Change to using an origin from absolulte positioning. The GPU > code uses origin change to update blobs under translation. > > Change cluster to use const uint32_t instead of just > uint32_t. > > Add SkPaint to runs. > > The draw filter is hosted up to the canavas level and applied there. > > Change-Id: Ib105b6bd26b67db55f1c954e37c79fbdcaa9d4a2 > Reviewed-on: https://skia-review.googlesource.com/137224 > Reviewed-by: Herb Derby <herb@google.com> > Reviewed-by: Khusal Sagar <khushalsagar@chromium.org> > Reviewed-by: Hal Canary <halcanary@google.com> > Reviewed-by: Jim Van Verth <jvanverth@google.com> > Commit-Queue: Herb Derby <herb@google.com> TBR=jvanverth@google.com,halcanary@google.com,bungeman@google.com,herb@google.com,reed@google.com,khushalsagar@chromium.org,khushalsagar@google.com Change-Id: I4d93a534990c89deee7d3aaa00ec40d47e0d2ece No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/138120 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GlyphRunTest.cpp4
-rw-r--r--tests/SkRemoteGlyphCacheTest.cpp46
2 files changed, 4 insertions, 46 deletions
diff --git a/tests/GlyphRunTest.cpp b/tests/GlyphRunTest.cpp
index 8107f2075c..cd2a221719 100644
--- a/tests/GlyphRunTest.cpp
+++ b/tests/GlyphRunTest.cpp
@@ -75,7 +75,7 @@ DEF_TEST(GlyphRunBlob, reporter) {
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
SkGlyphRunBuilder runBuilder;
- runBuilder.prepareTextBlob(font, *blob, SkPoint::Make(0, 0), nullptr);
+ runBuilder.prepareTextBlob(font, *blob, SkPoint::Make(0, 0));
auto runList = runBuilder.useGlyphRunList();
@@ -96,4 +96,4 @@ DEF_TEST(GlyphRunBlob, reporter) {
runIndex += 1;
}
-}
+} \ No newline at end of file
diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp
index 6986a7bb03..4a7bd86dc0 100644
--- a/tests/SkRemoteGlyphCacheTest.cpp
+++ b/tests/SkRemoteGlyphCacheTest.cpp
@@ -69,8 +69,6 @@ sk_sp<SkTextBlob> buildTextBlob(sk_sp<SkTypeface> tf, int glyphCount) {
font.setStyle(SkPaint::kFill_Style);
font.setHinting(SkPaint::kNormal_Hinting);
font.setTextSize(1u);
- font.setAntiAlias(true);
- font.setSubpixelText(true);
SkTextBlobBuilder builder;
SkRect bounds = SkRect::MakeWH(10, 10);
@@ -101,13 +99,12 @@ SkTextBlobCacheDiffCanvas::Settings MakeSettings(GrContext* context) {
}
SkBitmap RasterBlob(sk_sp<SkTextBlob> blob, int width, int height, const SkPaint& paint,
- GrContext* context, const SkMatrix* matrix = nullptr,
- SkScalar x = 0) {
+ GrContext* context, const SkMatrix* matrix = nullptr) {
const SkImageInfo info =
SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);
auto surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
if (matrix) surface->getCanvas()->concat(*matrix);
- surface->getCanvas()->drawTextBlob(blob.get(), x, 0, paint);
+ surface->getCanvas()->drawTextBlob(blob.get(), 0u, 0u, paint);
SkBitmap bitmap;
bitmap.allocN32Pixels(width, height);
surface->readPixels(bitmap, 0, 0);
@@ -335,45 +332,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsPath, reporter,
discardableManager->unlockAndDeleteAll();
}
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextXY, reporter, ctxInfo) {
- sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
- SkStrikeServer server(discardableManager.get());
- SkStrikeClient client(discardableManager, false);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setSubpixelText(true);
- paint.setLCDRenderText(true);
-
- // Server.
- auto serverTf = SkTypeface::MakeFromName("monospace", SkFontStyle());
- auto serverTfData = server.serializeTypeface(serverTf.get());
-
- int glyphCount = 10;
- auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
- SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, SkMatrix::I(), props, &server,
- MakeSettings(ctxInfo.grContext()));
- cache_diff_canvas.drawTextBlob(serverBlob.get(), 0.5, 0, paint);
-
- std::vector<uint8_t> serverStrikeData;
- server.writeStrikeData(&serverStrikeData);
-
- // Client.
- auto clientTf = client.deserializeTypeface(serverTfData->data(), serverTfData->size());
- REPORTER_ASSERT(reporter,
- client.readStrikeData(serverStrikeData.data(), serverStrikeData.size()));
- auto clientBlob = buildTextBlob(clientTf, glyphCount);
-
- SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, ctxInfo.grContext(), nullptr, 0.5);
- SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext(), nullptr, 0.5);
- COMPARE_BLOBS(expected, actual, reporter);
- REPORTER_ASSERT(reporter, !discardableManager->hasCacheMiss());
- SkStrikeCache::ValidateGlyphCacheDataSize();
-
- // Must unlock everything on termination, otherwise valgrind complains about memory leaks.
- discardableManager->unlockAndDeleteAll();
-}
-
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsDFT, reporter, ctxInfo) {
sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
SkStrikeServer server(discardableManager.get());