1118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian/* 2118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * Copyright (C) 2011 The Android Open Source Project 3118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * 4118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 5118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * you may not use this file except in compliance with the License. 6118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * You may obtain a copy of the License at 7118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * 8118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 9118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * 10118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * Unless required by applicable law or agreed to in writing, software 11118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 12118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * See the License for the specific language governing permissions and 14118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian * limitations under the License. 15118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian */ 16118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 17118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#ifndef ANDROID_LAYER_SCREENSHOT_H 18118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#define ANDROID_LAYER_SCREENSHOT_H 19118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 20118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#include <stdint.h> 21118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#include <sys/types.h> 22118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 23118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#include <EGL/egl.h> 24118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#include <EGL/eglext.h> 25118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 26118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#include "LayerBase.h" 27118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 28118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian// --------------------------------------------------------------------------- 29118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 30118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopiannamespace android { 31118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 32118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopianclass LayerScreenshot : public LayerBaseClient 33118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian{ 34118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian GLuint mTextureName; 35118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian GLfloat mTexCoords[8]; 36118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian sp<SurfaceFlinger> mFlinger; 37dd3cb84cfbe8068790c6233b5829fae9c4a0ee93Jamie Gennis bool mIsSecure; 38118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopianpublic: 393ee454a7bef8bd3d1c9cdd9d17108eb80ebadf2aMathias Agopian LayerScreenshot(SurfaceFlinger* flinger, const sp<Client>& client); 40118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian virtual ~LayerScreenshot(); 41118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 42118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian status_t capture(); 43118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 444a9ac37fe26644bb5253d15eec08be2edb896642Mathias Agopian virtual void initStates(uint32_t w, uint32_t h, uint32_t flags); 454a9ac37fe26644bb5253d15eec08be2edb896642Mathias Agopian virtual uint32_t doTransaction(uint32_t flags); 464297734c1156fd8ede7e9c61b1e439f9e1c18cd9Mathias Agopian virtual void onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const; 47118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian virtual bool isOpaque() const { return false; } 48dd3cb84cfbe8068790c6233b5829fae9c4a0ee93Jamie Gennis virtual bool isSecure() const { return mIsSecure; } 49118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian virtual bool isProtectedByApp() const { return false; } 50118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian virtual bool isProtectedByDRM() const { return false; } 51118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian virtual const char* getTypeId() const { return "LayerScreenshot"; } 524a9ac37fe26644bb5253d15eec08be2edb896642Mathias Agopian 534a9ac37fe26644bb5253d15eec08be2edb896642Mathias Agopianprivate: 543ee454a7bef8bd3d1c9cdd9d17108eb80ebadf2aMathias Agopian status_t captureLocked(int32_t layerStack); 554a9ac37fe26644bb5253d15eec08be2edb896642Mathias Agopian void initTexture(GLfloat u, GLfloat v); 56118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian}; 57118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 58118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian// --------------------------------------------------------------------------- 59118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 60118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian}; // namespace android 61118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian 62118d0245ee0a3b107055782aa8b555404b6f0280Mathias Agopian#endif // ANDROID_LAYER_SCREENSHOT_H 63