Loading libs/hwui/BakedOpDispatcher.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -201,8 +201,7 @@ static void renderTextShadow(BakedOpRenderer& renderer, FontRenderer& fontRender renderer.caches().dropShadowCache.setFontRenderer(fontRenderer); ShadowTexture* texture = renderer.caches().dropShadowCache.get( op.paint, (const char*) op.glyphs, op.glyphCount, textShadow.radius, op.positions); op.paint, op.glyphs, op.glyphCount, textShadow.radius, op.positions); // If the drop shadow exceeds the max texture size or couldn't be // allocated, skip drawing if (!texture) return; Loading Loading @@ -277,8 +276,7 @@ static void renderTextOp(BakedOpRenderer& renderer, const TextOp& op, const Bake bool forceFinish = (renderType == TextRenderType::Flush); bool mustDirtyRenderTarget = renderer.offscreenRenderTarget(); const Rect* localOpClip = pureTranslate ? &state.computedState.clipRect() : nullptr; fontRenderer.renderPosText(op.paint, localOpClip, (const char*) op.glyphs, op.glyphCount, x, y, fontRenderer.renderPosText(op.paint, localOpClip, op.glyphs, op.glyphCount, x, y, op.positions, mustDirtyRenderTarget ? &layerBounds : nullptr, &functor, forceFinish); if (mustDirtyRenderTarget) { Loading Loading @@ -701,8 +699,7 @@ void BakedOpDispatcher::onTextOnPathOp(BakedOpRenderer& renderer, const TextOnPa bool mustDirtyRenderTarget = renderer.offscreenRenderTarget(); const Rect localSpaceClip = state.computedState.computeLocalSpaceClip(); if (fontRenderer.renderTextOnPath(op.paint, &localSpaceClip, reinterpret_cast<const char*>(op.glyphs), op.glyphCount, if (fontRenderer.renderTextOnPath(op.paint, &localSpaceClip, op.glyphs, op.glyphCount, op.path, op.hOffset, op.vOffset, mustDirtyRenderTarget ? &layerBounds : nullptr, &functor)) { if (mustDirtyRenderTarget) { Loading libs/hwui/DisplayListCanvas.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -428,7 +428,7 @@ void DisplayListCanvas::drawTextOnPath(const uint16_t* glyphs, int count, if (!glyphs || count <= 0) return; int bytesCount = 2 * count; DrawOp* op = new (alloc()) DrawTextOnPathOp(refText((const char*) glyphs, bytesCount), DrawOp* op = new (alloc()) DrawTextOnPathOp(refBuffer<glyph_t>(glyphs, count), bytesCount, count, refPath(&path), hOffset, vOffset, refPaint(&paint)); addDrawOp(op); Loading @@ -442,11 +442,10 @@ void DisplayListCanvas::drawText(const uint16_t* glyphs, const float* positions, if (!glyphs || count <= 0 || PaintUtils::paintWillNotDrawText(paint)) return; int bytesCount = count * 2; const char* text = refText((const char*) glyphs, bytesCount); positions = refBuffer<float>(positions, count * 2); Rect bounds(boundsLeft, boundsTop, boundsRight, boundsBottom); DrawOp* op = new (alloc()) DrawTextOp(text, bytesCount, count, DrawOp* op = new (alloc()) DrawTextOp(refBuffer<glyph_t>(glyphs, count), bytesCount, count, x, y, positions, refPaint(&paint), totalAdvance, bounds); addDrawOp(op); drawTextDecorations(x, y, totalAdvance, paint); Loading libs/hwui/DisplayListCanvas.h +0 −4 Original line number Diff line number Diff line Loading @@ -256,10 +256,6 @@ private: return dstBuffer; } inline char* refText(const char* text, size_t byteLength) { return (char*) refBuffer<uint8_t>((uint8_t*)text, byteLength); } inline const SkPath* refPath(const SkPath* path) { if (!path) return nullptr; Loading libs/hwui/DisplayListOp.h +5 −5 Original line number Diff line number Diff line Loading @@ -1229,7 +1229,7 @@ public: class DrawSomeTextOp : public DrawOp { public: DrawSomeTextOp(const char* text, int bytesCount, int count, const SkPaint* paint) DrawSomeTextOp(const glyph_t* text, int bytesCount, int count, const SkPaint* paint) : DrawOp(paint), mText(text), mBytesCount(bytesCount), mCount(count) {}; virtual void output(int level, uint32_t logFlags) const override { Loading @@ -1251,14 +1251,14 @@ public: } protected: const char* mText; const glyph_t* mText; int mBytesCount; int mCount; }; class DrawTextOnPathOp : public DrawSomeTextOp { public: DrawTextOnPathOp(const char* text, int bytesCount, int count, DrawTextOnPathOp(const glyph_t* text, int bytesCount, int count, const SkPath* path, float hOffset, float vOffset, const SkPaint* paint) : DrawSomeTextOp(text, bytesCount, count, paint), mPath(path), mHOffset(hOffset), mVOffset(vOffset) { Loading @@ -1280,7 +1280,7 @@ private: class DrawTextOp : public DrawStrokableOp { public: DrawTextOp(const char* text, int bytesCount, int count, float x, float y, DrawTextOp(const glyph_t* text, int bytesCount, int count, float x, float y, const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds) : DrawStrokableOp(bounds, paint), mText(text), mBytesCount(bytesCount), mCount(count), mX(x), mY(y), mPositions(positions), mTotalAdvance(totalAdvance) { Loading Loading @@ -1341,7 +1341,7 @@ public: virtual const char* name() override { return "DrawText"; } private: const char* mText; const glyph_t* mText; int mBytesCount; int mCount; float mX; Loading libs/hwui/FontRenderer.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -557,7 +557,7 @@ void FontRenderer::setFont(const SkPaint* paint, const SkMatrix& matrix) { mCurrentFont = Font::create(this, paint, matrix); } FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, const char *text, FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, const glyph_t *glyphs, int numGlyphs, float radius, const float* positions) { checkInit(); Loading @@ -577,7 +577,7 @@ FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, co mBounds = nullptr; Rect bounds; mCurrentFont->measure(paint, text, numGlyphs, &bounds, positions); mCurrentFont->measure(paint, glyphs, numGlyphs, &bounds, positions); uint32_t intRadius = Blur::convertRadiusToInt(radius); uint32_t paddedWidth = (uint32_t) (bounds.right - bounds.left) + 2 * intRadius; Loading Loading @@ -609,7 +609,7 @@ FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, co // text has non-whitespace, so draw and blur to create the shadow // NOTE: bounds.isEmpty() can't be used here, since vertical coordinates are inverted // TODO: don't draw pure whitespace in the first place, and avoid needing this check mCurrentFont->render(paint, text, numGlyphs, penX, penY, mCurrentFont->render(paint, glyphs, numGlyphs, penX, penY, Font::BITMAP, dataBuffer, paddedWidth, paddedHeight, nullptr, positions); // Unbind any PBO we might have used Loading Loading @@ -643,17 +643,17 @@ void FontRenderer::finishRender() { issueDrawCommand(); } void FontRenderer::precache(const SkPaint* paint, const char* text, int numGlyphs, void FontRenderer::precache(const SkPaint* paint, const glyph_t* glyphs, int numGlyphs, const SkMatrix& matrix) { Font* font = Font::create(this, paint, matrix); font->precache(paint, text, numGlyphs); font->precache(paint, glyphs, numGlyphs); } void FontRenderer::endPrecaching() { checkTextureUpdate(); } bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const char *text, bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const glyph_t* glyphs, int numGlyphs, int x, int y, const float* positions, Rect* bounds, TextDrawFunctor* functor, bool forceFinish) { if (!mCurrentFont) { Loading @@ -662,7 +662,7 @@ bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const c } initRender(clip, bounds, functor); mCurrentFont->render(paint, text, numGlyphs, x, y, positions); mCurrentFont->render(paint, glyphs, numGlyphs, x, y, positions); if (forceFinish) { finishRender(); Loading @@ -671,7 +671,7 @@ bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const c return mDrawn; } bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, const char *text, bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, const glyph_t* glyphs, int numGlyphs, const SkPath* path, float hOffset, float vOffset, Rect* bounds, TextDrawFunctor* functor) { if (!mCurrentFont) { Loading @@ -680,7 +680,7 @@ bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, cons } initRender(clip, bounds, functor); mCurrentFont->render(paint, text, numGlyphs, path, hOffset, vOffset); mCurrentFont->render(paint, glyphs, numGlyphs, path, hOffset, vOffset); finishRender(); return mDrawn; Loading Loading
libs/hwui/BakedOpDispatcher.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -201,8 +201,7 @@ static void renderTextShadow(BakedOpRenderer& renderer, FontRenderer& fontRender renderer.caches().dropShadowCache.setFontRenderer(fontRenderer); ShadowTexture* texture = renderer.caches().dropShadowCache.get( op.paint, (const char*) op.glyphs, op.glyphCount, textShadow.radius, op.positions); op.paint, op.glyphs, op.glyphCount, textShadow.radius, op.positions); // If the drop shadow exceeds the max texture size or couldn't be // allocated, skip drawing if (!texture) return; Loading Loading @@ -277,8 +276,7 @@ static void renderTextOp(BakedOpRenderer& renderer, const TextOp& op, const Bake bool forceFinish = (renderType == TextRenderType::Flush); bool mustDirtyRenderTarget = renderer.offscreenRenderTarget(); const Rect* localOpClip = pureTranslate ? &state.computedState.clipRect() : nullptr; fontRenderer.renderPosText(op.paint, localOpClip, (const char*) op.glyphs, op.glyphCount, x, y, fontRenderer.renderPosText(op.paint, localOpClip, op.glyphs, op.glyphCount, x, y, op.positions, mustDirtyRenderTarget ? &layerBounds : nullptr, &functor, forceFinish); if (mustDirtyRenderTarget) { Loading Loading @@ -701,8 +699,7 @@ void BakedOpDispatcher::onTextOnPathOp(BakedOpRenderer& renderer, const TextOnPa bool mustDirtyRenderTarget = renderer.offscreenRenderTarget(); const Rect localSpaceClip = state.computedState.computeLocalSpaceClip(); if (fontRenderer.renderTextOnPath(op.paint, &localSpaceClip, reinterpret_cast<const char*>(op.glyphs), op.glyphCount, if (fontRenderer.renderTextOnPath(op.paint, &localSpaceClip, op.glyphs, op.glyphCount, op.path, op.hOffset, op.vOffset, mustDirtyRenderTarget ? &layerBounds : nullptr, &functor)) { if (mustDirtyRenderTarget) { Loading
libs/hwui/DisplayListCanvas.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -428,7 +428,7 @@ void DisplayListCanvas::drawTextOnPath(const uint16_t* glyphs, int count, if (!glyphs || count <= 0) return; int bytesCount = 2 * count; DrawOp* op = new (alloc()) DrawTextOnPathOp(refText((const char*) glyphs, bytesCount), DrawOp* op = new (alloc()) DrawTextOnPathOp(refBuffer<glyph_t>(glyphs, count), bytesCount, count, refPath(&path), hOffset, vOffset, refPaint(&paint)); addDrawOp(op); Loading @@ -442,11 +442,10 @@ void DisplayListCanvas::drawText(const uint16_t* glyphs, const float* positions, if (!glyphs || count <= 0 || PaintUtils::paintWillNotDrawText(paint)) return; int bytesCount = count * 2; const char* text = refText((const char*) glyphs, bytesCount); positions = refBuffer<float>(positions, count * 2); Rect bounds(boundsLeft, boundsTop, boundsRight, boundsBottom); DrawOp* op = new (alloc()) DrawTextOp(text, bytesCount, count, DrawOp* op = new (alloc()) DrawTextOp(refBuffer<glyph_t>(glyphs, count), bytesCount, count, x, y, positions, refPaint(&paint), totalAdvance, bounds); addDrawOp(op); drawTextDecorations(x, y, totalAdvance, paint); Loading
libs/hwui/DisplayListCanvas.h +0 −4 Original line number Diff line number Diff line Loading @@ -256,10 +256,6 @@ private: return dstBuffer; } inline char* refText(const char* text, size_t byteLength) { return (char*) refBuffer<uint8_t>((uint8_t*)text, byteLength); } inline const SkPath* refPath(const SkPath* path) { if (!path) return nullptr; Loading
libs/hwui/DisplayListOp.h +5 −5 Original line number Diff line number Diff line Loading @@ -1229,7 +1229,7 @@ public: class DrawSomeTextOp : public DrawOp { public: DrawSomeTextOp(const char* text, int bytesCount, int count, const SkPaint* paint) DrawSomeTextOp(const glyph_t* text, int bytesCount, int count, const SkPaint* paint) : DrawOp(paint), mText(text), mBytesCount(bytesCount), mCount(count) {}; virtual void output(int level, uint32_t logFlags) const override { Loading @@ -1251,14 +1251,14 @@ public: } protected: const char* mText; const glyph_t* mText; int mBytesCount; int mCount; }; class DrawTextOnPathOp : public DrawSomeTextOp { public: DrawTextOnPathOp(const char* text, int bytesCount, int count, DrawTextOnPathOp(const glyph_t* text, int bytesCount, int count, const SkPath* path, float hOffset, float vOffset, const SkPaint* paint) : DrawSomeTextOp(text, bytesCount, count, paint), mPath(path), mHOffset(hOffset), mVOffset(vOffset) { Loading @@ -1280,7 +1280,7 @@ private: class DrawTextOp : public DrawStrokableOp { public: DrawTextOp(const char* text, int bytesCount, int count, float x, float y, DrawTextOp(const glyph_t* text, int bytesCount, int count, float x, float y, const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds) : DrawStrokableOp(bounds, paint), mText(text), mBytesCount(bytesCount), mCount(count), mX(x), mY(y), mPositions(positions), mTotalAdvance(totalAdvance) { Loading Loading @@ -1341,7 +1341,7 @@ public: virtual const char* name() override { return "DrawText"; } private: const char* mText; const glyph_t* mText; int mBytesCount; int mCount; float mX; Loading
libs/hwui/FontRenderer.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -557,7 +557,7 @@ void FontRenderer::setFont(const SkPaint* paint, const SkMatrix& matrix) { mCurrentFont = Font::create(this, paint, matrix); } FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, const char *text, FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, const glyph_t *glyphs, int numGlyphs, float radius, const float* positions) { checkInit(); Loading @@ -577,7 +577,7 @@ FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, co mBounds = nullptr; Rect bounds; mCurrentFont->measure(paint, text, numGlyphs, &bounds, positions); mCurrentFont->measure(paint, glyphs, numGlyphs, &bounds, positions); uint32_t intRadius = Blur::convertRadiusToInt(radius); uint32_t paddedWidth = (uint32_t) (bounds.right - bounds.left) + 2 * intRadius; Loading Loading @@ -609,7 +609,7 @@ FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, co // text has non-whitespace, so draw and blur to create the shadow // NOTE: bounds.isEmpty() can't be used here, since vertical coordinates are inverted // TODO: don't draw pure whitespace in the first place, and avoid needing this check mCurrentFont->render(paint, text, numGlyphs, penX, penY, mCurrentFont->render(paint, glyphs, numGlyphs, penX, penY, Font::BITMAP, dataBuffer, paddedWidth, paddedHeight, nullptr, positions); // Unbind any PBO we might have used Loading Loading @@ -643,17 +643,17 @@ void FontRenderer::finishRender() { issueDrawCommand(); } void FontRenderer::precache(const SkPaint* paint, const char* text, int numGlyphs, void FontRenderer::precache(const SkPaint* paint, const glyph_t* glyphs, int numGlyphs, const SkMatrix& matrix) { Font* font = Font::create(this, paint, matrix); font->precache(paint, text, numGlyphs); font->precache(paint, glyphs, numGlyphs); } void FontRenderer::endPrecaching() { checkTextureUpdate(); } bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const char *text, bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const glyph_t* glyphs, int numGlyphs, int x, int y, const float* positions, Rect* bounds, TextDrawFunctor* functor, bool forceFinish) { if (!mCurrentFont) { Loading @@ -662,7 +662,7 @@ bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const c } initRender(clip, bounds, functor); mCurrentFont->render(paint, text, numGlyphs, x, y, positions); mCurrentFont->render(paint, glyphs, numGlyphs, x, y, positions); if (forceFinish) { finishRender(); Loading @@ -671,7 +671,7 @@ bool FontRenderer::renderPosText(const SkPaint* paint, const Rect* clip, const c return mDrawn; } bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, const char *text, bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, const glyph_t* glyphs, int numGlyphs, const SkPath* path, float hOffset, float vOffset, Rect* bounds, TextDrawFunctor* functor) { if (!mCurrentFont) { Loading @@ -680,7 +680,7 @@ bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, cons } initRender(clip, bounds, functor); mCurrentFont->render(paint, text, numGlyphs, path, hOffset, vOffset); mCurrentFont->render(paint, glyphs, numGlyphs, path, hOffset, vOffset); finishRender(); return mDrawn; Loading