| 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/layers/io_surface_layer_impl.h" | 5 #include "cc/layers/io_surface_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
| 9 #include "cc/quads/io_surface_draw_quad.h" | 9 #include "cc/quads/io_surface_draw_quad.h" |
| 10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 gfx::Rect quad_rect(bounds()); | 72 gfx::Rect quad_rect(bounds()); |
| 73 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); | 73 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); |
| 74 gfx::Rect visible_quad_rect = | 74 gfx::Rect visible_quad_rect = |
| 75 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 75 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 76 quad_rect); | 76 quad_rect); |
| 77 if (visible_quad_rect.IsEmpty()) | 77 if (visible_quad_rect.IsEmpty()) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 IOSurfaceDrawQuad* quad = | 80 IOSurfaceDrawQuad* quad = |
| 81 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>(); | 81 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>(); |
| 82 quad->SetNew(shared_quad_state, | 82 quad->SetNew(shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, |
| 83 quad_rect, | 83 io_surface_size_, io_surface_resource_id_, |
| 84 opaque_rect, | 84 IOSurfaceDrawQuad::FLIPPED); |
| 85 visible_quad_rect, | |
| 86 io_surface_size_, | |
| 87 io_surface_resource_id_, | |
| 88 IOSurfaceDrawQuad::FLIPPED, | |
| 89 false); | |
| 90 ValidateQuadResources(quad); | 85 ValidateQuadResources(quad); |
| 91 } | 86 } |
| 92 | 87 |
| 93 void IOSurfaceLayerImpl::ReleaseResources() { | 88 void IOSurfaceLayerImpl::ReleaseResources() { |
| 94 // We don't have a valid resource ID in the new context; however, | 89 // We don't have a valid resource ID in the new context; however, |
| 95 // the IOSurface is still valid. | 90 // the IOSurface is still valid. |
| 96 DestroyResource(); | 91 DestroyResource(); |
| 97 io_surface_changed_ = true; | 92 io_surface_changed_ = true; |
| 98 } | 93 } |
| 99 | 94 |
| 100 void IOSurfaceLayerImpl::SetIOSurfaceProperties(unsigned io_surface_id, | 95 void IOSurfaceLayerImpl::SetIOSurfaceProperties(unsigned io_surface_id, |
| 101 const gfx::Size& size) { | 96 const gfx::Size& size) { |
| 102 if (io_surface_id_ != io_surface_id) | 97 if (io_surface_id_ != io_surface_id) |
| 103 io_surface_changed_ = true; | 98 io_surface_changed_ = true; |
| 104 | 99 |
| 105 io_surface_id_ = io_surface_id; | 100 io_surface_id_ = io_surface_id; |
| 106 io_surface_size_ = size; | 101 io_surface_size_ = size; |
| 107 } | 102 } |
| 108 | 103 |
| 109 const char* IOSurfaceLayerImpl::LayerTypeAsString() const { | 104 const char* IOSurfaceLayerImpl::LayerTypeAsString() const { |
| 110 return "cc::IOSurfaceLayerImpl"; | 105 return "cc::IOSurfaceLayerImpl"; |
| 111 } | 106 } |
| 112 | 107 |
| 113 } // namespace cc | 108 } // namespace cc |
| OLD | NEW |