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

Side by Side Diff: cc/layers/io_surface_layer_impl.cc

Issue 1096703006: cc: Some more cleanup and removing TODOs for validating resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 render_pass, content_bounds(), shared_quad_state, append_quads_data); 70 render_pass, content_bounds(), shared_quad_state, append_quads_data);
71 71
72 gfx::Rect quad_rect(content_bounds()); 72 gfx::Rect quad_rect(content_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 // TODO(danakj): crbug.com/455931
81 layer_tree_impl()->resource_provider()->ValidateResource(
82 io_surface_resource_id_);
83 IOSurfaceDrawQuad* quad = 80 IOSurfaceDrawQuad* quad =
84 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>(); 81 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>();
85 quad->SetNew(shared_quad_state, 82 quad->SetNew(shared_quad_state,
86 quad_rect, 83 quad_rect,
87 opaque_rect, 84 opaque_rect,
88 visible_quad_rect, 85 visible_quad_rect,
89 io_surface_size_, 86 io_surface_size_,
90 io_surface_resource_id_, 87 io_surface_resource_id_,
91 IOSurfaceDrawQuad::FLIPPED); 88 IOSurfaceDrawQuad::FLIPPED);
89 ValidateQuadResources(quad);
92 } 90 }
93 91
94 void IOSurfaceLayerImpl::ReleaseResources() { 92 void IOSurfaceLayerImpl::ReleaseResources() {
95 // We don't have a valid resource ID in the new context; however, 93 // We don't have a valid resource ID in the new context; however,
96 // the IOSurface is still valid. 94 // the IOSurface is still valid.
97 DestroyResource(); 95 DestroyResource();
98 io_surface_changed_ = true; 96 io_surface_changed_ = true;
99 } 97 }
100 98
101 void IOSurfaceLayerImpl::SetIOSurfaceProperties(unsigned io_surface_id, 99 void IOSurfaceLayerImpl::SetIOSurfaceProperties(unsigned io_surface_id,
102 const gfx::Size& size) { 100 const gfx::Size& size) {
103 if (io_surface_id_ != io_surface_id) 101 if (io_surface_id_ != io_surface_id)
104 io_surface_changed_ = true; 102 io_surface_changed_ = true;
105 103
106 io_surface_id_ = io_surface_id; 104 io_surface_id_ = io_surface_id;
107 io_surface_size_ = size; 105 io_surface_size_ = size;
108 } 106 }
109 107
110 const char* IOSurfaceLayerImpl::LayerTypeAsString() const { 108 const char* IOSurfaceLayerImpl::LayerTypeAsString() const {
111 return "cc::IOSurfaceLayerImpl"; 109 return "cc::IOSurfaceLayerImpl";
112 } 110 }
113 111
114 } // namespace cc 112 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698