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
3 // found in the LICENSE file.
5 #include "cc/output/overlay_candidate.h"
7 #include "ui/gfx/rect_conversions.h"
11 OverlayCandidate::OverlayCandidate()
12 : transform(gfx::OVERLAY_TRANSFORM_NONE
),
14 uv_rect(0.f
, 0.f
, 1.f
, 1.f
),
17 overlay_handled(false) {}
19 OverlayCandidate::~OverlayCandidate() {}
22 gfx::OverlayTransform
OverlayCandidate::GetOverlayTransform(
23 const gfx::Transform
& quad_transform
,
25 if (!quad_transform
.IsIdentityOrTranslation())
26 return gfx::OVERLAY_TRANSFORM_INVALID
;
28 return flipped
? gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL
29 : gfx::OVERLAY_TRANSFORM_NONE
;
33 gfx::Rect
OverlayCandidate::GetOverlayRect(const gfx::Transform
& quad_transform
,
34 const gfx::Rect
& rect
) {
35 DCHECK(quad_transform
.IsIdentityOrTranslation());
37 gfx::RectF
float_rect(rect
);
38 quad_transform
.TransformRect(&float_rect
);
39 return gfx::ToNearestRect(float_rect
);