diff options
author | Stan Iliev <stani@google.com> | 2016-10-26 10:30:09 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2016-11-03 13:28:49 -0400 |
commit | 500a0c30d4dcd012218c3e44a62926a1c34a259f (patch) | |
tree | 674811f3d2d545ac306a5aaf3b3132b9734f044a /libs/hwui/RenderNode.h | |
parent | 253f81b36747f54b4ba040f523df02d4b33163b7 (diff) |
Implement Skia pipelines for OpenGL and Vulkan.
Implement Skia pipelines for OpenGL and Vulkan:
base SkiaPipeline, SkiaOpenGLPipeline and SkiaVulkanPipeline.
Write unit tests for SkiaPipeline.
Test: Built and run manually on angler-eng.
Change-Id: Ie02583426cb3547541ad9bf91700602a6163ff58
Diffstat (limited to 'libs/hwui/RenderNode.h')
-rw-r--r-- | libs/hwui/RenderNode.h | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h index 3819c5e9187d..b8964f0f16a0 100644 --- a/libs/hwui/RenderNode.h +++ b/libs/hwui/RenderNode.h @@ -33,6 +33,7 @@ #include "Matrix.h" #include "RenderProperties.h" #include "pipeline/skia/SkiaDisplayList.h" +#include "pipeline/skia/SkiaLayer.h" #include <vector> @@ -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. * @@ -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 @@ -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: /** @@ -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 */ |