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

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

Issue 1008493002: Increase YUV video clamping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: individual ya and uv texture size Created 5 years, 9 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 : y_plane_resource_id(0),
16 u_plane_resource_id(0), 16 u_plane_resource_id(0),
17 v_plane_resource_id(0), 17 v_plane_resource_id(0),
18 a_plane_resource_id(0) {} 18 a_plane_resource_id(0) {}
19 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} 19 YUVVideoDrawQuad::~YUVVideoDrawQuad() {}
20 20
21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
22 const gfx::Rect& rect, 22 const gfx::Rect& rect,
23 const gfx::Rect& opaque_rect, 23 const gfx::Rect& opaque_rect,
24 const gfx::Rect& visible_rect, 24 const gfx::Rect& visible_rect,
25 const gfx::RectF& tex_coord_rect, 25 const gfx::RectF& tex_coord_rect,
26 const gfx::Size& tex_size, 26 const gfx::Size& ya_tex_size,
27 const gfx::Size& uv_tex_size,
27 unsigned y_plane_resource_id, 28 unsigned y_plane_resource_id,
28 unsigned u_plane_resource_id, 29 unsigned u_plane_resource_id,
29 unsigned v_plane_resource_id, 30 unsigned v_plane_resource_id,
30 unsigned a_plane_resource_id, 31 unsigned a_plane_resource_id,
31 ColorSpace color_space) { 32 ColorSpace color_space) {
32 bool needs_blending = false; 33 bool needs_blending = false;
33 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 34 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
34 opaque_rect, visible_rect, needs_blending); 35 opaque_rect, visible_rect, needs_blending);
35 this->tex_coord_rect = tex_coord_rect; 36 this->tex_coord_rect = tex_coord_rect;
36 this->tex_size = tex_size; 37 this->ya_tex_size = ya_tex_size;
38 this->uv_tex_size = uv_tex_size;
37 this->y_plane_resource_id = y_plane_resource_id; 39 this->y_plane_resource_id = y_plane_resource_id;
38 this->u_plane_resource_id = u_plane_resource_id; 40 this->u_plane_resource_id = u_plane_resource_id;
39 this->v_plane_resource_id = v_plane_resource_id; 41 this->v_plane_resource_id = v_plane_resource_id;
40 this->a_plane_resource_id = a_plane_resource_id; 42 this->a_plane_resource_id = a_plane_resource_id;
41 this->color_space = color_space; 43 this->color_space = color_space;
42 } 44 }
43 45
44 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 46 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
45 const gfx::Rect& rect, 47 const gfx::Rect& rect,
46 const gfx::Rect& opaque_rect, 48 const gfx::Rect& opaque_rect,
47 const gfx::Rect& visible_rect, 49 const gfx::Rect& visible_rect,
48 bool needs_blending, 50 bool needs_blending,
49 const gfx::RectF& tex_coord_rect, 51 const gfx::RectF& tex_coord_rect,
50 const gfx::Size& tex_size, 52 const gfx::Size& ya_tex_size,
53 const gfx::Size& uv_tex_size,
51 unsigned y_plane_resource_id, 54 unsigned y_plane_resource_id,
52 unsigned u_plane_resource_id, 55 unsigned u_plane_resource_id,
53 unsigned v_plane_resource_id, 56 unsigned v_plane_resource_id,
54 unsigned a_plane_resource_id, 57 unsigned a_plane_resource_id,
55 ColorSpace color_space) { 58 ColorSpace color_space) {
56 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 59 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
57 opaque_rect, visible_rect, needs_blending); 60 opaque_rect, visible_rect, needs_blending);
58 this->tex_coord_rect = tex_coord_rect; 61 this->tex_coord_rect = tex_coord_rect;
59 this->tex_size = tex_size; 62 this->ya_tex_size = ya_tex_size;
63 this->uv_tex_size = uv_tex_size;
60 this->y_plane_resource_id = y_plane_resource_id; 64 this->y_plane_resource_id = y_plane_resource_id;
61 this->u_plane_resource_id = u_plane_resource_id; 65 this->u_plane_resource_id = u_plane_resource_id;
62 this->v_plane_resource_id = v_plane_resource_id; 66 this->v_plane_resource_id = v_plane_resource_id;
63 this->a_plane_resource_id = a_plane_resource_id; 67 this->a_plane_resource_id = a_plane_resource_id;
64 this->color_space = color_space; 68 this->color_space = color_space;
65 } 69 }
66 70
67 void YUVVideoDrawQuad::IterateResources( 71 void YUVVideoDrawQuad::IterateResources(
68 const ResourceIteratorCallback& callback) { 72 const ResourceIteratorCallback& callback) {
69 y_plane_resource_id = callback.Run(y_plane_resource_id); 73 y_plane_resource_id = callback.Run(y_plane_resource_id);
70 u_plane_resource_id = callback.Run(u_plane_resource_id); 74 u_plane_resource_id = callback.Run(u_plane_resource_id);
71 v_plane_resource_id = callback.Run(v_plane_resource_id); 75 v_plane_resource_id = callback.Run(v_plane_resource_id);
72 if (a_plane_resource_id) 76 if (a_plane_resource_id)
73 a_plane_resource_id = callback.Run(a_plane_resource_id); 77 a_plane_resource_id = callback.Run(a_plane_resource_id);
74 } 78 }
75 79
76 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( 80 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast(
77 const DrawQuad* quad) { 81 const DrawQuad* quad) {
78 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); 82 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT);
79 return static_cast<const YUVVideoDrawQuad*>(quad); 83 return static_cast<const YUVVideoDrawQuad*>(quad);
80 } 84 }
81 85
82 void YUVVideoDrawQuad::ExtendValue( 86 void YUVVideoDrawQuad::ExtendValue(
83 base::trace_event::TracedValue* value) const { 87 base::trace_event::TracedValue* value) const {
84 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect, value); 88 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect, value);
85 MathUtil::AddToTracedValue("tex_size", tex_size, value); 89 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value);
90 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value);
86 value->SetInteger("y_plane_resource_id", y_plane_resource_id); 91 value->SetInteger("y_plane_resource_id", y_plane_resource_id);
87 value->SetInteger("u_plane_resource_id", u_plane_resource_id); 92 value->SetInteger("u_plane_resource_id", u_plane_resource_id);
88 value->SetInteger("v_plane_resource_id", v_plane_resource_id); 93 value->SetInteger("v_plane_resource_id", v_plane_resource_id);
89 value->SetInteger("a_plane_resource_id", a_plane_resource_id); 94 value->SetInteger("a_plane_resource_id", a_plane_resource_id);
90 } 95 }
91 96
92 } // namespace cc 97 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698