Index: cc/quads/y_video_draw_quad.cc |
diff --git a/cc/quads/y_video_draw_quad.cc b/cc/quads/y_video_draw_quad.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3b0f5008a97890432db8d43301dad88bf9f1aa4e |
--- /dev/null |
+++ b/cc/quads/y_video_draw_quad.cc |
@@ -0,0 +1,63 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "cc/quads/y_video_draw_quad.h" |
+ |
+#include <stddef.h> |
+ |
+#include "base/logging.h" |
+#include "base/trace_event/trace_event_argument.h" |
+#include "base/values.h" |
+#include "cc/base/math_util.h" |
+#include "ui/gfx/geometry/vector2d_f.h" |
+ |
+namespace cc { |
+ |
+YVideoDrawQuad::YVideoDrawQuad() {} |
+ |
+YVideoDrawQuad::YVideoDrawQuad(const YVideoDrawQuad& other) = default; |
+ |
+void YVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
+ const gfx::Rect& rect, |
+ const gfx::Rect& opaque_rect, |
+ const gfx::Rect& visible_rect, |
+ unsigned resource_id, |
+ const gfx::PointF& uv_top_left, |
+ const gfx::PointF& uv_bottom_right) { |
+ DrawQuad::SetAll(shared_quad_state, DrawQuad::Y_VIDEO_CONTENT, rect, |
+ opaque_rect, visible_rect, false); |
+ resources.ids[kResourceIdIndex] = resource_id; |
+ resources.count = 1; |
+ this->uv_top_left = uv_top_left; |
+ this->uv_bottom_right = uv_bottom_right; |
+} |
+ |
+void YVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
+ const gfx::Rect& rect, |
+ const gfx::Rect& opaque_rect, |
+ const gfx::Rect& visible_rect, |
+ bool needs_blending, |
+ unsigned resource_id, |
+ const gfx::PointF& uv_top_left, |
+ const gfx::PointF& uv_bottom_right) { |
+ DrawQuad::SetAll(shared_quad_state, DrawQuad::Y_VIDEO_CONTENT, rect, |
+ opaque_rect, visible_rect, needs_blending); |
+ resources.ids[kResourceIdIndex] = resource_id; |
+ resources.count = 1; |
+ this->uv_top_left = uv_top_left; |
+ this->uv_bottom_right = uv_bottom_right; |
+} |
+ |
+const YVideoDrawQuad* YVideoDrawQuad::MaterialCast(const DrawQuad* quad) { |
+ DCHECK(quad->material == DrawQuad::Y_VIDEO_CONTENT); |
+ return static_cast<const YVideoDrawQuad*>(quad); |
+} |
+ |
+void YVideoDrawQuad::ExtendValue(base::trace_event::TracedValue* value) const { |
+ value->SetInteger("resource_id", resources.ids[kResourceIdIndex]); |
+ MathUtil::AddToTracedValue("uv_top_left", uv_top_left, value); |
+ MathUtil::AddToTracedValue("uv_bottom_right", uv_bottom_right, value); |
+} |
+ |
+} // namespace cc |