Chromium Code Reviews

Unified Diff: cc/quads/y_video_draw_quad.cc

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WebGL video to texture support and readPixels from R16UI for CPU access Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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..3146cb121b2d8099dd14b0ea1bbb6a913ef7e97b
--- /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,
+ unsigned resource_id,
+ gfx::Size resource_size_in_pixels,
+ 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;
+}
+
+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

Powered by Google App Engine