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

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

Issue 2173563002: Improve GL shader YUV adjustment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use enum hack Created 4 years, 4 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"
(...skipping 14 matching lines...) Expand all
25 const gfx::RectF& ya_tex_coord_rect, 25 const gfx::RectF& ya_tex_coord_rect,
26 const gfx::RectF& uv_tex_coord_rect, 26 const gfx::RectF& uv_tex_coord_rect,
27 const gfx::Size& ya_tex_size, 27 const gfx::Size& ya_tex_size,
28 const gfx::Size& uv_tex_size, 28 const gfx::Size& uv_tex_size,
29 unsigned y_plane_resource_id, 29 unsigned y_plane_resource_id,
30 unsigned u_plane_resource_id, 30 unsigned u_plane_resource_id,
31 unsigned v_plane_resource_id, 31 unsigned v_plane_resource_id,
32 unsigned a_plane_resource_id, 32 unsigned a_plane_resource_id,
33 ColorSpace color_space, 33 ColorSpace color_space,
34 float offset, 34 float offset,
35 float multiplier) { 35 float multiplier,
36 uint32_t bits_per_channel) {
36 bool needs_blending = false; 37 bool needs_blending = false;
37 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 38 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
38 opaque_rect, visible_rect, needs_blending); 39 opaque_rect, visible_rect, needs_blending);
39 this->ya_tex_coord_rect = ya_tex_coord_rect; 40 this->ya_tex_coord_rect = ya_tex_coord_rect;
40 this->uv_tex_coord_rect = uv_tex_coord_rect; 41 this->uv_tex_coord_rect = uv_tex_coord_rect;
41 this->ya_tex_size = ya_tex_size; 42 this->ya_tex_size = ya_tex_size;
42 this->uv_tex_size = uv_tex_size; 43 this->uv_tex_size = uv_tex_size;
43 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; 44 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id;
44 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; 45 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id;
45 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; 46 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id;
46 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; 47 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id;
47 resources.count = a_plane_resource_id ? 4 : 3; 48 resources.count = a_plane_resource_id ? 4 : 3;
48 this->color_space = color_space; 49 this->color_space = color_space;
49 this->resource_offset = offset; 50 this->resource_offset = offset;
50 this->resource_multiplier = multiplier; 51 this->resource_multiplier = multiplier;
52 this->bits_per_channel = bits_per_channel;
51 } 53 }
52 54
53 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 55 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
54 const gfx::Rect& rect, 56 const gfx::Rect& rect,
55 const gfx::Rect& opaque_rect, 57 const gfx::Rect& opaque_rect,
56 const gfx::Rect& visible_rect, 58 const gfx::Rect& visible_rect,
57 bool needs_blending, 59 bool needs_blending,
58 const gfx::RectF& ya_tex_coord_rect, 60 const gfx::RectF& ya_tex_coord_rect,
59 const gfx::RectF& uv_tex_coord_rect, 61 const gfx::RectF& uv_tex_coord_rect,
60 const gfx::Size& ya_tex_size, 62 const gfx::Size& ya_tex_size,
61 const gfx::Size& uv_tex_size, 63 const gfx::Size& uv_tex_size,
62 unsigned y_plane_resource_id, 64 unsigned y_plane_resource_id,
63 unsigned u_plane_resource_id, 65 unsigned u_plane_resource_id,
64 unsigned v_plane_resource_id, 66 unsigned v_plane_resource_id,
65 unsigned a_plane_resource_id, 67 unsigned a_plane_resource_id,
66 ColorSpace color_space, 68 ColorSpace color_space,
67 float offset, 69 float offset,
68 float multiplier) { 70 float multiplier,
71 uint32_t bits_per_channel) {
69 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 72 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
70 opaque_rect, visible_rect, needs_blending); 73 opaque_rect, visible_rect, needs_blending);
71 this->ya_tex_coord_rect = ya_tex_coord_rect; 74 this->ya_tex_coord_rect = ya_tex_coord_rect;
72 this->uv_tex_coord_rect = uv_tex_coord_rect; 75 this->uv_tex_coord_rect = uv_tex_coord_rect;
73 this->ya_tex_size = ya_tex_size; 76 this->ya_tex_size = ya_tex_size;
74 this->uv_tex_size = uv_tex_size; 77 this->uv_tex_size = uv_tex_size;
75 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; 78 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id;
76 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; 79 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id;
77 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; 80 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id;
78 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; 81 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id;
79 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3; 82 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3;
80 this->color_space = color_space; 83 this->color_space = color_space;
81 this->resource_offset = offset; 84 this->resource_offset = offset;
82 this->resource_multiplier = multiplier; 85 this->resource_multiplier = multiplier;
86 this->bits_per_channel = bits_per_channel;
83 } 87 }
84 88
85 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( 89 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast(
86 const DrawQuad* quad) { 90 const DrawQuad* quad) {
87 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); 91 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT);
88 return static_cast<const YUVVideoDrawQuad*>(quad); 92 return static_cast<const YUVVideoDrawQuad*>(quad);
89 } 93 }
90 94
91 void YUVVideoDrawQuad::ExtendValue( 95 void YUVVideoDrawQuad::ExtendValue(
92 base::trace_event::TracedValue* value) const { 96 base::trace_event::TracedValue* value) const {
93 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value); 97 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value);
94 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value); 98 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value);
95 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value); 99 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value);
96 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value); 100 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value);
97 value->SetInteger("y_plane_resource_id", 101 value->SetInteger("y_plane_resource_id",
98 resources.ids[kYPlaneResourceIdIndex]); 102 resources.ids[kYPlaneResourceIdIndex]);
99 value->SetInteger("u_plane_resource_id", 103 value->SetInteger("u_plane_resource_id",
100 resources.ids[kUPlaneResourceIdIndex]); 104 resources.ids[kUPlaneResourceIdIndex]);
101 value->SetInteger("v_plane_resource_id", 105 value->SetInteger("v_plane_resource_id",
102 resources.ids[kVPlaneResourceIdIndex]); 106 resources.ids[kVPlaneResourceIdIndex]);
103 value->SetInteger("a_plane_resource_id", 107 value->SetInteger("a_plane_resource_id",
104 resources.ids[kAPlaneResourceIdIndex]); 108 resources.ids[kAPlaneResourceIdIndex]);
105 } 109 }
106 110
107 } // namespace cc 111 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698