turn DisplayDevice into a reference-counted object
it's safer this way because this object owns an
EGLSurface which cannot be easily reference-counted.
it also gives us the ability to sub-class it, which
we might want to do soon.
Change-Id: I07358bb052dc5a13b4f2196b2c2b6e6e94c4bb4f
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 663a864..6394542 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -123,7 +123,7 @@
uint32_t getTransactionFlags(uint32_t flags);
uint32_t setTransactionFlags(uint32_t flags);
- void computeGeometry(const DisplayDevice& hw, LayerMesh* mesh) const;
+ void computeGeometry(const sp<const DisplayDevice>& hw, LayerMesh* mesh) const;
Rect computeBounds() const;
@@ -132,11 +132,11 @@
virtual const char* getTypeId() const { return "LayerBase"; }
- virtual void setGeometry(const DisplayDevice& hw,
+ virtual void setGeometry(const sp<const DisplayDevice>& hw,
HWComposer::HWCLayerInterface& layer);
- virtual void setPerFrameData(const DisplayDevice& hw,
+ virtual void setPerFrameData(const sp<const DisplayDevice>& hw,
HWComposer::HWCLayerInterface& layer);
- virtual void setAcquireFence(const DisplayDevice& hw,
+ virtual void setAcquireFence(const sp<const DisplayDevice>& hw,
HWComposer::HWCLayerInterface& layer);
/**
@@ -145,13 +145,13 @@
* Typically this method is not overridden, instead implement onDraw()
* to perform the actual drawing.
*/
- virtual void draw(const DisplayDevice& hw, const Region& clip) const;
- virtual void draw(const DisplayDevice& hw);
+ virtual void draw(const sp<const DisplayDevice>& hw, const Region& clip) const;
+ virtual void draw(const sp<const DisplayDevice>& hw);
/**
* onDraw - draws the surface.
*/
- virtual void onDraw(const DisplayDevice& hw, const Region& clip) const = 0;
+ virtual void onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const = 0;
/**
* initStates - called just after construction
@@ -218,7 +218,7 @@
/** called after page-flip
*/
- virtual void onLayerDisplayed(const DisplayDevice& hw,
+ virtual void onLayerDisplayed(const sp<const DisplayDevice>& hw,
HWComposer::HWCLayerInterface* layer) { }
/** called before composition.
@@ -247,15 +247,15 @@
inline const State& currentState() const { return mCurrentState; }
inline State& currentState() { return mCurrentState; }
- void clearWithOpenGL(const DisplayDevice& hw, const Region& clip) const;
+ void clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip) const;
void setFiltering(bool filtering);
bool getFiltering() const;
protected:
- void clearWithOpenGL(const DisplayDevice& hw, const Region& clip,
+ void clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip,
GLclampf r, GLclampf g, GLclampf b, GLclampf alpha) const;
- void drawWithOpenGL(const DisplayDevice& hw, const Region& clip) const;
+ void drawWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip) const;
sp<SurfaceFlinger> mFlinger;