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

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

Issue 308193003: Removed QuadSink and MockQuadCuller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plumLayerImpl
Patch Set: rm unused line Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surface_layer_impl.h" 5 #include "cc/layers/surface_layer_impl.h"
6 6
7 #include "cc/debug/debug_colors.h" 7 #include "cc/debug/debug_colors.h"
8 #include "cc/layers/quad_sink.h"
9 #include "cc/quads/surface_draw_quad.h" 8 #include "cc/quads/surface_draw_quad.h"
9 #include "cc/trees/occlusion_tracker.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 SurfaceLayerImpl::SurfaceLayerImpl(LayerTreeImpl* tree_impl, int id) 13 SurfaceLayerImpl::SurfaceLayerImpl(LayerTreeImpl* tree_impl, int id)
14 : LayerImpl(tree_impl, id), surface_id_(0) {} 14 : LayerImpl(tree_impl, id), surface_id_(0) {}
15 15
16 SurfaceLayerImpl::~SurfaceLayerImpl() {} 16 SurfaceLayerImpl::~SurfaceLayerImpl() {}
17 17
18 scoped_ptr<LayerImpl> SurfaceLayerImpl::CreateLayerImpl( 18 scoped_ptr<LayerImpl> SurfaceLayerImpl::CreateLayerImpl(
19 LayerTreeImpl* tree_impl) { 19 LayerTreeImpl* tree_impl) {
20 return SurfaceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); 20 return SurfaceLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
21 } 21 }
22 22
23 void SurfaceLayerImpl::SetSurfaceId(int surface_id) { 23 void SurfaceLayerImpl::SetSurfaceId(int surface_id) {
24 if (surface_id_ == surface_id) 24 if (surface_id_ == surface_id)
25 return; 25 return;
26 26
27 surface_id_ = surface_id; 27 surface_id_ = surface_id;
28 NoteLayerPropertyChanged(); 28 NoteLayerPropertyChanged();
29 } 29 }
30 30
31 void SurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer) { 31 void SurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer) {
32 LayerImpl::PushPropertiesTo(layer); 32 LayerImpl::PushPropertiesTo(layer);
33 SurfaceLayerImpl* layer_impl = static_cast<SurfaceLayerImpl*>(layer); 33 SurfaceLayerImpl* layer_impl = static_cast<SurfaceLayerImpl*>(layer);
34 34
35 layer_impl->SetSurfaceId(surface_id_); 35 layer_impl->SetSurfaceId(surface_id_);
36 } 36 }
37 37
38 void SurfaceLayerImpl::AppendQuads(QuadSink* quad_sink, 38 void SurfaceLayerImpl::AppendQuads(
39 AppendQuadsData* append_quads_data) { 39 RenderPass* render_pass,
40 SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); 40 const OcclusionTracker<LayerImpl>& occlusion_tracker,
41 AppendQuadsData* append_quads_data) {
42 SharedQuadState* shared_quad_state =
43 render_pass->CreateAndAppendSharedQuadState();
41 PopulateSharedQuadState(shared_quad_state); 44 PopulateSharedQuadState(shared_quad_state);
42 45
43 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); 46 AppendDebugBorderQuad(render_pass, shared_quad_state, append_quads_data);
44 47
45 if (!surface_id_) 48 if (!surface_id_)
46 return; 49 return;
47 50
48 scoped_ptr<SurfaceDrawQuad> quad = SurfaceDrawQuad::Create(); 51 scoped_ptr<SurfaceDrawQuad> quad = SurfaceDrawQuad::Create();
49 gfx::Rect quad_rect(content_bounds()); 52 gfx::Rect quad_rect(content_bounds());
50 gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( 53 gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect(
51 this, quad_rect, draw_properties().target_space_transform); 54 this->render_target(),
55 quad_rect,
56 draw_properties().target_space_transform);
52 if (visible_quad_rect.IsEmpty()) 57 if (visible_quad_rect.IsEmpty())
53 return; 58 return;
54 quad->SetNew(shared_quad_state, quad_rect, visible_quad_rect, surface_id_); 59 quad->SetNew(shared_quad_state, quad_rect, visible_quad_rect, surface_id_);
55 quad_sink->Append(quad.PassAs<DrawQuad>()); 60 render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>());
56 } 61 }
57 62
58 void SurfaceLayerImpl::GetDebugBorderProperties(SkColor* color, 63 void SurfaceLayerImpl::GetDebugBorderProperties(SkColor* color,
59 float* width) const { 64 float* width) const {
60 *color = DebugColors::SurfaceLayerBorderColor(); 65 *color = DebugColors::SurfaceLayerBorderColor();
61 *width = DebugColors::SurfaceLayerBorderWidth(layer_tree_impl()); 66 *width = DebugColors::SurfaceLayerBorderWidth(layer_tree_impl());
62 } 67 }
63 68
64 void SurfaceLayerImpl::AsValueInto(base::DictionaryValue* dict) const { 69 void SurfaceLayerImpl::AsValueInto(base::DictionaryValue* dict) const {
65 LayerImpl::AsValueInto(dict); 70 LayerImpl::AsValueInto(dict);
66 dict->SetInteger("surface_id", surface_id_); 71 dict->SetInteger("surface_id", surface_id_);
67 } 72 }
68 73
69 const char* SurfaceLayerImpl::LayerTypeAsString() const { 74 const char* SurfaceLayerImpl::LayerTypeAsString() const {
70 return "cc::SurfaceLayerImpl"; 75 return "cc::SurfaceLayerImpl";
71 } 76 }
72 77
73 } // namespace cc 78 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698