OSDN Git Service

SF: Fix invalid reduction of transparent region from a layer.
authorradhakrishna <radhakrishna@codeaurora.org>
Fri, 21 Feb 2014 04:31:08 +0000 (10:01 +0530)
committerSteve Kondik <steve@cyngn.com>
Wed, 16 Dec 2015 05:16:12 +0000 (00:16 -0500)
Reduce transparent region from a layer only if the transparent
region has valid intersection with the layer. Otherwise, reducing
a transparent region lying completely outside of the layer leads to
invalid sourcecrop values for the layer.

Change-Id: Iee9ba53a8072c21c9ba8a6d58cb14ca30f8600ba
CRs-Fixed: 620973

services/surfaceflinger/Layer.cpp

index 93e6bda..6dd8bad 100644 (file)
@@ -326,7 +326,9 @@ Rect Layer::reduce(const Rect& win, const Region& exclude) const{
     if (CC_LIKELY(exclude.isEmpty())) {
         return win;
     }
-    if (exclude.isRect()) {
+    Rect tmp;
+    win.intersect(exclude.getBounds(), &tmp);
+    if (exclude.isRect() && !tmp.isEmpty()) {
         return win.reduce(exclude.getBounds());
     }
     return Region(win).subtract(exclude).getBounds();