Loading libs/hwui/DisplayListOps.in +1 −0 Original line number Diff line number Diff line Loading @@ -49,3 +49,4 @@ X(DrawVertices) X(DrawAtlas) X(DrawShadowRec) X(DrawVectorDrawable) X(DrawWebView) libs/hwui/RecordingCanvas.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include "RecordingCanvas.h" #include "pipeline/skia/FunctorDrawable.h" #include "VectorDrawable.h" #include "SkAndroidFrameworkUtils.h" Loading Loading @@ -496,6 +497,16 @@ struct DrawVectorDrawable final : Op { SkPaint paint; BitmapPalette palette; }; struct DrawWebView final : Op { static const auto kType = Type::DrawWebView; DrawWebView(skiapipeline::FunctorDrawable* drawable) : drawable(sk_ref_sp(drawable)) {} sk_sp<skiapipeline::FunctorDrawable> drawable; // We can't invoke SkDrawable::draw directly, because VkFunctorDrawable expects // SkDrawable::onSnapGpuDrawHandler callback instead of SkDrawable::onDraw. // SkCanvas::drawDrawable/SkGpuDevice::drawDrawable has the logic to invoke // onSnapGpuDrawHandler. void draw(SkCanvas* c, const SkMatrix&) const { c->drawDrawable(drawable.get()); } }; } template <typename T, typename... Args> Loading Loading @@ -680,6 +691,9 @@ void DisplayListData::drawShadowRec(const SkPath& path, const SkDrawShadowRec& r void DisplayListData::drawVectorDrawable(VectorDrawableRoot* tree) { this->push<DrawVectorDrawable>(0, tree); } void DisplayListData::drawWebView(skiapipeline::FunctorDrawable* drawable) { this->push<DrawWebView>(0, drawable); } typedef void (*draw_fn)(const void*, SkCanvas*, const SkMatrix&); typedef void (*void_fn)(const void*); Loading Loading @@ -986,5 +1000,9 @@ void RecordingCanvas::drawVectorDrawable(VectorDrawableRoot* tree) { fDL->drawVectorDrawable(tree); } void RecordingCanvas::drawWebView(skiapipeline::FunctorDrawable* drawable) { fDL->drawWebView(drawable); } } // namespace uirenderer } // namespace android libs/hwui/RecordingCanvas.h +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,10 @@ namespace android { namespace uirenderer { namespace skiapipeline { class FunctorDrawable; } enum class DisplayListOpType : uint8_t { #define X(T) T, #include "DisplayListOps.in" Loading Loading @@ -119,6 +123,7 @@ private: SkBlendMode, const SkRect*, const SkPaint*); void drawShadowRec(const SkPath&, const SkDrawShadowRec&); void drawVectorDrawable(VectorDrawableRoot* tree); void drawWebView(skiapipeline::FunctorDrawable*); template <typename T, typename... Args> void* push(size_t, Args&&...); Loading Loading @@ -203,6 +208,7 @@ public: void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; void drawVectorDrawable(VectorDrawableRoot* tree); void drawWebView(skiapipeline::FunctorDrawable*); /** * If "isClipMayBeComplex" returns false, it is guaranteed the current clip is a rectangle. Loading libs/hwui/pipeline/skia/SkiaRecordingCanvas.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,7 @@ void SkiaRecordingCanvas::drawWebViewFunctor(int functor) { functorDrawable = mDisplayList->allocateDrawable<GLFunctorDrawable>(functor, asSkCanvas()); } mDisplayList->mChildFunctors.push_back(functorDrawable); drawDrawable(functorDrawable); mRecorder.drawWebView(functorDrawable); #endif } Loading Loading
libs/hwui/DisplayListOps.in +1 −0 Original line number Diff line number Diff line Loading @@ -49,3 +49,4 @@ X(DrawVertices) X(DrawAtlas) X(DrawShadowRec) X(DrawVectorDrawable) X(DrawWebView)
libs/hwui/RecordingCanvas.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include "RecordingCanvas.h" #include "pipeline/skia/FunctorDrawable.h" #include "VectorDrawable.h" #include "SkAndroidFrameworkUtils.h" Loading Loading @@ -496,6 +497,16 @@ struct DrawVectorDrawable final : Op { SkPaint paint; BitmapPalette palette; }; struct DrawWebView final : Op { static const auto kType = Type::DrawWebView; DrawWebView(skiapipeline::FunctorDrawable* drawable) : drawable(sk_ref_sp(drawable)) {} sk_sp<skiapipeline::FunctorDrawable> drawable; // We can't invoke SkDrawable::draw directly, because VkFunctorDrawable expects // SkDrawable::onSnapGpuDrawHandler callback instead of SkDrawable::onDraw. // SkCanvas::drawDrawable/SkGpuDevice::drawDrawable has the logic to invoke // onSnapGpuDrawHandler. void draw(SkCanvas* c, const SkMatrix&) const { c->drawDrawable(drawable.get()); } }; } template <typename T, typename... Args> Loading Loading @@ -680,6 +691,9 @@ void DisplayListData::drawShadowRec(const SkPath& path, const SkDrawShadowRec& r void DisplayListData::drawVectorDrawable(VectorDrawableRoot* tree) { this->push<DrawVectorDrawable>(0, tree); } void DisplayListData::drawWebView(skiapipeline::FunctorDrawable* drawable) { this->push<DrawWebView>(0, drawable); } typedef void (*draw_fn)(const void*, SkCanvas*, const SkMatrix&); typedef void (*void_fn)(const void*); Loading Loading @@ -986,5 +1000,9 @@ void RecordingCanvas::drawVectorDrawable(VectorDrawableRoot* tree) { fDL->drawVectorDrawable(tree); } void RecordingCanvas::drawWebView(skiapipeline::FunctorDrawable* drawable) { fDL->drawWebView(drawable); } } // namespace uirenderer } // namespace android
libs/hwui/RecordingCanvas.h +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,10 @@ namespace android { namespace uirenderer { namespace skiapipeline { class FunctorDrawable; } enum class DisplayListOpType : uint8_t { #define X(T) T, #include "DisplayListOps.in" Loading Loading @@ -119,6 +123,7 @@ private: SkBlendMode, const SkRect*, const SkPaint*); void drawShadowRec(const SkPath&, const SkDrawShadowRec&); void drawVectorDrawable(VectorDrawableRoot* tree); void drawWebView(skiapipeline::FunctorDrawable*); template <typename T, typename... Args> void* push(size_t, Args&&...); Loading Loading @@ -203,6 +208,7 @@ public: void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; void drawVectorDrawable(VectorDrawableRoot* tree); void drawWebView(skiapipeline::FunctorDrawable*); /** * If "isClipMayBeComplex" returns false, it is guaranteed the current clip is a rectangle. Loading
libs/hwui/pipeline/skia/SkiaRecordingCanvas.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,7 @@ void SkiaRecordingCanvas::drawWebViewFunctor(int functor) { functorDrawable = mDisplayList->allocateDrawable<GLFunctorDrawable>(functor, asSkCanvas()); } mDisplayList->mChildFunctors.push_back(functorDrawable); drawDrawable(functorDrawable); mRecorder.drawWebView(functorDrawable); #endif } Loading