From 2f73af9212487c81d31d07227fa8a2f4abc77638 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 5 Mar 2013 15:50:58 -0800 Subject: [PATCH] Make LayerDim a regular Layer instead of a LayerBase this is in preparation to get rid of LayerBase entirely Change-Id: Ia051949fc5205fd87371331145356ee11598a597 --- services/surfaceflinger/Layer.h | 2 +- services/surfaceflinger/LayerDim.cpp | 21 ++++++++++++++++++++- services/surfaceflinger/LayerDim.h | 8 ++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 25afeef06..e9eab17fc 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -68,7 +68,7 @@ public: status_t setBuffers(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags=0); - bool isFixedSize() const; + virtual bool isFixedSize() const; // LayerBase interface virtual void setGeometry(const sp& hw, diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp index 24ad706d0..f8c413962 100644 --- a/services/surfaceflinger/LayerDim.cpp +++ b/services/surfaceflinger/LayerDim.cpp @@ -34,7 +34,7 @@ namespace android { // --------------------------------------------------------------------------- LayerDim::LayerDim(SurfaceFlinger* flinger, const sp& client) - : LayerBase(flinger, client) + : Layer(flinger, client) { } @@ -71,6 +71,25 @@ void LayerDim::onDraw(const sp& hw, const Region& clip) con } } +sp LayerDim::createSurface() +{ + class BSurface : public BnSurface, public LayerCleaner { + virtual sp getSurfaceTexture() const { return 0; } + public: + BSurface(const sp& flinger, + const sp& layer) + : LayerCleaner(flinger, layer) { } + }; + sp sur(new BSurface(mFlinger, this)); + return sur; +} + +bool LayerDim::isVisible() const { + const Layer::State& s(mDrawingState); + return !(s.flags & layer_state_t::eLayerHidden) && s.alpha; +} + + // --------------------------------------------------------------------------- }; // namespace android diff --git a/services/surfaceflinger/LayerDim.h b/services/surfaceflinger/LayerDim.h index 5cdfafc42..e1ea9bdf5 100644 --- a/services/surfaceflinger/LayerDim.h +++ b/services/surfaceflinger/LayerDim.h @@ -23,13 +23,13 @@ #include #include -#include "LayerBase.h" +#include "Layer.h" // --------------------------------------------------------------------------- namespace android { -class LayerDim : public LayerBase +class LayerDim : public Layer { public: LayerDim(SurfaceFlinger* flinger, const sp& client); @@ -41,6 +41,10 @@ public: virtual bool isProtectedByApp() const { return false; } virtual bool isProtectedByDRM() const { return false; } virtual const char* getTypeId() const { return "LayerDim"; } + + virtual bool isFixedSize() const { return true; } + virtual bool isVisible() const; + virtual sp createSurface(); }; // ---------------------------------------------------------------------------