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

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

Issue 2683763003: cc: make resource keep video buffer format for hardware overlay.
Patch Set: plumbing video format to ozone Created 3 years, 10 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/stream_video_draw_quad.h" 5 #include "cc/quads/stream_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 StreamVideoDrawQuad::StreamVideoDrawQuad() { 14 StreamVideoDrawQuad::StreamVideoDrawQuad() {
15 } 15 }
16 16
17 void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 17 void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
18 const gfx::Rect& rect, 18 const gfx::Rect& rect,
19 const gfx::Rect& opaque_rect, 19 const gfx::Rect& opaque_rect,
20 const gfx::Rect& visible_rect, 20 const gfx::Rect& visible_rect,
21 unsigned resource_id, 21 unsigned resource_id,
22 gfx::Size resource_size_in_pixels, 22 gfx::Size resource_size_in_pixels,
23 gfx::BufferFormat format,
23 const gfx::Transform& matrix) { 24 const gfx::Transform& matrix) {
24 bool needs_blending = false; 25 bool needs_blending = false;
25 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect, 26 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
26 opaque_rect, visible_rect, needs_blending); 27 opaque_rect, visible_rect, needs_blending);
27 resources.ids[kResourceIdIndex] = resource_id; 28 resources.ids[kResourceIdIndex] = resource_id;
28 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels; 29 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
29 resources.count = 1; 30 resources.count = 1;
31 this->format = format;
30 this->matrix = matrix; 32 this->matrix = matrix;
31 } 33 }
32 34
33 void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 35 void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
34 const gfx::Rect& rect, 36 const gfx::Rect& rect,
35 const gfx::Rect& opaque_rect, 37 const gfx::Rect& opaque_rect,
36 const gfx::Rect& visible_rect, 38 const gfx::Rect& visible_rect,
37 bool needs_blending, 39 bool needs_blending,
38 unsigned resource_id, 40 unsigned resource_id,
39 gfx::Size resource_size_in_pixels, 41 gfx::Size resource_size_in_pixels,
42 gfx::BufferFormat format,
40 const gfx::Transform& matrix) { 43 const gfx::Transform& matrix) {
41 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect, 44 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
42 opaque_rect, visible_rect, needs_blending); 45 opaque_rect, visible_rect, needs_blending);
43 resources.ids[kResourceIdIndex] = resource_id; 46 resources.ids[kResourceIdIndex] = resource_id;
44 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels; 47 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
45 resources.count = 1; 48 resources.count = 1;
49 this->format = format;
46 this->matrix = matrix; 50 this->matrix = matrix;
47 } 51 }
48 52
49 const StreamVideoDrawQuad* StreamVideoDrawQuad::MaterialCast( 53 const StreamVideoDrawQuad* StreamVideoDrawQuad::MaterialCast(
50 const DrawQuad* quad) { 54 const DrawQuad* quad) {
51 DCHECK(quad->material == DrawQuad::STREAM_VIDEO_CONTENT); 55 DCHECK(quad->material == DrawQuad::STREAM_VIDEO_CONTENT);
52 return static_cast<const StreamVideoDrawQuad*>(quad); 56 return static_cast<const StreamVideoDrawQuad*>(quad);
53 } 57 }
54 58
55 void StreamVideoDrawQuad::ExtendValue( 59 void StreamVideoDrawQuad::ExtendValue(
56 base::trace_event::TracedValue* value) const { 60 base::trace_event::TracedValue* value) const {
57 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]); 61 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]);
62 value->SetInteger("format", static_cast<int>(format));
58 MathUtil::AddToTracedValue("matrix", matrix, value); 63 MathUtil::AddToTracedValue("matrix", matrix, value);
59 } 64 }
60 65
61 StreamVideoDrawQuad::OverlayResources::OverlayResources() { 66 StreamVideoDrawQuad::OverlayResources::OverlayResources() {
62 } 67 }
63 68
64 } // namespace cc 69 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698