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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // Temporary diagnostic checks. | 105 // Temporary diagnostic checks. |
106 CHECK(addedTile); | 106 CHECK(addedTile); |
107 CHECK(tileAt(i, j)); | 107 CHECK(tileAt(i, j)); |
108 | 108 |
109 return addedTile; | 109 return addedTile; |
110 } | 110 } |
111 | 111 |
112 void TiledLayerImpl::getDebugBorderProperties(SkColor* color, float* width) cons
t | 112 void TiledLayerImpl::getDebugBorderProperties(SkColor* color, float* width) cons
t |
113 { | 113 { |
114 *color = DebugColors::TiledContentLayerBorderColor(); | 114 *color = DebugColors::TiledContentLayerBorderColor(); |
115 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeHostImpl()); | 115 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); |
116 } | 116 } |
117 | 117 |
118 void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
sData) | 118 void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
sData) |
119 { | 119 { |
120 const gfx::Rect& contentRect = visibleContentRect(); | 120 const gfx::Rect& contentRect = visibleContentRect(); |
121 | 121 |
122 if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.IsEmpty()) | 122 if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.IsEmpty()) |
123 return; | 123 return; |
124 | 124 |
125 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); | 125 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); |
126 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | 126 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); |
127 | 127 |
128 int left, top, right, bottom; | 128 int left, top, right, bottom; |
129 m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); | 129 m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); |
130 | 130 |
131 if (showDebugBorders()) { | 131 if (showDebugBorders()) { |
132 for (int j = top; j <= bottom; ++j) { | 132 for (int j = top; j <= bottom; ++j) { |
133 for (int i = left; i <= right; ++i) { | 133 for (int i = left; i <= right; ++i) { |
134 DrawableTile* tile = tileAt(i, j); | 134 DrawableTile* tile = tileAt(i, j); |
135 gfx::Rect tileRect = m_tiler->tileBounds(i, j); | 135 gfx::Rect tileRect = m_tiler->tileBounds(i, j); |
136 SkColor borderColor; | 136 SkColor borderColor; |
137 float borderWidth; | 137 float borderWidth; |
138 | 138 |
139 if (m_skipsDraw || !tile || !tile->resourceId()) { | 139 if (m_skipsDraw || !tile || !tile->resourceId()) { |
140 borderColor = DebugColors::MissingTileBorderColor(); | 140 borderColor = DebugColors::MissingTileBorderColor(); |
141 borderWidth = DebugColors::MissingTileBorderWidth(layerTreeH
ostImpl()); | 141 borderWidth = DebugColors::MissingTileBorderWidth(layerTreeI
mpl()); |
142 } else { | 142 } else { |
143 borderColor = DebugColors::TileBorderColor(); | 143 borderColor = DebugColors::TileBorderColor(); |
144 borderWidth = DebugColors::TileBorderWidth(layerTreeHostImpl
()); | 144 borderWidth = DebugColors::TileBorderWidth(layerTreeImpl()); |
145 } | 145 } |
146 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDra
wQuad::Create(); | 146 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDra
wQuad::Create(); |
147 debugBorderQuad->SetNew(sharedQuadState, tileRect, borderColor,
borderWidth); | 147 debugBorderQuad->SetNew(sharedQuadState, tileRect, borderColor,
borderWidth); |
148 quadSink.append(debugBorderQuad.PassAs<DrawQuad>(), appendQuadsD
ata); | 148 quadSink.append(debugBorderQuad.PassAs<DrawQuad>(), appendQuadsD
ata); |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 if (m_skipsDraw) | 153 if (m_skipsDraw) |
154 return; | 154 return; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 m_tiler->reset(); | 264 m_tiler->reset(); |
265 safeToDeleteDrawableTile = false; | 265 safeToDeleteDrawableTile = false; |
266 } | 266 } |
267 | 267 |
268 const char* TiledLayerImpl::layerTypeAsString() const | 268 const char* TiledLayerImpl::layerTypeAsString() const |
269 { | 269 { |
270 return "ContentLayer"; | 270 return "ContentLayer"; |
271 } | 271 } |
272 | 272 |
273 } // namespace cc | 273 } // namespace cc |
OLD | NEW |