OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/tiled_layer_impl.h" | 5 #include "cc/layers/tiled_layer_impl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/debug/trace_event_argument.h" | |
9 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/trace_event/trace_event_argument.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
11 #include "cc/base/simple_enclosed_region.h" | 11 #include "cc/base/simple_enclosed_region.h" |
12 #include "cc/debug/debug_colors.h" | 12 #include "cc/debug/debug_colors.h" |
13 #include "cc/layers/append_quads_data.h" | 13 #include "cc/layers/append_quads_data.h" |
14 #include "cc/quads/checkerboard_draw_quad.h" | 14 #include "cc/quads/checkerboard_draw_quad.h" |
15 #include "cc/quads/debug_border_draw_quad.h" | 15 #include "cc/quads/debug_border_draw_quad.h" |
16 #include "cc/quads/solid_color_draw_quad.h" | 16 #include "cc/quads/solid_color_draw_quad.h" |
17 #include "cc/quads/tile_draw_quad.h" | 17 #include "cc/quads/tile_draw_quad.h" |
18 #include "cc/resources/layer_tiling_data.h" | 18 #include "cc/resources/layer_tiling_data.h" |
19 #include "cc/trees/occlusion.h" | 19 #include "cc/trees/occlusion.h" |
(...skipping 21 matching lines...) Expand all Loading... |
41 private: | 41 private: |
42 DrawableTile() : resource_id_(0), contents_swizzled_(false) {} | 42 DrawableTile() : resource_id_(0), contents_swizzled_(false) {} |
43 | 43 |
44 ResourceProvider::ResourceId resource_id_; | 44 ResourceProvider::ResourceId resource_id_; |
45 bool contents_swizzled_; | 45 bool contents_swizzled_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(DrawableTile); | 47 DISALLOW_COPY_AND_ASSIGN(DrawableTile); |
48 }; | 48 }; |
49 | 49 |
50 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id) | 50 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id) |
51 : LayerImpl(tree_impl, id), skips_draw_(true) {} | 51 : TiledLayerImpl(tree_impl, id, new LayerImpl::SyncedScrollOffset) { |
| 52 } |
| 53 |
| 54 TiledLayerImpl::TiledLayerImpl( |
| 55 LayerTreeImpl* tree_impl, |
| 56 int id, |
| 57 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset) |
| 58 : LayerImpl(tree_impl, id, synced_scroll_offset), skips_draw_(true) { |
| 59 } |
52 | 60 |
53 TiledLayerImpl::~TiledLayerImpl() { | 61 TiledLayerImpl::~TiledLayerImpl() { |
54 } | 62 } |
55 | 63 |
56 void TiledLayerImpl::GetContentsResourceId( | 64 void TiledLayerImpl::GetContentsResourceId( |
57 ResourceProvider::ResourceId* resource_id, | 65 ResourceProvider::ResourceId* resource_id, |
58 gfx::Size* resource_size) const { | 66 gfx::Size* resource_size) const { |
59 // This function is only valid for single texture layers, e.g. masks. | 67 // This function is only valid for single texture layers, e.g. masks. |
60 DCHECK(tiler_); | 68 DCHECK(tiler_); |
61 // It's possible the mask layer is created but has no size or otherwise | 69 // It's possible the mask layer is created but has no size or otherwise |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 103 } |
96 | 104 |
97 void TiledLayerImpl::GetDebugBorderProperties(SkColor* color, | 105 void TiledLayerImpl::GetDebugBorderProperties(SkColor* color, |
98 float* width) const { | 106 float* width) const { |
99 *color = DebugColors::TiledContentLayerBorderColor(); | 107 *color = DebugColors::TiledContentLayerBorderColor(); |
100 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 108 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
101 } | 109 } |
102 | 110 |
103 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( | 111 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( |
104 LayerTreeImpl* tree_impl) { | 112 LayerTreeImpl* tree_impl) { |
105 return TiledLayerImpl::Create(tree_impl, id()); | 113 return TiledLayerImpl::Create(tree_impl, id(), synced_scroll_offset()); |
106 } | 114 } |
107 | 115 |
108 void TiledLayerImpl::AsValueInto(base::debug::TracedValue* state) const { | 116 void TiledLayerImpl::AsValueInto(base::debug::TracedValue* state) const { |
109 LayerImpl::AsValueInto(state); | 117 LayerImpl::AsValueInto(state); |
110 MathUtil::AddToTracedValue("invalidation", update_rect(), state); | 118 MathUtil::AddToTracedValue("invalidation", update_rect(), state); |
111 } | 119 } |
112 | 120 |
113 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const { | 121 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const { |
114 size_t amount = 0; | 122 size_t amount = 0; |
115 const size_t kMemoryUsagePerTileInBytes = | 123 const size_t kMemoryUsagePerTileInBytes = |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 314 |
307 void TiledLayerImpl::ReleaseResources() { | 315 void TiledLayerImpl::ReleaseResources() { |
308 tiler_->reset(); | 316 tiler_->reset(); |
309 } | 317 } |
310 | 318 |
311 const char* TiledLayerImpl::LayerTypeAsString() const { | 319 const char* TiledLayerImpl::LayerTypeAsString() const { |
312 return "cc::TiledLayerImpl"; | 320 return "cc::TiledLayerImpl"; |
313 } | 321 } |
314 | 322 |
315 } // namespace cc | 323 } // namespace cc |
OLD | NEW |