diff options
author | Mathias Agopian <mathias@google.com> | 2011-03-07 18:04:06 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-07 18:04:06 -0800 |
commit | de6a47a3e9d1a8cb5722b9785f5ffb9046c23918 (patch) | |
tree | 65d534f3ed68fc9110ea4bb3910fcf865ffb984b /services | |
parent | 10993b2d1e3614073970aad119ffb2cc9bc8f73f (diff) | |
parent | df6410dce3dae0bdb7e13118b3878079a1dcce03 (diff) | |
download | frameworks_base-de6a47a3e9d1a8cb5722b9785f5ffb9046c23918.zip frameworks_base-de6a47a3e9d1a8cb5722b9785f5ffb9046c23918.tar.gz frameworks_base-de6a47a3e9d1a8cb5722b9785f5ffb9046c23918.tar.bz2 |
am df6410dc: Merge "Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only" into gingerbread
* commit 'df6410dce3dae0bdb7e13118b3878079a1dcce03':
Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 8 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h | 1 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.cpp | 20 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.h | 4 | ||||
-rw-r--r-- | services/surfaceflinger/LayerDim.cpp | 10 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 2 |
6 files changed, 28 insertions, 17 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index c9dcef3..e3cf27e 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -120,7 +120,8 @@ void Layer::onRemoved() sp<LayerBaseClient::Surface> Layer::createSurface() const { - return mSurface; + sp<Surface> sur(new SurfaceLayer(mFlinger, const_cast<Layer *>(this))); + return sur; } status_t Layer::ditch() @@ -130,10 +131,6 @@ status_t Layer::ditch() // the layer is not on screen anymore. free as much resources as possible mFreezeLock.clear(); - EGLDisplay dpy(mFlinger->graphicPlane(0).getEGLDisplay()); - mBufferManager.destroy(dpy); - mSurface.clear(); - Mutex::Autolock _l(mLock); mWidth = mHeight = 0; return NO_ERROR; @@ -178,7 +175,6 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED); mNeedsDithering = layerRedsize > displayRedSize; - mSurface = new SurfaceLayer(mFlinger, this); return NO_ERROR; } diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 7bb207a..4a10e73 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -211,7 +211,6 @@ private: ClientRef mUserClientRef; // constants - sp<Surface> mSurface; PixelFormat mFormat; const GLExtensions& mGLExtensions; bool mNeedsBlending; diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp index 916d420..0f02c6d 100644 --- a/services/surfaceflinger/LayerBase.cpp +++ b/services/surfaceflinger/LayerBase.cpp @@ -527,7 +527,9 @@ int32_t LayerBaseClient::sIdentity = 1; LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, const sp<Client>& client) - : LayerBase(flinger, display), mClientRef(client), + : LayerBase(flinger, display), + mHasSurface(false), + mClientRef(client), mIdentity(uint32_t(android_atomic_inc(&sIdentity))) { } @@ -544,14 +546,20 @@ sp<LayerBaseClient::Surface> LayerBaseClient::getSurface() { sp<Surface> s; Mutex::Autolock _l(mLock); - s = mClientSurface.promote(); - if (s == 0) { - s = createSurface(); - mClientSurface = s; - } + + LOG_ALWAYS_FATAL_IF(mHasSurface, + "LayerBaseClient::getSurface() has already been called"); + + mHasSurface = true; + s = createSurface(); + mClientSurfaceBinder = s->asBinder(); return s; } +wp<IBinder> LayerBaseClient::getSurfaceBinder() const { + return mClientSurfaceBinder; +} + sp<LayerBaseClient::Surface> LayerBaseClient::createSurface() const { return new Surface(mFlinger, mIdentity, diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h index 1470729..332e5dd 100644 --- a/services/surfaceflinger/LayerBase.h +++ b/services/surfaceflinger/LayerBase.h @@ -285,6 +285,7 @@ public: virtual ~LayerBaseClient(); sp<Surface> getSurface(); + wp<IBinder> getSurfaceBinder() const; virtual sp<Surface> createSurface() const; virtual sp<LayerBaseClient> getLayerBaseClient() const { return const_cast<LayerBaseClient*>(this); } @@ -330,7 +331,8 @@ protected: private: mutable Mutex mLock; - mutable wp<Surface> mClientSurface; + mutable bool mHasSurface; + wp<IBinder> mClientSurfaceBinder; const wp<Client> mClientRef; // only read const uint32_t mIdentity; diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp index 80cc52c..11f8feb 100644 --- a/services/surfaceflinger/LayerDim.cpp +++ b/services/surfaceflinger/LayerDim.cpp @@ -67,8 +67,14 @@ void LayerDim::onDraw(const Region& clip) const const GLfloat alpha = s.alpha/255.0f; const uint32_t fbHeight = hw.getHeight(); glDisable(GL_DITHER); - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + if (s.alpha == 0xFF) { + glDisable(GL_BLEND); + } else { + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + glColor4f(0, 0, 0, alpha); #if defined(GL_OES_EGL_image_external) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 4b3235d..e2e686f 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1054,7 +1054,7 @@ status_t SurfaceFlinger::removeLayer_l(const sp<LayerBase>& layerBase) { sp<LayerBaseClient> lbc(layerBase->getLayerBaseClient()); if (lbc != 0) { - mLayerMap.removeItem( lbc->getSurface()->asBinder() ); + mLayerMap.removeItem( lbc->getSurfaceBinder() ); } ssize_t index = mCurrentState.layersSortedByZ.remove(layerBase); if (index >= 0) { |