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

Unified Diff: cc/output/overlay_strategy_sandwich.cc

Issue 1384583003: Revert of Mac Overlays: Clip display and UV rects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2490
Patch Set: Created 5 years, 3 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_common.cc ('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_sandwich.cc
diff --git a/cc/output/overlay_strategy_sandwich.cc b/cc/output/overlay_strategy_sandwich.cc
index 1171eddd5c61d95bb1735f879e4730e0304c07de..446b4ef08a8d9f9ad610944caa080968a614b628 100644
--- a/cc/output/overlay_strategy_sandwich.cc
+++ b/cc/output/overlay_strategy_sandwich.cc
@@ -9,28 +9,10 @@
#include "cc/output/overlay_candidate_validator.h"
#include "cc/quads/draw_quad.h"
#include "cc/quads/solid_color_draw_quad.h"
+#include "ui/gfx/geometry/dip_util.h"
+#include "ui/gfx/geometry/rect_conversions.h"
namespace cc {
-
-namespace {
-
-void ClipDisplayAndUVRects(gfx::Rect* display_rect,
- gfx::RectF* uv_rect,
- const gfx::Rect& clip_rect) {
- gfx::Rect display_cropped_rect =
- gfx::IntersectRects(*display_rect, clip_rect);
-
- gfx::RectF uv_cropped_rect = gfx::RectF(display_cropped_rect);
- uv_cropped_rect -= gfx::Vector2dF(display_rect->x(), display_rect->y());
- uv_cropped_rect.Scale(uv_rect->width() / display_rect->width(),
- uv_rect->height() / display_rect->height());
- uv_cropped_rect += gfx::Vector2dF(uv_rect->x(), uv_rect->y());
-
- *display_rect = display_cropped_rect;
- *uv_rect = uv_cropped_rect;
-}
-
-} // namespace
OverlayStrategySandwich::~OverlayStrategySandwich() {}
@@ -52,14 +34,10 @@
if (!candidate_transform.GetInverse(&candidate_inverse_transform))
return DID_NOT_CREATE_OVERLAY;
- // Compute the candidate's rect in display space (pixels on the screen).
- gfx::Rect candidate_pixel_rect = candidate.quad_rect_in_target_space;
- gfx::RectF candidate_uv_rect = candidate.uv_rect;
- if (candidate.is_clipped &&
- !candidate.clip_rect.Contains(candidate_pixel_rect)) {
- ClipDisplayAndUVRects(&candidate_pixel_rect, &candidate_uv_rect,
- candidate.clip_rect);
- }
+ // Compute the candidate's rect in display space (pixels on the screen). The
+ // rect needs to be DIP-aligned, or we cannot use it.
+ const gfx::Rect candidate_pixel_rect =
+ gfx::ToNearestRect(candidate.display_rect);
// Don't allow overlapping overlays for now.
for (const OverlayCandidate& other_candidate : *candidate_list) {
@@ -76,7 +54,8 @@
overlap_iter != *candidate_iter_in_quad_list; ++overlap_iter) {
if (OverlayStrategyCommon::IsInvisibleQuad(*overlap_iter))
continue;
- // Compute the quad's bounds in display space.
+ // Compute the quad's bounds in display space, and ensure that it is rounded
+ // up to be DIP-aligned.
gfx::Rect pixel_covered_rect = MathUtil::MapEnclosingClippedRect(
overlap_iter->shared_quad_state->quad_to_target_transform,
overlap_iter->rect);
@@ -91,11 +70,7 @@
DCHECK(candidate.resource_id);
OverlayCandidateList new_candidate_list = *candidate_list;
new_candidate_list.push_back(candidate);
- OverlayCandidate& new_candidate = new_candidate_list.back();
- new_candidate.plane_z_order = 1;
- new_candidate.display_rect = gfx::RectF(candidate_pixel_rect);
- new_candidate.quad_rect_in_target_space = candidate_pixel_rect;
- new_candidate.uv_rect = candidate_uv_rect;
+ new_candidate_list.back().plane_z_order = 1;
// Add an overlay of the primary surface for any part of the candidate's
// quad that was covered.
« no previous file with comments | « cc/output/overlay_strategy_common.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698