diff options
author | Mathias Agopian <mathias@google.com> | 2009-09-23 19:16:27 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-09-23 19:16:27 -0700 |
commit | 401c257fba770a267f637184b1f532b4e03bed20 (patch) | |
tree | 5ed9e89c7436a7f738818287d7722ec6f98627b5 /libs/surfaceflinger/Layer.cpp | |
parent | a2fe0a234bd6823f868742a3c137acb8875e1b03 (diff) | |
download | frameworks_native-401c257fba770a267f637184b1f532b4e03bed20.zip frameworks_native-401c257fba770a267f637184b1f532b4e03bed20.tar.gz frameworks_native-401c257fba770a267f637184b1f532b4e03bed20.tar.bz2 |
turn dithering off if it's not needed
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r-- | libs/surfaceflinger/Layer.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 8dfc2cf..67ddcf9 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -51,7 +51,8 @@ Layer::Layer(SurfaceFlinger* flinger, DisplayID display, const sp<Client>& c, int32_t i) : LayerBaseClient(flinger, display, c, i), mSecure(false), - mNeedsBlending(true) + mNeedsBlending(true), + mNeedsDithering(false) { // no OpenGL operation is possible here, since we might not be // in the OpenGL thread. @@ -106,10 +107,16 @@ status_t Layer::ditch() status_t Layer::setBuffers( uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) { + // this surfaces pixel format PixelFormatInfo info; status_t err = getPixelFormatInfo(format, &info); if (err) return err; + // the display's pixel format + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + PixelFormatInfo displayInfo; + getPixelFormatInfo(hw.getFormat(), &displayInfo); + uint32_t bufferFlags = 0; if (flags & ISurfaceComposer::eSecure) bufferFlags |= Buffer::SECURE; @@ -119,6 +126,12 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, mHeight = h; mSecure = (bufferFlags & Buffer::SECURE) ? true : false; mNeedsBlending = (info.h_alpha - info.l_alpha) > 0; + + // we use the red index + int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED); + int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED); + mNeedsDithering = layerRedsize > displayRedSize; + mBufferFlags = bufferFlags; for (size_t i=0 ; i<NUM_BUFFERS ; i++) { mBuffers[i] = new Buffer(); |