OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/output/overlay_candidate_validator.h" | 5 #include "cc/output/overlay_candidate.h" |
| 6 |
| 7 #include "ui/gfx/rect_conversions.h" |
6 | 8 |
7 namespace cc { | 9 namespace cc { |
8 | 10 |
9 OverlayCandidate::OverlayCandidate() | 11 OverlayCandidate::OverlayCandidate() |
10 : transform(NONE), | 12 : transform(NONE), |
11 format(RGBA_8888), | 13 format(RGBA_8888), |
12 uv_rect(0.f, 0.f, 1.f, 1.f), | 14 uv_rect(0.f, 0.f, 1.f, 1.f), |
| 15 resource_id(0), |
| 16 plane_z_order(0), |
13 overlay_handled(false) {} | 17 overlay_handled(false) {} |
14 | 18 |
15 OverlayCandidate::~OverlayCandidate() {} | 19 OverlayCandidate::~OverlayCandidate() {} |
16 | 20 |
| 21 // static |
| 22 OverlayCandidate::OverlayTransform OverlayCandidate::GetOverlayTransform( |
| 23 const gfx::Transform& quad_transform, |
| 24 bool flipped) { |
| 25 if (!quad_transform.IsIdentityOrTranslation()) |
| 26 return INVALID; |
| 27 |
| 28 return flipped ? FLIP_VERTICAL : NONE; |
| 29 } |
| 30 |
| 31 // static |
| 32 gfx::Rect OverlayCandidate::GetOverlayRect(const gfx::Transform& quad_transform, |
| 33 const gfx::Rect& rect) { |
| 34 DCHECK(quad_transform.IsIdentityOrTranslation()); |
| 35 |
| 36 gfx::RectF float_rect(rect); |
| 37 quad_transform.TransformRect(&float_rect); |
| 38 return gfx::ToNearestRect(float_rect); |
| 39 } |
| 40 |
17 } // namespace cc | 41 } // namespace cc |
OLD | NEW |