Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: cc/quads/yuv_video_draw_quad.cc

Issue 1152473006: cc: Remove DrawQuad::IterateResoruces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/quads/yuv_video_draw_quad.h" 5 #include "cc/quads/yuv_video_draw_quad.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/trace_event/trace_event_argument.h" 8 #include "base/trace_event/trace_event_argument.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 YUVVideoDrawQuad::YUVVideoDrawQuad() 14 YUVVideoDrawQuad::YUVVideoDrawQuad() {
15 : y_plane_resource_id(0), 15 }
16 u_plane_resource_id(0),
17 v_plane_resource_id(0),
18 a_plane_resource_id(0) {}
19 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} 16 YUVVideoDrawQuad::~YUVVideoDrawQuad() {}
20 17
21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 18 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
22 const gfx::Rect& rect, 19 const gfx::Rect& rect,
23 const gfx::Rect& opaque_rect, 20 const gfx::Rect& opaque_rect,
24 const gfx::Rect& visible_rect, 21 const gfx::Rect& visible_rect,
25 const gfx::RectF& ya_tex_coord_rect, 22 const gfx::RectF& ya_tex_coord_rect,
26 const gfx::RectF& uv_tex_coord_rect, 23 const gfx::RectF& uv_tex_coord_rect,
27 const gfx::Size& ya_tex_size, 24 const gfx::Size& ya_tex_size,
28 const gfx::Size& uv_tex_size, 25 const gfx::Size& uv_tex_size,
29 unsigned y_plane_resource_id, 26 unsigned y_plane_resource_id,
30 unsigned u_plane_resource_id, 27 unsigned u_plane_resource_id,
31 unsigned v_plane_resource_id, 28 unsigned v_plane_resource_id,
32 unsigned a_plane_resource_id, 29 unsigned a_plane_resource_id,
33 ColorSpace color_space) { 30 ColorSpace color_space) {
34 bool needs_blending = false; 31 bool needs_blending = false;
35 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 32 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
36 opaque_rect, visible_rect, needs_blending); 33 opaque_rect, visible_rect, needs_blending);
37 this->ya_tex_coord_rect = ya_tex_coord_rect; 34 this->ya_tex_coord_rect = ya_tex_coord_rect;
38 this->uv_tex_coord_rect = uv_tex_coord_rect; 35 this->uv_tex_coord_rect = uv_tex_coord_rect;
39 this->ya_tex_size = ya_tex_size; 36 this->ya_tex_size = ya_tex_size;
40 this->uv_tex_size = uv_tex_size; 37 this->uv_tex_size = uv_tex_size;
41 this->y_plane_resource_id = y_plane_resource_id; 38 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id;
42 this->u_plane_resource_id = u_plane_resource_id; 39 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id;
43 this->v_plane_resource_id = v_plane_resource_id; 40 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id;
44 this->a_plane_resource_id = a_plane_resource_id; 41 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id;
42 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3;
danakj 2015/05/28 23:00:15 nitto
vmpstr 2015/05/28 23:35:52 Done.
45 this->color_space = color_space; 43 this->color_space = color_space;
46 } 44 }
47 45
48 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 46 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
49 const gfx::Rect& rect, 47 const gfx::Rect& rect,
50 const gfx::Rect& opaque_rect, 48 const gfx::Rect& opaque_rect,
51 const gfx::Rect& visible_rect, 49 const gfx::Rect& visible_rect,
52 bool needs_blending, 50 bool needs_blending,
53 const gfx::RectF& ya_tex_coord_rect, 51 const gfx::RectF& ya_tex_coord_rect,
54 const gfx::RectF& uv_tex_coord_rect, 52 const gfx::RectF& uv_tex_coord_rect,
55 const gfx::Size& ya_tex_size, 53 const gfx::Size& ya_tex_size,
56 const gfx::Size& uv_tex_size, 54 const gfx::Size& uv_tex_size,
57 unsigned y_plane_resource_id, 55 unsigned y_plane_resource_id,
58 unsigned u_plane_resource_id, 56 unsigned u_plane_resource_id,
59 unsigned v_plane_resource_id, 57 unsigned v_plane_resource_id,
60 unsigned a_plane_resource_id, 58 unsigned a_plane_resource_id,
61 ColorSpace color_space) { 59 ColorSpace color_space) {
62 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 60 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
63 opaque_rect, visible_rect, needs_blending); 61 opaque_rect, visible_rect, needs_blending);
64 this->ya_tex_coord_rect = ya_tex_coord_rect; 62 this->ya_tex_coord_rect = ya_tex_coord_rect;
65 this->uv_tex_coord_rect = uv_tex_coord_rect; 63 this->uv_tex_coord_rect = uv_tex_coord_rect;
66 this->ya_tex_size = ya_tex_size; 64 this->ya_tex_size = ya_tex_size;
67 this->uv_tex_size = uv_tex_size; 65 this->uv_tex_size = uv_tex_size;
68 this->y_plane_resource_id = y_plane_resource_id; 66 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id;
69 this->u_plane_resource_id = u_plane_resource_id; 67 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id;
70 this->v_plane_resource_id = v_plane_resource_id; 68 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id;
71 this->a_plane_resource_id = a_plane_resource_id; 69 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id;
70 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3;
72 this->color_space = color_space; 71 this->color_space = color_space;
73 } 72 }
74 73
75 void YUVVideoDrawQuad::IterateResources(
76 const ResourceIteratorCallback& callback) {
77 y_plane_resource_id = callback.Run(y_plane_resource_id);
78 u_plane_resource_id = callback.Run(u_plane_resource_id);
79 v_plane_resource_id = callback.Run(v_plane_resource_id);
80 if (a_plane_resource_id)
81 a_plane_resource_id = callback.Run(a_plane_resource_id);
82 }
83
84 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( 74 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast(
85 const DrawQuad* quad) { 75 const DrawQuad* quad) {
86 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); 76 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT);
87 return static_cast<const YUVVideoDrawQuad*>(quad); 77 return static_cast<const YUVVideoDrawQuad*>(quad);
88 } 78 }
89 79
90 void YUVVideoDrawQuad::ExtendValue( 80 void YUVVideoDrawQuad::ExtendValue(
91 base::trace_event::TracedValue* value) const { 81 base::trace_event::TracedValue* value) const {
92 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value); 82 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value);
93 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value); 83 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value);
94 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value); 84 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value);
95 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value); 85 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value);
96 value->SetInteger("y_plane_resource_id", y_plane_resource_id); 86 value->SetInteger("y_plane_resource_id",
97 value->SetInteger("u_plane_resource_id", u_plane_resource_id); 87 resources.ids[kYPlaneResourceIdIndex]);
98 value->SetInteger("v_plane_resource_id", v_plane_resource_id); 88 value->SetInteger("u_plane_resource_id",
99 value->SetInteger("a_plane_resource_id", a_plane_resource_id); 89 resources.ids[kUPlaneResourceIdIndex]);
90 value->SetInteger("v_plane_resource_id",
91 resources.ids[kVPlaneResourceIdIndex]);
92 value->SetInteger("a_plane_resource_id",
93 resources.ids[kAPlaneResourceIdIndex]);
100 } 94 }
101 95
102 } // namespace cc 96 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698