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