| 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/io_surface_draw_quad.h" | 5 #include "cc/quads/io_surface_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 IOSurfaceDrawQuad::IOSurfaceDrawQuad() | 14 IOSurfaceDrawQuad::IOSurfaceDrawQuad() : orientation(FLIPPED) {} |
| 15 : orientation(FLIPPED), allow_overlay(false) { | |
| 16 } | |
| 17 | 15 |
| 18 void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 16 void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 19 const gfx::Rect& rect, | 17 const gfx::Rect& rect, |
| 20 const gfx::Rect& opaque_rect, | 18 const gfx::Rect& opaque_rect, |
| 21 const gfx::Rect& visible_rect, | 19 const gfx::Rect& visible_rect, |
| 22 const gfx::Size& io_surface_size, | 20 const gfx::Size& io_surface_size, |
| 23 unsigned io_surface_resource_id, | 21 unsigned io_surface_resource_id, |
| 24 Orientation orientation, | 22 Orientation orientation) { |
| 25 bool allow_overlay) { | |
| 26 bool needs_blending = false; | 23 bool needs_blending = false; |
| 27 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, | 24 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, |
| 28 opaque_rect, visible_rect, needs_blending); | 25 opaque_rect, visible_rect, needs_blending); |
| 29 this->io_surface_size = io_surface_size; | 26 this->io_surface_size = io_surface_size; |
| 30 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id; | 27 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id; |
| 31 resources.count = 1; | 28 resources.count = 1; |
| 32 this->orientation = orientation; | 29 this->orientation = orientation; |
| 33 this->allow_overlay = allow_overlay; | |
| 34 } | 30 } |
| 35 | 31 |
| 36 void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 32 void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 37 const gfx::Rect& rect, | 33 const gfx::Rect& rect, |
| 38 const gfx::Rect& opaque_rect, | 34 const gfx::Rect& opaque_rect, |
| 39 const gfx::Rect& visible_rect, | 35 const gfx::Rect& visible_rect, |
| 40 bool needs_blending, | 36 bool needs_blending, |
| 41 const gfx::Size& io_surface_size, | 37 const gfx::Size& io_surface_size, |
| 42 unsigned io_surface_resource_id, | 38 unsigned io_surface_resource_id, |
| 43 Orientation orientation, | 39 Orientation orientation) { |
| 44 bool allow_overlay) { | |
| 45 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, | 40 DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, |
| 46 opaque_rect, visible_rect, needs_blending); | 41 opaque_rect, visible_rect, needs_blending); |
| 47 this->io_surface_size = io_surface_size; | 42 this->io_surface_size = io_surface_size; |
| 48 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id; | 43 resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id; |
| 49 resources.count = 1; | 44 resources.count = 1; |
| 50 this->orientation = orientation; | 45 this->orientation = orientation; |
| 51 this->allow_overlay = allow_overlay; | |
| 52 } | 46 } |
| 53 | 47 |
| 54 const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast( | 48 const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast( |
| 55 const DrawQuad* quad) { | 49 const DrawQuad* quad) { |
| 56 DCHECK(quad->material == DrawQuad::IO_SURFACE_CONTENT); | 50 DCHECK(quad->material == DrawQuad::IO_SURFACE_CONTENT); |
| 57 return static_cast<const IOSurfaceDrawQuad*>(quad); | 51 return static_cast<const IOSurfaceDrawQuad*>(quad); |
| 58 } | 52 } |
| 59 | 53 |
| 60 void IOSurfaceDrawQuad::ExtendValue( | 54 void IOSurfaceDrawQuad::ExtendValue( |
| 61 base::trace_event::TracedValue* value) const { | 55 base::trace_event::TracedValue* value) const { |
| 62 MathUtil::AddToTracedValue("io_surface_size", io_surface_size, value); | 56 MathUtil::AddToTracedValue("io_surface_size", io_surface_size, value); |
| 63 | 57 |
| 64 value->SetInteger("io_surface_resource_id", | 58 value->SetInteger("io_surface_resource_id", |
| 65 resources.ids[kIOSurfaceResourceIdIndex]); | 59 resources.ids[kIOSurfaceResourceIdIndex]); |
| 66 const char* orientation_string = NULL; | 60 const char* orientation_string = NULL; |
| 67 switch (orientation) { | 61 switch (orientation) { |
| 68 case FLIPPED: | 62 case FLIPPED: |
| 69 orientation_string = "flipped"; | 63 orientation_string = "flipped"; |
| 70 break; | 64 break; |
| 71 case UNFLIPPED: | 65 case UNFLIPPED: |
| 72 orientation_string = "unflipped"; | 66 orientation_string = "unflipped"; |
| 73 break; | 67 break; |
| 74 } | 68 } |
| 75 | 69 |
| 76 value->SetString("orientation", orientation_string); | 70 value->SetString("orientation", orientation_string); |
| 77 } | 71 } |
| 78 | 72 |
| 79 } // namespace cc | 73 } // namespace cc |
| OLD | NEW |