diff options
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 4779804..c15dfd5 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -36,6 +36,7 @@ #include <gui/Surface.h> #include "clz.h" +#include "Colorizer.h" #include "DisplayDevice.h" #include "GLExtensions.h" #include "Layer.h" @@ -269,13 +270,24 @@ uint32_t Layer::getContentTransform() const { return mCurrentTransform; } +static Rect reduce(const Rect& win, const Region& exclude) { + if (CC_LIKELY(exclude.isEmpty())) { + return win; + } + if (exclude.isRect()) { + return win.reduce(exclude.getBounds()); + } + return Region(win).subtract(exclude).getBounds(); +} + Rect Layer::computeBounds() const { const Layer::State& s(drawingState()); Rect win(s.active.w, s.active.h); if (!s.active.crop.isEmpty()) { win.intersect(s.active.crop, &win); } - return win; + // subtract the transparent region and snap to the bounds + return reduce(win, s.activeTransparentRegion); } Rect Layer::computeCrop(const sp<const DisplayDevice>& hw) const { @@ -309,6 +321,9 @@ Rect Layer::computeCrop(const sp<const DisplayDevice>& hw) const { // window's bounds activeCrop.intersect(Rect(s.active.w, s.active.h), &activeCrop); + // subtract the transparent region and snap to the bounds + activeCrop = reduce(activeCrop, s.activeTransparentRegion); + if (!activeCrop.isEmpty()) { // Transform the window crop to match the buffer coordinate system, // which means using the inverse of the current transform set on the @@ -665,6 +680,8 @@ void Layer::computeGeometry(const sp<const DisplayDevice>& hw, LayerMesh* mesh) if (!s.active.crop.isEmpty()) { win.intersect(s.active.crop, &win); } + // subtract the transparent region and snap to the bounds + win = reduce(win, s.activeTransparentRegion); if (mesh) { tr.transform(mesh->mVertices[0], win.left, win.top); tr.transform(mesh->mVertices[1], win.left, win.bottom); @@ -1178,21 +1195,21 @@ void Layer::updateTransformHint(const sp<const DisplayDevice>& hw) const { // debugging // ---------------------------------------------------------------------------- -void Layer::dump(String8& result, char* buffer, size_t SIZE) const +void Layer::dump(String8& result, Colorizer& colorizer) const { const Layer::State& s(drawingState()); - snprintf(buffer, SIZE, + colorizer.colorize(result, Colorizer::GREEN); + result.appendFormat( "+ %s %p (%s)\n", getTypeId(), this, getName().string()); - result.append(buffer); + colorizer.reset(result); s.activeTransparentRegion.dump(result, "transparentRegion"); visibleRegion.dump(result, "visibleRegion"); sp<Client> client(mClientRef.promote()); - snprintf(buffer, SIZE, - " " + result.appendFormat( " " "layerStack=%4d, z=%9d, pos=(%g,%g), size=(%4d,%4d), crop=(%4d,%4d,%4d,%4d), " "isOpaque=%1d, invalidate=%1d, " "alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n" @@ -1205,7 +1222,6 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const s.transform[0][0], s.transform[0][1], s.transform[1][0], s.transform[1][1], client.get()); - result.append(buffer); sp<const GraphicBuffer> buf0(mActiveBuffer); uint32_t w0=0, h0=0, s0=0, f0=0; @@ -1215,26 +1231,19 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const s0 = buf0->getStride(); f0 = buf0->format; } - snprintf(buffer, SIZE, + result.appendFormat( " " "format=%2d, activeBuffer=[%4ux%4u:%4u,%3X]," " queued-frames=%d, mRefreshPending=%d\n", mFormat, w0, h0, s0,f0, mQueuedFrames, mRefreshPending); - result.append(buffer); - if (mSurfaceFlingerConsumer != 0) { - mSurfaceFlingerConsumer->dump(result, " ", buffer, SIZE); + mSurfaceFlingerConsumer->dump(result, " "); } } - -void Layer::shortDump(String8& result, char* scratch, size_t size) const { - Layer::dump(result, scratch, size); -} - -void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const { +void Layer::dumpStats(String8& result) const { mFrameTracker.dump(result); } |