Loading libs/hwui/tests/common/TestUtils.cpp +1 −38 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include "DeferredLayerUpdater.h" #include "hwui/Paint.h" #include <SkClipStack.h> #include <minikin/Layout.h> #include <pipeline/skia/SkiaOpenGLPipeline.h> #include <pipeline/skia/SkiaVulkanPipeline.h> Loading @@ -27,7 +26,7 @@ #include <renderthread/VulkanManager.h> #include <utils/Unicode.h> #include <SkGlyphCache.h> #include "SkColorData.h" namespace android { namespace uirenderer { Loading Loading @@ -80,42 +79,6 @@ sp<DeferredLayerUpdater> TestUtils::createTextureLayerUpdater( return layerUpdater; } void TestUtils::layoutTextUnscaled(const SkPaint& paint, const char* text, std::vector<glyph_t>* outGlyphs, std::vector<float>* outPositions, float* outTotalAdvance, Rect* outBounds) { Rect bounds; float totalAdvance = 0; SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry); SkAutoGlyphCacheNoGamma autoCache(paint, &surfaceProps, &SkMatrix::I()); while (*text != '\0') { size_t nextIndex = 0; int32_t unichar = utf32_from_utf8_at(text, 4, 0, &nextIndex); text += nextIndex; glyph_t glyph = autoCache->unicharToGlyph(unichar); autoCache->unicharToGlyph(unichar); // push glyph and its relative position outGlyphs->push_back(glyph); outPositions->push_back(totalAdvance); outPositions->push_back(0); // compute bounds SkGlyph skGlyph = autoCache->getUnicharMetrics(unichar); Rect glyphBounds(skGlyph.fWidth, skGlyph.fHeight); glyphBounds.translate(totalAdvance + skGlyph.fLeft, skGlyph.fTop); bounds.unionWith(glyphBounds); // advance next character SkScalar skWidth; paint.getTextWidths(&glyph, sizeof(glyph), &skWidth, NULL); totalAdvance += skWidth; } *outBounds = bounds; *outTotalAdvance = totalAdvance; } void TestUtils::drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint& paint, float x, float y) { auto utf16 = asciiToUtf16(text); Loading libs/hwui/tests/common/TestUtils.h +0 −5 Original line number Diff line number Diff line Loading @@ -300,11 +300,6 @@ public: static SkColor interpolateColor(float fraction, SkColor start, SkColor end); static void layoutTextUnscaled(const SkPaint& paint, const char* text, std::vector<glyph_t>* outGlyphs, std::vector<float>* outPositions, float* outTotalAdvance, Rect* outBounds); static void drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint& paint, float x, float y); Loading Loading
libs/hwui/tests/common/TestUtils.cpp +1 −38 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include "DeferredLayerUpdater.h" #include "hwui/Paint.h" #include <SkClipStack.h> #include <minikin/Layout.h> #include <pipeline/skia/SkiaOpenGLPipeline.h> #include <pipeline/skia/SkiaVulkanPipeline.h> Loading @@ -27,7 +26,7 @@ #include <renderthread/VulkanManager.h> #include <utils/Unicode.h> #include <SkGlyphCache.h> #include "SkColorData.h" namespace android { namespace uirenderer { Loading Loading @@ -80,42 +79,6 @@ sp<DeferredLayerUpdater> TestUtils::createTextureLayerUpdater( return layerUpdater; } void TestUtils::layoutTextUnscaled(const SkPaint& paint, const char* text, std::vector<glyph_t>* outGlyphs, std::vector<float>* outPositions, float* outTotalAdvance, Rect* outBounds) { Rect bounds; float totalAdvance = 0; SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry); SkAutoGlyphCacheNoGamma autoCache(paint, &surfaceProps, &SkMatrix::I()); while (*text != '\0') { size_t nextIndex = 0; int32_t unichar = utf32_from_utf8_at(text, 4, 0, &nextIndex); text += nextIndex; glyph_t glyph = autoCache->unicharToGlyph(unichar); autoCache->unicharToGlyph(unichar); // push glyph and its relative position outGlyphs->push_back(glyph); outPositions->push_back(totalAdvance); outPositions->push_back(0); // compute bounds SkGlyph skGlyph = autoCache->getUnicharMetrics(unichar); Rect glyphBounds(skGlyph.fWidth, skGlyph.fHeight); glyphBounds.translate(totalAdvance + skGlyph.fLeft, skGlyph.fTop); bounds.unionWith(glyphBounds); // advance next character SkScalar skWidth; paint.getTextWidths(&glyph, sizeof(glyph), &skWidth, NULL); totalAdvance += skWidth; } *outBounds = bounds; *outTotalAdvance = totalAdvance; } void TestUtils::drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint& paint, float x, float y) { auto utf16 = asciiToUtf16(text); Loading
libs/hwui/tests/common/TestUtils.h +0 −5 Original line number Diff line number Diff line Loading @@ -300,11 +300,6 @@ public: static SkColor interpolateColor(float fraction, SkColor start, SkColor end); static void layoutTextUnscaled(const SkPaint& paint, const char* text, std::vector<glyph_t>* outGlyphs, std::vector<float>* outPositions, float* outTotalAdvance, Rect* outBounds); static void drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint& paint, float x, float y); Loading