Add a LayerScreenshot
A LayerScreenshot is a special type of layer that contains a screenshot of
the screen acquired when its created. It works just like LayerDim.
Bug: 5446982
Change-Id: I7814aff2380e7e146937f2b641907be2a30c76cc
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 0e642c1..3c8f4e5 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -49,6 +49,7 @@
class FreezeLock;
class Layer;
class LayerDim;
+class LayerScreenshot;
struct surface_flinger_cblk_t;
#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
@@ -186,6 +187,15 @@
void screenReleased(DisplayID dpy);
void screenAcquired(DisplayID dpy);
+ status_t renderScreenToTexture(DisplayID dpy,
+ GLuint* textureName, GLfloat* uOut, GLfloat* vOut);
+
+ status_t postMessageAsync(const sp<MessageBase>& msg,
+ nsecs_t reltime=0, uint32_t flags = 0);
+
+ status_t postMessageSync(const sp<MessageBase>& msg,
+ nsecs_t reltime=0, uint32_t flags = 0);
+
status_t removeLayer(const sp<LayerBase>& layer);
status_t addLayer(const sp<LayerBase>& layer);
status_t invalidateLayerVisibility(const sp<LayerBase>& layer);
@@ -195,6 +205,18 @@
GLuint getProtectedTexName() const { return mProtectedTexName; }
+
+ class MessageDestroyGLTexture : public MessageBase {
+ GLuint texture;
+ public:
+ MessageDestroyGLTexture(GLuint texture) : texture(texture) { }
+ virtual bool handler() {
+ glDeleteTextures(1, &texture);
+ return true;
+ }
+ };
+
+
private:
// DeathRecipient interface
virtual void binderDied(const wp<IBinder>& who);
@@ -204,7 +226,6 @@
friend class LayerBase;
friend class LayerBaseClient;
friend class Layer;
- friend class LayerDim;
sp<ISurface> createSurface(
ISurfaceComposerClient::surface_data_t* params,
@@ -222,6 +243,10 @@
const sp<Client>& client, DisplayID display,
uint32_t w, uint32_t h, uint32_t flags);
+ sp<LayerScreenshot> createScreenshotSurface(
+ const sp<Client>& client, DisplayID display,
+ uint32_t w, uint32_t h, uint32_t flags);
+
status_t removeSurface(const sp<Client>& client, SurfaceID sid);
status_t destroySurface(const wp<LayerBaseClient>& layer);
uint32_t setClientStateLocked(const sp<Client>& client, const layer_state_t& s);
@@ -329,12 +354,6 @@
mutable MessageQueue mEventQueue;
- status_t postMessageAsync(const sp<MessageBase>& msg,
- nsecs_t reltime=0, uint32_t flags = 0);
-
- status_t postMessageSync(const sp<MessageBase>& msg,
- nsecs_t reltime=0, uint32_t flags = 0);
-
// access must be protected by mStateLock
mutable Mutex mStateLock;
State mCurrentState;