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

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: fix more tests 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() { 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,
23 bool allow_overlay,
22 const gfx::Transform& matrix) { 24 const gfx::Transform& matrix) {
23 bool needs_blending = false; 25 bool needs_blending = false;
24 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect, 26 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
25 opaque_rect, visible_rect, needs_blending); 27 opaque_rect, visible_rect, needs_blending);
26 resources.ids[kResourceIdIndex] = resource_id; 28 resources.ids[kResourceIdIndex] = resource_id;
29 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
30 overlay_resources.allow_overlay[kResourceIdIndex] = allow_overlay;
27 resources.count = 1; 31 resources.count = 1;
28 this->matrix = matrix; 32 this->matrix = matrix;
29 } 33 }
30 34
31 void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 35 void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
32 const gfx::Rect& rect, 36 const gfx::Rect& rect,
33 const gfx::Rect& opaque_rect, 37 const gfx::Rect& opaque_rect,
34 const gfx::Rect& visible_rect, 38 const gfx::Rect& visible_rect,
35 bool needs_blending, 39 bool needs_blending,
36 unsigned resource_id, 40 unsigned resource_id,
41 gfx::Size resource_size_in_pixels,
42 bool allow_overlay,
37 const gfx::Transform& matrix) { 43 const gfx::Transform& matrix) {
38 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect, 44 DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
39 opaque_rect, visible_rect, needs_blending); 45 opaque_rect, visible_rect, needs_blending);
40 resources.ids[kResourceIdIndex] = resource_id; 46 resources.ids[kResourceIdIndex] = resource_id;
47 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
48 overlay_resources.allow_overlay[kResourceIdIndex] = allow_overlay;
41 resources.count = 1; 49 resources.count = 1;
42 this->matrix = matrix; 50 this->matrix = matrix;
43 } 51 }
44 52
45 const StreamVideoDrawQuad* StreamVideoDrawQuad::MaterialCast( 53 const StreamVideoDrawQuad* StreamVideoDrawQuad::MaterialCast(
46 const DrawQuad* quad) { 54 const DrawQuad* quad) {
47 DCHECK(quad->material == DrawQuad::STREAM_VIDEO_CONTENT); 55 DCHECK(quad->material == DrawQuad::STREAM_VIDEO_CONTENT);
48 return static_cast<const StreamVideoDrawQuad*>(quad); 56 return static_cast<const StreamVideoDrawQuad*>(quad);
49 } 57 }
50 58
51 void StreamVideoDrawQuad::ExtendValue( 59 void StreamVideoDrawQuad::ExtendValue(
52 base::trace_event::TracedValue* value) const { 60 base::trace_event::TracedValue* value) const {
53 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]); 61 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]);
54 MathUtil::AddToTracedValue("matrix", matrix, value); 62 MathUtil::AddToTracedValue("matrix", matrix, value);
55 } 63 }
56 64
65 StreamVideoDrawQuad::OverlayResources::OverlayResources() {
66 for (size_t i = 0; i < Resources::kMaxResourceIdCount; ++i)
67 allow_overlay[i] = false;
68 }
69
57 } // namespace cc 70 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698