diff options
author | halliwell <halliwell@chromium.org> | 2015-05-04 16:37:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-04 23:38:07 +0000 |
commit | 56e6db77baec30e48ef94eae9f81e2793db637ea (patch) | |
tree | a234d3ab1b57db47b7ac22e7f0e543c34c97bd61 /cc | |
parent | 809c835bd02eb33a28595911ba2bb8c9d15bb095 (diff) | |
download | chromium_src-56e6db77baec30e48ef94eae9f81e2793db637ea.zip chromium_src-56e6db77baec30e48ef94eae9f81e2793db637ea.tar.gz chromium_src-56e6db77baec30e48ef94eae9f81e2793db637ea.tar.bz2 |
Fix assert in GetOverlayRect when transforming video with Ozone overlay
One of my testcases for updating Chromecast to use Ozone overlays has
css animation on a video element's transform. I hit an assert in the
call to ToNearestRect, which assumes the coordinates of the rectangle
are close to integers (within 0.01).
BUG=
Review URL: https://codereview.chromium.org/1110813002
Cr-Commit-Position: refs/heads/master@{#328218}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/output/gl_renderer.cc | 6 | ||||
-rw-r--r-- | cc/output/overlay_candidate.cc | 7 | ||||
-rw-r--r-- | cc/output/overlay_candidate.h | 9 | ||||
-rw-r--r-- | cc/output/overlay_candidate_validator.h | 4 |
4 files changed, 14 insertions, 12 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index ba3e07d..b13f4b2 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -3433,9 +3433,7 @@ void GLRenderer::ScheduleOverlays(DrawingFrame* frame) { ResourceProvider::ResourceIdArray resources; OverlayCandidateList& overlays = frame->overlay_list; - OverlayCandidateList::iterator it; - for (it = overlays.begin(); it != overlays.end(); ++it) { - const OverlayCandidate& overlay = *it; + for (const OverlayCandidate& overlay : overlays) { // Skip primary plane. if (overlay.plane_z_order == 0) continue; @@ -3448,7 +3446,7 @@ void GLRenderer::ScheduleOverlays(DrawingFrame* frame) { overlay.plane_z_order, overlay.transform, pending_overlay_resources_.back()->texture_id(), - overlay.display_rect, + ToNearestRect(overlay.display_rect), overlay.uv_rect); } } diff --git a/cc/output/overlay_candidate.cc b/cc/output/overlay_candidate.cc index 46c3a7d..0cbd3de 100644 --- a/cc/output/overlay_candidate.cc +++ b/cc/output/overlay_candidate.cc @@ -128,13 +128,14 @@ gfx::OverlayTransform OverlayCandidate::ModifyTransform( } // static -gfx::Rect OverlayCandidate::GetOverlayRect(const gfx::Transform& quad_transform, - const gfx::Rect& rect) { +gfx::RectF OverlayCandidate::GetOverlayRect( + const gfx::Transform& quad_transform, + const gfx::Rect& rect) { DCHECK(quad_transform.IsPositiveScaleOrTranslation()); gfx::RectF float_rect(rect); quad_transform.TransformRect(&float_rect); - return gfx::ToNearestRect(float_rect); + return float_rect; } } // namespace cc diff --git a/cc/output/overlay_candidate.h b/cc/output/overlay_candidate.h index 28ae8cb..c6bb22a 100644 --- a/cc/output/overlay_candidate.h +++ b/cc/output/overlay_candidate.h @@ -24,8 +24,8 @@ class CC_EXPORT OverlayCandidate { // or OVERLAY_TRANSFORM_INVALID. static gfx::OverlayTransform ModifyTransform(gfx::OverlayTransform in, gfx::OverlayTransform delta); - static gfx::Rect GetOverlayRect(const gfx::Transform& quad_transform, - const gfx::Rect& rect); + static gfx::RectF GetOverlayRect(const gfx::Transform& quad_transform, + const gfx::Rect& rect); OverlayCandidate(); ~OverlayCandidate(); @@ -34,8 +34,9 @@ class CC_EXPORT OverlayCandidate { gfx::OverlayTransform transform; // Format of the buffer to composite. ResourceFormat format; - // Rect on the display to position the overlay to. - gfx::Rect display_rect; + // Rect on the display to position the overlay to. Implementer must convert + // to integer coordinates if setting |overlay_handled| to true. + gfx::RectF display_rect; // Crop within the buffer to be placed inside |display_rect|. gfx::RectF uv_rect; // Texture resource to present in an overlay. diff --git a/cc/output/overlay_candidate_validator.h b/cc/output/overlay_candidate_validator.h index 036eafc..6064731 100644 --- a/cc/output/overlay_candidate_validator.h +++ b/cc/output/overlay_candidate_validator.h @@ -19,7 +19,9 @@ class CC_EXPORT OverlayCandidateValidator { // A list of possible overlay candidates is presented to this function. // The expected result is that those candidates that can be in a separate // plane are marked with |overlay_handled| set to true, otherwise they are - // to be traditionally composited. + // to be traditionally composited. Candidates with |overlay_handled| set to + // true must also have their |display_rect| converted to integer + // coordinates if necessary. virtual void CheckOverlaySupport(OverlayCandidateList* surfaces) = 0; virtual ~OverlayCandidateValidator() {} |