Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2806)

Unified Diff: cc/output/overlay_strategy_single_on_top.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/overlay_strategy_single_on_top.h ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/overlay_strategy_single_on_top.cc
diff --git a/cc/output/overlay_strategy_single_on_top.cc b/cc/output/overlay_strategy_single_on_top.cc
index 9a952068ecc8742c316cd50cc44632aef82714e9..71897ed4596cc1f72bc370bba044136649ff0fe3 100644
--- a/cc/output/overlay_strategy_single_on_top.cc
+++ b/cc/output/overlay_strategy_single_on_top.cc
@@ -119,6 +119,20 @@ bool OverlayStrategySingleOnTop::GetCandidateQuadInfo(
return true;
}
+bool OverlayStrategySingleOnTop::IsInvisibleQuad(const DrawQuad* draw_quad) {
+ if (draw_quad->material == DrawQuad::SOLID_COLOR) {
+ const SolidColorDrawQuad* solid_quad =
+ SolidColorDrawQuad::MaterialCast(draw_quad);
+ SkColor color = solid_quad->color;
+ float opacity = solid_quad->opacity();
+ float alpha = (SkColorGetA(color) * (1.0f / 255.0f)) * opacity;
+ // Ignore transparent solid color quads.
+ return solid_quad->ShouldDrawWithBlending() &&
+ alpha < std::numeric_limits<float>::epsilon();
+ }
+ return false;
+}
+
bool OverlayStrategySingleOnTop::Attempt(
RenderPassList* render_passes_in_draw_order,
OverlayCandidateList* candidate_list) {
@@ -143,7 +157,7 @@ bool OverlayStrategySingleOnTop::Attempt(
++overlap_iter) {
gfx::RectF overlap_rect = overlap_iter->rect;
overlap_iter->quadTransform().TransformRect(&overlap_rect);
- if (rect.Intersects(overlap_rect)) {
+ if (rect.Intersects(overlap_rect) && !IsInvisibleQuad(*overlap_iter)) {
intersects = true;
break;
}
« no previous file with comments | « cc/output/overlay_strategy_single_on_top.h ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698