From 35ffa6a868f1aa650c90956a4129bb70f780fc99 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 12 Mar 2013 18:45:09 -0700 Subject: 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 --- libs/gui/Surface.cpp | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'libs') 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& 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& bufferProducer) -{ - mGraphicBufferProducer = bufferProducer; +Surface::~Surface() { + if (mConnectedToCpu) { + Surface::disconnect(NATIVE_WINDOW_API_CPU); + } } sp Surface::getIGraphicBufferProducer() const { @@ -723,23 +709,6 @@ static status_t copyBlt( // ---------------------------------------------------------------------------- -status_t Surface::writeToParcel( - const sp& surface, Parcel* parcel) { - sp bp; - if (surface != NULL) { - bp = surface->mGraphicBufferProducer; - } - return parcel->writeStrongBinder(bp->asBinder()); -} - -sp Surface::readFromParcel(const Parcel& data) { - sp binder(data.readStrongBinder()); - sp bp(interface_cast(binder)); - return bp != NULL ? new Surface(bp): NULL; -} - -// ---------------------------------------------------------------------------- - status_t Surface::lock( ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds) { -- cgit v1.1