Loading libs/hwui/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -23,7 +23,10 @@ hwui_src_files := \ pipeline/skia/RenderNodeDrawable.cpp \ pipeline/skia/ReorderBarrierDrawables.cpp \ pipeline/skia/SkiaDisplayList.cpp \ pipeline/skia/SkiaOpenGLPipeline.cpp \ pipeline/skia/SkiaPipeline.cpp \ pipeline/skia/SkiaRecordingCanvas.cpp \ pipeline/skia/SkiaVulkanPipeline.cpp \ renderstate/Blend.cpp \ renderstate/MeshState.cpp \ renderstate/OffscreenBufferPool.cpp \ Loading Loading @@ -296,6 +299,7 @@ LOCAL_SRC_FILES += \ tests/unit/RenderPropertiesTests.cpp \ tests/unit/SkiaBehaviorTests.cpp \ tests/unit/SkiaDisplayListTests.cpp \ tests/unit/SkiaPipelineTests.cpp \ tests/unit/SkiaCanvasTests.cpp \ tests/unit/SnapshotTests.cpp \ tests/unit/StringUtilsTests.cpp \ Loading libs/hwui/DeviceInfo.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,13 @@ void DeviceInfo::initialize() { }); } void DeviceInfo::initialize(int maxTextureSize) { std::call_once(sInitializedFlag, [maxTextureSize]() { sDeviceInfo = new DeviceInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; }); } void DeviceInfo::load() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); } Loading libs/hwui/DeviceInfo.h +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ public: // only call this after GL has been initialized, or at any point if compiled // with HWUI_NULL_GPU static void initialize(); static void initialize(int maxTextureSize); int maxTextureSize() const { return mMaxTextureSize; } Loading libs/hwui/RenderNode.h +21 −9 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "Matrix.h" #include "RenderProperties.h" #include "pipeline/skia/SkiaDisplayList.h" #include "pipeline/skia/SkiaLayer.h" #include <vector> Loading Loading @@ -60,10 +61,6 @@ namespace proto { class RenderNode; } namespace skiapipeline { class SkiaDisplayList; } /** * Primary class for storing recorded canvas commands, as well as per-View/ViewGroup display properties. * Loading Loading @@ -312,14 +309,23 @@ public: * Returns true if an offscreen layer from any renderPipeline is attached * to this node. */ bool hasLayer() const { return mLayer || mLayerSurface.get(); } bool hasLayer() const { return mLayer || mSkiaLayer.get(); } /** * Used by the RenderPipeline to attach an offscreen surface to the RenderNode. * The surface is then will be used to store the contents of a layer. */ void setLayerSurface(sk_sp<SkSurface> layer) { mLayerSurface = layer; } void setLayerSurface(sk_sp<SkSurface> layer) { if (layer.get()) { if (!mSkiaLayer.get()) { mSkiaLayer = std::make_unique<skiapipeline::SkiaLayer>(); } mSkiaLayer->layerSurface = std::move(layer); mSkiaLayer->inverseTransformInWindow.loadIdentity(); } else { mSkiaLayer.reset(); } } /** * If the RenderNode is of type LayerType::RenderLayer then this method will Loading @@ -330,7 +336,13 @@ public: * NOTE: this function is only guaranteed to return accurate results after * prepareTree has been run for this RenderNode */ SkSurface* getLayerSurface() const { return mLayerSurface.get(); } SkSurface* getLayerSurface() const { return mSkiaLayer.get() ? mSkiaLayer->layerSurface.get() : nullptr; } skiapipeline::SkiaLayer* getSkiaLayer() const { return mSkiaLayer.get(); } private: /** Loading @@ -346,7 +358,7 @@ private: * An offscreen rendering target used to contain the contents this RenderNode * when it has been set to draw as a LayerType::RenderLayer. */ sk_sp<SkSurface> mLayerSurface; std::unique_ptr<skiapipeline::SkiaLayer> mSkiaLayer; }; // class RenderNode } /* namespace uirenderer */ Loading libs/hwui/hwui/Canvas.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ #include "RenderNode.h" #include "MinikinUtils.h" #include "Paint.h" #include "Properties.h" #include "pipeline/skia/SkiaRecordingCanvas.h" #include "Typeface.h" #include <SkDrawFilter.h> Loading @@ -27,6 +29,9 @@ namespace android { Canvas* Canvas::create_recording_canvas(int width, int height, uirenderer::RenderNode* renderNode) { if (uirenderer::Properties::isSkiaEnabled()) { return new uirenderer::skiapipeline::SkiaRecordingCanvas(renderNode, width, height); } return new uirenderer::RecordingCanvas(width, height); } Loading Loading
libs/hwui/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -23,7 +23,10 @@ hwui_src_files := \ pipeline/skia/RenderNodeDrawable.cpp \ pipeline/skia/ReorderBarrierDrawables.cpp \ pipeline/skia/SkiaDisplayList.cpp \ pipeline/skia/SkiaOpenGLPipeline.cpp \ pipeline/skia/SkiaPipeline.cpp \ pipeline/skia/SkiaRecordingCanvas.cpp \ pipeline/skia/SkiaVulkanPipeline.cpp \ renderstate/Blend.cpp \ renderstate/MeshState.cpp \ renderstate/OffscreenBufferPool.cpp \ Loading Loading @@ -296,6 +299,7 @@ LOCAL_SRC_FILES += \ tests/unit/RenderPropertiesTests.cpp \ tests/unit/SkiaBehaviorTests.cpp \ tests/unit/SkiaDisplayListTests.cpp \ tests/unit/SkiaPipelineTests.cpp \ tests/unit/SkiaCanvasTests.cpp \ tests/unit/SnapshotTests.cpp \ tests/unit/StringUtilsTests.cpp \ Loading
libs/hwui/DeviceInfo.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,13 @@ void DeviceInfo::initialize() { }); } void DeviceInfo::initialize(int maxTextureSize) { std::call_once(sInitializedFlag, [maxTextureSize]() { sDeviceInfo = new DeviceInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; }); } void DeviceInfo::load() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); } Loading
libs/hwui/DeviceInfo.h +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ public: // only call this after GL has been initialized, or at any point if compiled // with HWUI_NULL_GPU static void initialize(); static void initialize(int maxTextureSize); int maxTextureSize() const { return mMaxTextureSize; } Loading
libs/hwui/RenderNode.h +21 −9 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "Matrix.h" #include "RenderProperties.h" #include "pipeline/skia/SkiaDisplayList.h" #include "pipeline/skia/SkiaLayer.h" #include <vector> Loading Loading @@ -60,10 +61,6 @@ namespace proto { class RenderNode; } namespace skiapipeline { class SkiaDisplayList; } /** * Primary class for storing recorded canvas commands, as well as per-View/ViewGroup display properties. * Loading Loading @@ -312,14 +309,23 @@ public: * Returns true if an offscreen layer from any renderPipeline is attached * to this node. */ bool hasLayer() const { return mLayer || mLayerSurface.get(); } bool hasLayer() const { return mLayer || mSkiaLayer.get(); } /** * Used by the RenderPipeline to attach an offscreen surface to the RenderNode. * The surface is then will be used to store the contents of a layer. */ void setLayerSurface(sk_sp<SkSurface> layer) { mLayerSurface = layer; } void setLayerSurface(sk_sp<SkSurface> layer) { if (layer.get()) { if (!mSkiaLayer.get()) { mSkiaLayer = std::make_unique<skiapipeline::SkiaLayer>(); } mSkiaLayer->layerSurface = std::move(layer); mSkiaLayer->inverseTransformInWindow.loadIdentity(); } else { mSkiaLayer.reset(); } } /** * If the RenderNode is of type LayerType::RenderLayer then this method will Loading @@ -330,7 +336,13 @@ public: * NOTE: this function is only guaranteed to return accurate results after * prepareTree has been run for this RenderNode */ SkSurface* getLayerSurface() const { return mLayerSurface.get(); } SkSurface* getLayerSurface() const { return mSkiaLayer.get() ? mSkiaLayer->layerSurface.get() : nullptr; } skiapipeline::SkiaLayer* getSkiaLayer() const { return mSkiaLayer.get(); } private: /** Loading @@ -346,7 +358,7 @@ private: * An offscreen rendering target used to contain the contents this RenderNode * when it has been set to draw as a LayerType::RenderLayer. */ sk_sp<SkSurface> mLayerSurface; std::unique_ptr<skiapipeline::SkiaLayer> mSkiaLayer; }; // class RenderNode } /* namespace uirenderer */ Loading
libs/hwui/hwui/Canvas.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ #include "RenderNode.h" #include "MinikinUtils.h" #include "Paint.h" #include "Properties.h" #include "pipeline/skia/SkiaRecordingCanvas.h" #include "Typeface.h" #include <SkDrawFilter.h> Loading @@ -27,6 +29,9 @@ namespace android { Canvas* Canvas::create_recording_canvas(int width, int height, uirenderer::RenderNode* renderNode) { if (uirenderer::Properties::isSkiaEnabled()) { return new uirenderer::skiapipeline::SkiaRecordingCanvas(renderNode, width, height); } return new uirenderer::RecordingCanvas(width, height); } Loading