OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #include "cc/quads/y_video_draw_quad.h" |
| 6 |
| 7 #include <stddef.h> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/trace_event/trace_event_argument.h" |
| 11 #include "base/values.h" |
| 12 #include "cc/base/math_util.h" |
| 13 #include "ui/gfx/geometry/vector2d_f.h" |
| 14 |
| 15 namespace cc { |
| 16 |
| 17 YVideoDrawQuad::YVideoDrawQuad() {} |
| 18 |
| 19 YVideoDrawQuad::YVideoDrawQuad(const YVideoDrawQuad& other) = default; |
| 20 |
| 21 void YVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 22 const gfx::Rect& rect, |
| 23 const gfx::Rect& opaque_rect, |
| 24 const gfx::Rect& visible_rect, |
| 25 unsigned resource_id, |
| 26 const gfx::PointF& uv_top_left, |
| 27 const gfx::PointF& uv_bottom_right) { |
| 28 DrawQuad::SetAll(shared_quad_state, DrawQuad::Y_VIDEO_CONTENT, rect, |
| 29 opaque_rect, visible_rect, false); |
| 30 resources.ids[kResourceIdIndex] = resource_id; |
| 31 resources.count = 1; |
| 32 this->uv_top_left = uv_top_left; |
| 33 this->uv_bottom_right = uv_bottom_right; |
| 34 } |
| 35 |
| 36 void YVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 37 const gfx::Rect& rect, |
| 38 const gfx::Rect& opaque_rect, |
| 39 const gfx::Rect& visible_rect, |
| 40 bool needs_blending, |
| 41 unsigned resource_id, |
| 42 const gfx::PointF& uv_top_left, |
| 43 const gfx::PointF& uv_bottom_right) { |
| 44 DrawQuad::SetAll(shared_quad_state, DrawQuad::Y_VIDEO_CONTENT, rect, |
| 45 opaque_rect, visible_rect, needs_blending); |
| 46 resources.ids[kResourceIdIndex] = resource_id; |
| 47 resources.count = 1; |
| 48 this->uv_top_left = uv_top_left; |
| 49 this->uv_bottom_right = uv_bottom_right; |
| 50 } |
| 51 |
| 52 const YVideoDrawQuad* YVideoDrawQuad::MaterialCast(const DrawQuad* quad) { |
| 53 DCHECK(quad->material == DrawQuad::Y_VIDEO_CONTENT); |
| 54 return static_cast<const YVideoDrawQuad*>(quad); |
| 55 } |
| 56 |
| 57 void YVideoDrawQuad::ExtendValue(base::trace_event::TracedValue* value) const { |
| 58 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]); |
| 59 MathUtil::AddToTracedValue("uv_top_left", uv_top_left, value); |
| 60 MathUtil::AddToTracedValue("uv_bottom_right", uv_bottom_right, value); |
| 61 } |
| 62 |
| 63 } // namespace cc |
OLD | NEW |