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

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

Issue 633773004: cc: Pass Occlusion instead of OcclusionTracker to LayerImpls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 years, 2 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
« no previous file with comments | « cc/layers/io_surface_layer_impl.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gl_renderer.h" // For the GLC() macro. 8 #include "cc/output/gl_renderer.h" // For the GLC() macro.
9 #include "cc/output/output_surface.h" 9 #include "cc/output/output_surface.h"
10 #include "cc/quads/io_surface_draw_quad.h" 10 #include "cc/quads/io_surface_draw_quad.h"
11 #include "cc/trees/layer_tree_impl.h" 11 #include "cc/trees/layer_tree_impl.h"
12 #include "cc/trees/occlusion_tracker.h" 12 #include "cc/trees/occlusion.h"
13 #include "gpu/GLES2/gl2extchromium.h" 13 #include "gpu/GLES2/gl2extchromium.h"
14 #include "gpu/command_buffer/client/gles2_interface.h" 14 #include "gpu/command_buffer/client/gles2_interface.h"
15 #include "third_party/khronos/GLES2/gl2.h" 15 #include "third_party/khronos/GLES2/gl2.h"
16 #include "third_party/khronos/GLES2/gl2ext.h" 16 #include "third_party/khronos/GLES2/gl2ext.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 IOSurfaceLayerImpl::IOSurfaceLayerImpl(LayerTreeImpl* tree_impl, int id) 20 IOSurfaceLayerImpl::IOSurfaceLayerImpl(LayerTreeImpl* tree_impl, int id)
21 : LayerImpl(tree_impl, id), 21 : LayerImpl(tree_impl, id),
22 io_surface_id_(0), 22 io_surface_id_(0),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 io_surface_resource_id_ = resource_provider->CreateResourceFromIOSurface( 59 io_surface_resource_id_ = resource_provider->CreateResourceFromIOSurface(
60 io_surface_size_, io_surface_id_); 60 io_surface_size_, io_surface_id_);
61 io_surface_changed_ = false; 61 io_surface_changed_ = false;
62 } 62 }
63 63
64 return LayerImpl::WillDraw(draw_mode, resource_provider); 64 return LayerImpl::WillDraw(draw_mode, resource_provider);
65 } 65 }
66 66
67 void IOSurfaceLayerImpl::AppendQuads( 67 void IOSurfaceLayerImpl::AppendQuads(
68 RenderPass* render_pass, 68 RenderPass* render_pass,
69 const OcclusionTracker<LayerImpl>& occlusion_tracker, 69 const Occlusion& occlusion_in_content_space,
70 AppendQuadsData* append_quads_data) { 70 AppendQuadsData* append_quads_data) {
71 SharedQuadState* shared_quad_state = 71 SharedQuadState* shared_quad_state =
72 render_pass->CreateAndAppendSharedQuadState(); 72 render_pass->CreateAndAppendSharedQuadState();
73 PopulateSharedQuadState(shared_quad_state); 73 PopulateSharedQuadState(shared_quad_state);
74 74
75 AppendDebugBorderQuad( 75 AppendDebugBorderQuad(
76 render_pass, content_bounds(), shared_quad_state, append_quads_data); 76 render_pass, content_bounds(), shared_quad_state, append_quads_data);
77 77
78 gfx::Rect quad_rect(content_bounds()); 78 gfx::Rect quad_rect(content_bounds());
79 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); 79 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect());
80 gfx::Rect visible_quad_rect = 80 gfx::Rect visible_quad_rect =
81 occlusion_tracker.GetCurrentOcclusionForLayer( 81 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect);
82 draw_properties().target_space_transform)
83 .GetUnoccludedContentRect(quad_rect);
84 if (visible_quad_rect.IsEmpty()) 82 if (visible_quad_rect.IsEmpty())
85 return; 83 return;
86 84
87 IOSurfaceDrawQuad* quad = 85 IOSurfaceDrawQuad* quad =
88 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>(); 86 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>();
89 quad->SetNew(shared_quad_state, 87 quad->SetNew(shared_quad_state,
90 quad_rect, 88 quad_rect,
91 opaque_rect, 89 opaque_rect,
92 visible_quad_rect, 90 visible_quad_rect,
93 io_surface_size_, 91 io_surface_size_,
(...skipping 15 matching lines...) Expand all
109 107
110 io_surface_id_ = io_surface_id; 108 io_surface_id_ = io_surface_id;
111 io_surface_size_ = size; 109 io_surface_size_ = size;
112 } 110 }
113 111
114 const char* IOSurfaceLayerImpl::LayerTypeAsString() const { 112 const char* IOSurfaceLayerImpl::LayerTypeAsString() const {
115 return "cc::IOSurfaceLayerImpl"; 113 return "cc::IOSurfaceLayerImpl";
116 } 114 }
117 115
118 } // namespace cc 116 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/io_surface_layer_impl.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698