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/tiled_layer_impl.h" | 5 #include "cc/tiled_layer_impl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "cc/append_quads_data.h" | 9 #include "cc/append_quads_data.h" |
10 #include "cc/checkerboard_draw_quad.h" | 10 #include "cc/checkerboard_draw_quad.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 return addedTile; | 107 return addedTile; |
108 } | 108 } |
109 | 109 |
110 void TiledLayerImpl::getDebugBorderProperties(SkColor* color, float* width) cons
t | 110 void TiledLayerImpl::getDebugBorderProperties(SkColor* color, float* width) cons
t |
111 { | 111 { |
112 *color = DebugColors::TiledContentLayerBorderColor(); | 112 *color = DebugColors::TiledContentLayerBorderColor(); |
113 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); | 113 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); |
114 } | 114 } |
115 | 115 |
| 116 scoped_ptr<LayerImpl> TiledLayerImpl::createLayerImpl(LayerTreeImpl* treeImpl) |
| 117 { |
| 118 return TiledLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); |
| 119 } |
| 120 |
| 121 void TiledLayerImpl::pushPropertiesTo(LayerImpl* layer) |
| 122 { |
| 123 LayerImpl::pushPropertiesTo(layer); |
| 124 |
| 125 TiledLayerImpl* tiledLayer = static_cast<TiledLayerImpl*>(layer); |
| 126 |
| 127 tiledLayer->setSkipsDraw(m_skipsDraw); |
| 128 tiledLayer->setTilingData(*m_tiler); |
| 129 |
| 130 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(
); iter != m_tiler->tiles().end(); ++iter) { |
| 131 int i = iter->first.first; |
| 132 int j = iter->first.second; |
| 133 DrawableTile* tile = static_cast<DrawableTile*>(iter->second); |
| 134 |
| 135 tiledLayer->pushTileProperties(i, j, tile->resourceId(), tile->opaqueRec
t(), tile->contentsSwizzled()); |
| 136 } |
| 137 } |
| 138 |
116 void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
sData) | 139 void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
sData) |
117 { | 140 { |
118 const gfx::Rect& contentRect = visibleContentRect(); | 141 const gfx::Rect& contentRect = visibleContentRect(); |
119 | 142 |
120 if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.IsEmpty()) | 143 if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.IsEmpty()) |
121 return; | 144 return; |
122 | 145 |
123 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); | 146 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); |
124 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | 147 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); |
125 | 148 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 m_tiler->reset(); | 285 m_tiler->reset(); |
263 safeToDeleteDrawableTile = false; | 286 safeToDeleteDrawableTile = false; |
264 } | 287 } |
265 | 288 |
266 const char* TiledLayerImpl::layerTypeAsString() const | 289 const char* TiledLayerImpl::layerTypeAsString() const |
267 { | 290 { |
268 return "ContentLayer"; | 291 return "ContentLayer"; |
269 } | 292 } |
270 | 293 |
271 } // namespace cc | 294 } // namespace cc |
OLD | NEW |