Loading libs/hwui/RecordingCanvas.h +8 −5 Original line number Diff line number Diff line Loading @@ -191,13 +191,16 @@ public: const SkPaint* paint) override; // Text virtual void drawGlyphs(const uint16_t* glyphs, const float* positions, int glyphCount, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int glyphCount, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; virtual bool drawTextAbsolutePos() const override { return false; } protected: virtual void drawGlyphs(const uint16_t* text, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; private: const ClipBase* getRecordedClip() { return mState.writableSnapshot()->mutateClipArea().serializeClip(alloc()); Loading libs/hwui/SkiaCanvas.cpp +9 −14 Original line number Diff line number Diff line Loading @@ -147,13 +147,6 @@ public: float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) override; virtual void drawGlyphs(const uint16_t* text, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; virtual bool drawTextAbsolutePos() const override { return true; } virtual void drawVectorDrawable(VectorDrawableRoot* vectorDrawable) override; Loading @@ -169,6 +162,14 @@ public: virtual void drawRenderNode(uirenderer::RenderNode* renderNode) override; virtual void callDrawGLFunction(Functor* functor) override; protected: virtual void drawGlyphs(const uint16_t* text, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; private: struct SaveRec { int saveCount; Loading Loading @@ -761,14 +762,8 @@ void SkiaCanvas::drawGlyphs(const uint16_t* text, const float* positions, int co const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) { // Set align to left for drawing, as we don't want individual // glyphs centered or right-aligned; the offset above takes // care of all alignment. SkPaint paintCopy(paint); paintCopy.setTextAlign(SkPaint::kLeft_Align); static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats"); mCanvas->drawPosText(text, count << 1, reinterpret_cast<const SkPoint*>(positions), paintCopy); mCanvas->drawPosText(text, count << 1, reinterpret_cast<const SkPoint*>(positions), paint); drawTextDecorations(x, y, totalAdvance, paint); } Loading libs/hwui/hwui/Canvas.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,11 @@ void Canvas::drawText(const uint16_t* text, int start, int count, int contextCou bounds.offset(x, y); } // Set align to left for drawing, as we don't want individual // glyphs centered or right-aligned; the offset above takes // care of all alignment. paint.setTextAlign(Paint::kLeft_Align); DrawTextFunctor f(layout, this, glyphs.get(), pos.get(), paint, x, y, bounds, layout.getAdvance()); MinikinUtils::forFontRun(layout, &paint, f); Loading libs/hwui/hwui/Canvas.h +17 −13 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ typedef uint32_t Flags; } // namespace SaveFlags namespace uirenderer { class SkiaCanvasProxy; namespace VectorDrawable { class Tree; }; Loading Loading @@ -205,19 +206,6 @@ public: float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) = 0; // Text /** * drawText: count is of glyphs * totalAdvance: used to define width of text decorations (underlines, strikethroughs). */ virtual void drawGlyphs(const uint16_t* glyphs, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) = 0; /** drawTextOnPath: count is of glyphs */ virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) = 0; /** * Specifies if the positions passed to ::drawText are absolute or relative * to the (x,y) value provided. Loading @@ -244,6 +232,22 @@ public: protected: void drawTextDecorations(float x, float y, float length, const SkPaint& paint); /** * drawText: count is of glyphs * totalAdvance: used to define width of text decorations (underlines, strikethroughs). */ virtual void drawGlyphs(const uint16_t* glyphs, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) = 0; /** drawTextOnPath: count is of glyphs */ virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) = 0; friend class DrawTextFunctor; friend class DrawTextOnPathFunctor; friend class uirenderer::SkiaCanvasProxy; }; }; // namespace android Loading libs/hwui/hwui/Paint.h +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ class ANDROID_API Paint : public SkPaint { public: Paint(); Paint(const Paint& paint); Paint(const SkPaint& paint); ~Paint(); Paint& operator=(const Paint& other); Loading Loading
libs/hwui/RecordingCanvas.h +8 −5 Original line number Diff line number Diff line Loading @@ -191,13 +191,16 @@ public: const SkPaint* paint) override; // Text virtual void drawGlyphs(const uint16_t* glyphs, const float* positions, int glyphCount, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int glyphCount, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; virtual bool drawTextAbsolutePos() const override { return false; } protected: virtual void drawGlyphs(const uint16_t* text, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; private: const ClipBase* getRecordedClip() { return mState.writableSnapshot()->mutateClipArea().serializeClip(alloc()); Loading
libs/hwui/SkiaCanvas.cpp +9 −14 Original line number Diff line number Diff line Loading @@ -147,13 +147,6 @@ public: float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) override; virtual void drawGlyphs(const uint16_t* text, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; virtual bool drawTextAbsolutePos() const override { return true; } virtual void drawVectorDrawable(VectorDrawableRoot* vectorDrawable) override; Loading @@ -169,6 +162,14 @@ public: virtual void drawRenderNode(uirenderer::RenderNode* renderNode) override; virtual void callDrawGLFunction(Functor* functor) override; protected: virtual void drawGlyphs(const uint16_t* text, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) override; virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) override; private: struct SaveRec { int saveCount; Loading Loading @@ -761,14 +762,8 @@ void SkiaCanvas::drawGlyphs(const uint16_t* text, const float* positions, int co const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) { // Set align to left for drawing, as we don't want individual // glyphs centered or right-aligned; the offset above takes // care of all alignment. SkPaint paintCopy(paint); paintCopy.setTextAlign(SkPaint::kLeft_Align); static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats"); mCanvas->drawPosText(text, count << 1, reinterpret_cast<const SkPoint*>(positions), paintCopy); mCanvas->drawPosText(text, count << 1, reinterpret_cast<const SkPoint*>(positions), paint); drawTextDecorations(x, y, totalAdvance, paint); } Loading
libs/hwui/hwui/Canvas.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,11 @@ void Canvas::drawText(const uint16_t* text, int start, int count, int contextCou bounds.offset(x, y); } // Set align to left for drawing, as we don't want individual // glyphs centered or right-aligned; the offset above takes // care of all alignment. paint.setTextAlign(Paint::kLeft_Align); DrawTextFunctor f(layout, this, glyphs.get(), pos.get(), paint, x, y, bounds, layout.getAdvance()); MinikinUtils::forFontRun(layout, &paint, f); Loading
libs/hwui/hwui/Canvas.h +17 −13 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ typedef uint32_t Flags; } // namespace SaveFlags namespace uirenderer { class SkiaCanvasProxy; namespace VectorDrawable { class Tree; }; Loading Loading @@ -205,19 +206,6 @@ public: float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) = 0; // Text /** * drawText: count is of glyphs * totalAdvance: used to define width of text decorations (underlines, strikethroughs). */ virtual void drawGlyphs(const uint16_t* glyphs, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) = 0; /** drawTextOnPath: count is of glyphs */ virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) = 0; /** * Specifies if the positions passed to ::drawText are absolute or relative * to the (x,y) value provided. Loading @@ -244,6 +232,22 @@ public: protected: void drawTextDecorations(float x, float y, float length, const SkPaint& paint); /** * drawText: count is of glyphs * totalAdvance: used to define width of text decorations (underlines, strikethroughs). */ virtual void drawGlyphs(const uint16_t* glyphs, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) = 0; /** drawTextOnPath: count is of glyphs */ virtual void drawGlyphsOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) = 0; friend class DrawTextFunctor; friend class DrawTextOnPathFunctor; friend class uirenderer::SkiaCanvasProxy; }; }; // namespace android Loading
libs/hwui/hwui/Paint.h +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ class ANDROID_API Paint : public SkPaint { public: Paint(); Paint(const Paint& paint); Paint(const SkPaint& paint); ~Paint(); Paint& operator=(const Paint& other); Loading