diff options
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.h')
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index 4a5b2c72b02a..d80a24737a7a 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -27,17 +27,17 @@ #include "IRenderPipeline.h" #include "LayerUpdateQueue.h" #include "RenderNode.h" -#include "thread/Task.h" -#include "thread/TaskProcessor.h" #include "renderthread/RenderTask.h" #include "renderthread/RenderThread.h" +#include "thread/Task.h" +#include "thread/TaskProcessor.h" -#include <cutils/compiler.h> #include <EGL/egl.h> #include <SkBitmap.h> #include <SkRect.h> -#include <utils/Functor.h> +#include <cutils/compiler.h> #include <gui/Surface.h> +#include <utils/Functor.h> #include <functional> #include <set> @@ -63,8 +63,8 @@ class Frame; // TODO: Rename to Renderer or some other per-window, top-level manager class CanvasContext : public IFrameCallback { public: - static CanvasContext* create(RenderThread& thread, bool translucent, - RenderNode* rootRenderNode, IContextFactory* contextFactory); + static CanvasContext* create(RenderThread& thread, bool translucent, RenderNode* rootRenderNode, + IContextFactory* contextFactory); virtual ~CanvasContext(); /** @@ -89,9 +89,7 @@ public: bool pinImages(std::vector<SkImage*>& mutableImages) { return mRenderPipeline->pinImages(mutableImages); } - bool pinImages(LsaVector<sk_sp<Bitmap>>& images) { - return mRenderPipeline->pinImages(images); - } + bool pinImages(LsaVector<sk_sp<Bitmap>>& images) { return mRenderPipeline->pinImages(images); } /** * Unpin any image that had be previously pinned to the GPU cache @@ -117,20 +115,17 @@ public: // Won't take effect until next EGLSurface creation void setSwapBehavior(SwapBehavior swapBehavior); - void initialize(Surface* surface); - void updateSurface(Surface* surface); - bool pauseSurface(Surface* surface); + void setSurface(sp<Surface>&& surface); + bool pauseSurface(); void setStopped(bool stopped); bool hasSurface() { return mNativeSurface.get(); } - void setup(float lightRadius, - uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha); + void setup(float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha); void setLightCenter(const Vector3& lightCenter); void setOpaque(bool opaque); void setWideGamut(bool wideGamut); bool makeCurrent(); - void prepareTree(TreeInfo& info, int64_t* uiFrameInfo, - int64_t syncQueued, RenderNode* target); + void prepareTree(TreeInfo& info, int64_t* uiFrameInfo, int64_t syncQueued, RenderNode* target); void draw(); void destroy(); @@ -162,13 +157,9 @@ public: void addRenderNode(RenderNode* node, bool placeFront); void removeRenderNode(RenderNode* node); - void setContentDrawBounds(const Rect& bounds) { - mContentDrawBounds = bounds; - } + void setContentDrawBounds(const Rect& bounds) { mContentDrawBounds = bounds; } - RenderState& getRenderState() { - return mRenderThread.renderState(); - } + RenderState& getRenderState() { return mRenderThread.renderState(); } void addFrameMetricsObserver(FrameMetricsObserver* observer) { if (mFrameMetricsReporter.get() == nullptr) { @@ -198,15 +189,13 @@ public: private: CanvasContext(RenderThread& thread, bool translucent, RenderNode* rootRenderNode, - IContextFactory* contextFactory, std::unique_ptr<IRenderPipeline> renderPipeline); + IContextFactory* contextFactory, std::unique_ptr<IRenderPipeline> renderPipeline); friend class RegisterFrameCallbackTask; // TODO: Replace with something better for layer & other GL object // lifecycle tracking friend class android::uirenderer::RenderState; - void setSurface(Surface* window); - void freePrefetchedLayers(); bool isSwapChainStuffed(); @@ -242,14 +231,14 @@ private: bool mOpaque; bool mWideColorGamut = false; BakedOpRenderer::LightInfo mLightInfo; - FrameBuilder::LightGeometry mLightGeometry = { {0, 0, 0}, 0 }; + FrameBuilder::LightGeometry mLightGeometry = {{0, 0, 0}, 0}; bool mHaveNewSurface = false; DamageAccumulator mDamageAccumulator; LayerUpdateQueue mLayerUpdateQueue; std::unique_ptr<AnimationContext> mAnimationContext; - std::vector< sp<RenderNode> > mRenderNodes; + std::vector<sp<RenderNode>> mRenderNodes; FrameInfo* mCurrentFrameInfo = nullptr; std::string mName; @@ -269,8 +258,8 @@ private: }; class FuncTaskProcessor; - std::vector< sp<FuncTask> > mFrameFences; - sp<TaskProcessor<bool> > mFrameWorkProcessor; + std::vector<sp<FuncTask>> mFrameFences; + sp<TaskProcessor<bool>> mFrameWorkProcessor; std::unique_ptr<IRenderPipeline> mRenderPipeline; }; |