summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-03-12 18:45:09 -0700
committerMathias Agopian <mathias@google.com>2013-03-12 18:45:09 -0700
commit35ffa6a868f1aa650c90956a4129bb70f780fc99 (patch)
tree0e782930918cace63a9d1e521ac1eefa2f5fa7b5 /libs
parent4d9b822e2c18142e55fe2611aa6cd7dc7d4a62c6 (diff)
downloadframeworks_native-35ffa6a868f1aa650c90956a4129bb70f780fc99.zip
frameworks_native-35ffa6a868f1aa650c90956a4129bb70f780fc99.tar.gz
frameworks_native-35ffa6a868f1aa650c90956a4129bb70f780fc99.tar.bz2
Surface can now be created only from an IGraphicBufferProducer
it can't write itself to a parcel, nor can it be created from a parcel. Change-Id: I69165d5c54d6024b3e546e80d8b57e3dedda7893
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/Surface.cpp41
1 files changed, 5 insertions, 36 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 950d16a..ec55b57 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -38,22 +38,8 @@ namespace android {
Surface::Surface(
const sp<IGraphicBufferProducer>& bufferProducer)
+ : mGraphicBufferProducer(bufferProducer)
{
- Surface::init();
- Surface::setIGraphicBufferProducer(bufferProducer);
-}
-
-Surface::Surface() {
- Surface::init();
-}
-
-Surface::~Surface() {
- if (mConnectedToCpu) {
- Surface::disconnect(NATIVE_WINDOW_API_CPU);
- }
-}
-
-void Surface::init() {
// Initialize the ANativeWindow function pointers.
ANativeWindow::setSwapInterval = hook_setSwapInterval;
ANativeWindow::dequeueBuffer = hook_dequeueBuffer;
@@ -87,10 +73,10 @@ void Surface::init() {
mConnectedToCpu = false;
}
-void Surface::setIGraphicBufferProducer(
- const sp<IGraphicBufferProducer>& bufferProducer)
-{
- mGraphicBufferProducer = bufferProducer;
+Surface::~Surface() {
+ if (mConnectedToCpu) {
+ Surface::disconnect(NATIVE_WINDOW_API_CPU);
+ }
}
sp<IGraphicBufferProducer> Surface::getIGraphicBufferProducer() const {
@@ -723,23 +709,6 @@ static status_t copyBlt(
// ----------------------------------------------------------------------------
-status_t Surface::writeToParcel(
- const sp<Surface>& surface, Parcel* parcel) {
- sp<IGraphicBufferProducer> bp;
- if (surface != NULL) {
- bp = surface->mGraphicBufferProducer;
- }
- return parcel->writeStrongBinder(bp->asBinder());
-}
-
-sp<Surface> Surface::readFromParcel(const Parcel& data) {
- sp<IBinder> binder(data.readStrongBinder());
- sp<IGraphicBufferProducer> bp(interface_cast<IGraphicBufferProducer>(binder));
- return bp != NULL ? new Surface(bp): NULL;
-}
-
-// ----------------------------------------------------------------------------
-
status_t Surface::lock(
ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds)
{