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

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

Issue 2773103002: cc: Unify all sources of color space for YUVVideoDrawQuad (Closed)
Patch Set: Created 3 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
« no previous file with comments | « cc/quads/yuv_video_draw_quad.h ('k') | cc/resources/video_resource_updater.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
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& 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,
34 const gfx::ColorSpace& video_color_space,
35 float offset, 33 float offset,
36 float multiplier, 34 float multiplier,
37 uint32_t bits_per_channel) { 35 uint32_t bits_per_channel) {
38 bool needs_blending = false; 36 bool needs_blending = false;
39 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 37 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
40 opaque_rect, visible_rect, needs_blending); 38 opaque_rect, visible_rect, needs_blending);
41 this->ya_tex_coord_rect = ya_tex_coord_rect; 39 this->ya_tex_coord_rect = ya_tex_coord_rect;
42 this->uv_tex_coord_rect = uv_tex_coord_rect; 40 this->uv_tex_coord_rect = uv_tex_coord_rect;
43 this->ya_tex_size = ya_tex_size; 41 this->ya_tex_size = ya_tex_size;
44 this->uv_tex_size = uv_tex_size; 42 this->uv_tex_size = uv_tex_size;
45 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; 43 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id;
46 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; 44 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id;
47 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; 45 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id;
48 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; 46 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id;
49 resources.count = a_plane_resource_id ? 4 : 3; 47 resources.count = a_plane_resource_id ? 4 : 3;
50 this->color_space = color_space;
51 this->video_color_space = video_color_space;
52 this->resource_offset = offset; 48 this->resource_offset = offset;
53 this->resource_multiplier = multiplier; 49 this->resource_multiplier = multiplier;
54 this->bits_per_channel = bits_per_channel; 50 this->bits_per_channel = bits_per_channel;
55 } 51 }
56 52
57 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 53 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
58 const gfx::Rect& rect, 54 const gfx::Rect& rect,
59 const gfx::Rect& opaque_rect, 55 const gfx::Rect& opaque_rect,
60 const gfx::Rect& visible_rect, 56 const gfx::Rect& visible_rect,
61 bool needs_blending, 57 bool needs_blending,
62 const gfx::RectF& ya_tex_coord_rect, 58 const gfx::RectF& ya_tex_coord_rect,
63 const gfx::RectF& uv_tex_coord_rect, 59 const gfx::RectF& uv_tex_coord_rect,
64 const gfx::Size& ya_tex_size, 60 const gfx::Size& ya_tex_size,
65 const gfx::Size& uv_tex_size, 61 const gfx::Size& uv_tex_size,
66 unsigned y_plane_resource_id, 62 unsigned y_plane_resource_id,
67 unsigned u_plane_resource_id, 63 unsigned u_plane_resource_id,
68 unsigned v_plane_resource_id, 64 unsigned v_plane_resource_id,
69 unsigned a_plane_resource_id, 65 unsigned a_plane_resource_id,
70 ColorSpace color_space,
71 const gfx::ColorSpace& video_color_space,
72 float offset, 66 float offset,
73 float multiplier, 67 float multiplier,
74 uint32_t bits_per_channel) { 68 uint32_t bits_per_channel) {
75 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 69 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
76 opaque_rect, visible_rect, needs_blending); 70 opaque_rect, visible_rect, needs_blending);
77 this->ya_tex_coord_rect = ya_tex_coord_rect; 71 this->ya_tex_coord_rect = ya_tex_coord_rect;
78 this->uv_tex_coord_rect = uv_tex_coord_rect; 72 this->uv_tex_coord_rect = uv_tex_coord_rect;
79 this->ya_tex_size = ya_tex_size; 73 this->ya_tex_size = ya_tex_size;
80 this->uv_tex_size = uv_tex_size; 74 this->uv_tex_size = uv_tex_size;
81 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; 75 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id;
82 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; 76 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id;
83 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; 77 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id;
84 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; 78 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id;
85 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3; 79 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3;
86 this->color_space = color_space;
87 this->video_color_space = video_color_space;
88 this->resource_offset = offset; 80 this->resource_offset = offset;
89 this->resource_multiplier = multiplier; 81 this->resource_multiplier = multiplier;
90 this->bits_per_channel = bits_per_channel; 82 this->bits_per_channel = bits_per_channel;
91 } 83 }
92 84
93 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( 85 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast(
94 const DrawQuad* quad) { 86 const DrawQuad* quad) {
95 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); 87 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT);
96 return static_cast<const YUVVideoDrawQuad*>(quad); 88 return static_cast<const YUVVideoDrawQuad*>(quad);
97 } 89 }
98 90
99 void YUVVideoDrawQuad::ExtendValue( 91 void YUVVideoDrawQuad::ExtendValue(
100 base::trace_event::TracedValue* value) const { 92 base::trace_event::TracedValue* value) const {
101 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value); 93 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value);
102 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value); 94 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value);
103 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value); 95 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value);
104 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value); 96 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value);
105 value->SetInteger("y_plane_resource_id", 97 value->SetInteger("y_plane_resource_id",
106 resources.ids[kYPlaneResourceIdIndex]); 98 resources.ids[kYPlaneResourceIdIndex]);
107 value->SetInteger("u_plane_resource_id", 99 value->SetInteger("u_plane_resource_id",
108 resources.ids[kUPlaneResourceIdIndex]); 100 resources.ids[kUPlaneResourceIdIndex]);
109 value->SetInteger("v_plane_resource_id", 101 value->SetInteger("v_plane_resource_id",
110 resources.ids[kVPlaneResourceIdIndex]); 102 resources.ids[kVPlaneResourceIdIndex]);
111 value->SetInteger("a_plane_resource_id", 103 value->SetInteger("a_plane_resource_id",
112 resources.ids[kAPlaneResourceIdIndex]); 104 resources.ids[kAPlaneResourceIdIndex]);
113 } 105 }
114 106
115 } // namespace cc 107 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/yuv_video_draw_quad.h ('k') | cc/resources/video_resource_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698