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