From dfe1fe40796ea5b61bba177488aa7eb63c9495cf Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Thu, 19 Jul 2018 11:07:44 -0400 Subject: Convert bitmap to use runs instead of blobs Adding the flag SK_SUPPORT_LEGACY_TEXT_BLOB to allow progress without rebaselining many times. Flag landed with chrome cl 1144232. Change-Id: I78ea100085be7db442b703d465533ceb9b124652 Reviewed-on: https://skia-review.googlesource.com/142580 Commit-Queue: Herb Derby Reviewed-by: Ben Wagner --- src/core/SkBitmapDevice.cpp | 17 +++++++++++++++++ src/core/SkBitmapDevice.h | 2 ++ src/core/SkDevice.cpp | 10 +--------- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 08c36d3980..cb169dca87 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -7,6 +7,7 @@ #include "SkBitmapDevice.h" #include "SkDraw.h" +#include "SkGlyphRun.h" #include "SkImageFilter.h" #include "SkImageFilterCache.h" #include "SkMallocPixelRef.h" @@ -570,6 +571,22 @@ void SkBitmapDevice::drawPosText(const void* text, size_t len, const SkScalar xp nullptr) } +void SkBitmapDevice::drawGlyphRunList(SkGlyphRunList* glyphRunList) { +#ifdef SK_SUPPORT_LEGACY_TEXT_BLOB + auto blob = glyphRunList->blob(); + + if (blob == nullptr) { + glyphRunList->temporaryShuntToDrawPosText(this, SkPoint::Make(0, 0)); + } else { + auto origin = glyphRunList->origin(); + auto paint = glyphRunList->paint(); + this->drawTextBlob(blob, origin.x(), origin.y(), paint); + } +#else + glyphRunList->temporaryShuntToDrawPosText(this, glyphRunList->origin()); +#endif +} + void SkBitmapDevice::drawVertices(const SkVertices* vertices, const SkMatrix* bones, int boneCount, SkBlendMode bmode, const SkPaint& paint) { BDDraw(this).drawVertices(vertices->mode(), vertices->vertexCount(), vertices->positions(), diff --git a/src/core/SkBitmapDevice.h b/src/core/SkBitmapDevice.h index 5c4af03ab5..890f7e1934 100644 --- a/src/core/SkBitmapDevice.h +++ b/src/core/SkBitmapDevice.h @@ -112,6 +112,8 @@ protected: */ void drawPosText(const void* text, size_t len, const SkScalar pos[], int scalarsPerPos, const SkPoint& offset, const SkPaint& paint) override; + + void drawGlyphRunList(SkGlyphRunList* glyphRunList) override; void drawVertices(const SkVertices*, const SkMatrix* bones, int boneCount, SkBlendMode, const SkPaint& paint) override; void drawDevice(SkBaseDevice*, int x, int y, const SkPaint&) override; diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 60f8cd861f..b94d7e97cf 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -240,15 +240,7 @@ void SkBaseDevice::drawImageLattice(const SkImage* image, } void SkBaseDevice::drawGlyphRunList(SkGlyphRunList* glyphRunList) { - auto blob = glyphRunList->blob(); - - if (blob == nullptr) { - glyphRunList->temporaryShuntToDrawPosText(this, SkPoint::Make(0, 0)); - } else { - auto origin = glyphRunList->origin(); - auto paint = glyphRunList->paint(); - this->drawTextBlob(blob, origin.x(), origin.y(), paint); - } + glyphRunList->temporaryShuntToDrawPosText(this, SkPoint::Make(0, 0)); } void SkBaseDevice::drawBitmapLattice(const SkBitmap& bitmap, -- cgit v1.2.3