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

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

Issue 12157002: Adding YUVA support for enabling Alpha Playback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and calming down the try bots Created 7 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 | Annotate | Revision Log
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 8
9 namespace cc { 9 namespace cc {
10 10
11 YUVVideoDrawQuad::YUVVideoDrawQuad() 11 YUVVideoDrawQuad::YUVVideoDrawQuad()
12 : y_plane_resource_id(0), 12 : y_plane_resource_id(0),
13 u_plane_resource_id(0), 13 u_plane_resource_id(0),
14 v_plane_resource_id(0) {} 14 v_plane_resource_id(0),
15 a_plane_resource_id(0) {}
15 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} 16 YUVVideoDrawQuad::~YUVVideoDrawQuad() {}
16 17
17 scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { 18 scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() {
18 return make_scoped_ptr(new YUVVideoDrawQuad); 19 return make_scoped_ptr(new YUVVideoDrawQuad);
19 } 20 }
20 21
21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 22 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
22 gfx::Rect rect, 23 gfx::Rect rect,
23 gfx::Rect opaque_rect, 24 gfx::Rect opaque_rect,
24 gfx::SizeF tex_scale, 25 gfx::SizeF tex_scale,
25 unsigned y_plane_resource_id, 26 unsigned y_plane_resource_id,
26 unsigned u_plane_resource_id, 27 unsigned u_plane_resource_id,
27 unsigned v_plane_resource_id) { 28 unsigned v_plane_resource_id,
29 unsigned a_plane_resource_id) {
28 gfx::Rect visible_rect = rect; 30 gfx::Rect visible_rect = rect;
29 bool needs_blending = false; 31 bool needs_blending = false;
30 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 32 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
31 opaque_rect, visible_rect, needs_blending); 33 opaque_rect, visible_rect, needs_blending);
32 this->tex_scale = tex_scale; 34 this->tex_scale = tex_scale;
33 this->y_plane_resource_id = y_plane_resource_id; 35 this->y_plane_resource_id = y_plane_resource_id;
34 this->u_plane_resource_id = u_plane_resource_id; 36 this->u_plane_resource_id = u_plane_resource_id;
35 this->v_plane_resource_id = v_plane_resource_id; 37 this->v_plane_resource_id = v_plane_resource_id;
38 this->a_plane_resource_id = a_plane_resource_id;
36 } 39 }
37 40
38 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 41 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
39 gfx::Rect rect, 42 gfx::Rect rect,
40 gfx::Rect opaque_rect, 43 gfx::Rect opaque_rect,
41 gfx::Rect visible_rect, 44 gfx::Rect visible_rect,
42 bool needs_blending, 45 bool needs_blending,
43 gfx::SizeF tex_scale, 46 gfx::SizeF tex_scale,
44 unsigned y_plane_resource_id, 47 unsigned y_plane_resource_id,
45 unsigned u_plane_resource_id, 48 unsigned u_plane_resource_id,
46 unsigned v_plane_resource_id) { 49 unsigned v_plane_resource_id,
50 unsigned a_plane_resource_id) {
47 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, 51 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
48 opaque_rect, visible_rect, needs_blending); 52 opaque_rect, visible_rect, needs_blending);
49 this->tex_scale = tex_scale; 53 this->tex_scale = tex_scale;
50 this->y_plane_resource_id = y_plane_resource_id; 54 this->y_plane_resource_id = y_plane_resource_id;
51 this->u_plane_resource_id = u_plane_resource_id; 55 this->u_plane_resource_id = u_plane_resource_id;
52 this->v_plane_resource_id = v_plane_resource_id; 56 this->v_plane_resource_id = v_plane_resource_id;
57 this->a_plane_resource_id = a_plane_resource_id;
53 } 58 }
54 59
55 void YUVVideoDrawQuad::IterateResources( 60 void YUVVideoDrawQuad::IterateResources(
56 const ResourceIteratorCallback& callback) { 61 const ResourceIteratorCallback& callback) {
57 y_plane_resource_id = callback.Run(y_plane_resource_id); 62 y_plane_resource_id = callback.Run(y_plane_resource_id);
58 u_plane_resource_id = callback.Run(u_plane_resource_id); 63 u_plane_resource_id = callback.Run(u_plane_resource_id);
59 v_plane_resource_id = callback.Run(v_plane_resource_id); 64 v_plane_resource_id = callback.Run(v_plane_resource_id);
65 if (a_plane_resource_id)
66 a_plane_resource_id = callback.Run(a_plane_resource_id);
60 } 67 }
61 68
62 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( 69 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast(
63 const DrawQuad* quad) { 70 const DrawQuad* quad) {
64 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); 71 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT);
65 return static_cast<const YUVVideoDrawQuad*>(quad); 72 return static_cast<const YUVVideoDrawQuad*>(quad);
66 } 73 }
67 74
68 } // namespace cc 75 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698