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

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

Issue 1142343008: cc: Rework overlays to not use the ResourceProvider and pass texture size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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() : resource_id(0) {} 14 StreamVideoDrawQuad::StreamVideoDrawQuad()
15 : resource_id(0), allow_overlay(false) {
16 }
15 17
16 void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 18 void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
17 const gfx::Rect& rect, 19 const gfx::Rect& rect,
18 const gfx::Rect& opaque_rect, 20 const gfx::Rect& opaque_rect,
19 const gfx::Rect& visible_rect, 21 const gfx::Rect& visible_rect,
20 unsigned resource_id, 22 unsigned resource_id,
21 const gfx::Transform& matrix) { 23 const gfx::Transform& matrix) {
22 bool needs_blending = false; 24 bool needs_blending = false;
23 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect, 25 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
24 opaque_rect, visible_rect, needs_blending); 26 opaque_rect, visible_rect, needs_blending);
25 this->resource_id = resource_id; 27 this->resource_id = resource_id;
26 this->matrix = matrix; 28 this->matrix = matrix;
27 } 29 }
28 30
29 void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 31 void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
30 const gfx::Rect& rect, 32 const gfx::Rect& rect,
31 const gfx::Rect& opaque_rect, 33 const gfx::Rect& opaque_rect,
32 const gfx::Rect& visible_rect, 34 const gfx::Rect& visible_rect,
33 bool needs_blending, 35 bool needs_blending,
34 unsigned resource_id, 36 unsigned resource_id,
37 gfx::Size resource_size_in_pixels,
38 bool allow_overlay,
35 const gfx::Transform& matrix) { 39 const gfx::Transform& matrix) {
36 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect, 40 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
37 opaque_rect, visible_rect, needs_blending); 41 opaque_rect, visible_rect, needs_blending);
38 this->resource_id = resource_id; 42 this->resource_id = resource_id;
43 this->resource_size_in_pixels = resource_size_in_pixels;
44 this->allow_overlay = allow_overlay;
39 this->matrix = matrix; 45 this->matrix = matrix;
40 } 46 }
41 47
42 void StreamVideoDrawQuad::IterateResources( 48 void StreamVideoDrawQuad::IterateResources(
43 const ResourceIteratorCallback& callback) { 49 const ResourceIteratorCallback& callback) {
44 resource_id = callback.Run(resource_id); 50 resource_id = callback.Run(resource_id);
45 } 51 }
46 52
47 const StreamVideoDrawQuad* StreamVideoDrawQuad::MaterialCast( 53 const StreamVideoDrawQuad* StreamVideoDrawQuad::MaterialCast(
48 const DrawQuad* quad) { 54 const DrawQuad* quad) {
49 DCHECK(quad->material == DrawQuad::STREAM_VIDEO_CONTENT); 55 DCHECK(quad->material == DrawQuad::STREAM_VIDEO_CONTENT);
50 return static_cast<const StreamVideoDrawQuad*>(quad); 56 return static_cast<const StreamVideoDrawQuad*>(quad);
51 } 57 }
52 58
53 void StreamVideoDrawQuad::ExtendValue( 59 void StreamVideoDrawQuad::ExtendValue(
54 base::trace_event::TracedValue* value) const { 60 base::trace_event::TracedValue* value) const {
55 value->SetInteger("resource_id", resource_id); 61 value->SetInteger("resource_id", resource_id);
56 MathUtil::AddToTracedValue("matrix", matrix, value); 62 MathUtil::AddToTracedValue("matrix", matrix, value);
57 } 63 }
58 64
59 } // namespace cc 65 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698