| 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/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 DrawableTile* tile = static_cast<DrawableTile*>(iter->second); | 148 DrawableTile* tile = static_cast<DrawableTile*>(iter->second); |
| 149 | 149 |
| 150 tiled_layer->PushTileProperties(i, | 150 tiled_layer->PushTileProperties(i, |
| 151 j, | 151 j, |
| 152 tile->resource_id(), | 152 tile->resource_id(), |
| 153 tile->opaque_rect(), | 153 tile->opaque_rect(), |
| 154 tile->contents_swizzled()); | 154 tile->contents_swizzled()); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool TiledLayerImpl::WillDraw(DrawMode draw_mode, |
| 159 ResourceProvider* resource_provider) { |
| 160 if (!tiler_ || tiler_->has_empty_bounds() || |
| 161 visible_content_rect().IsEmpty() || |
| 162 draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) |
| 163 return false; |
| 164 return LayerImpl::WillDraw(draw_mode, resource_provider); |
| 165 } |
| 166 |
| 158 void TiledLayerImpl::AppendQuads(QuadSink* quad_sink, | 167 void TiledLayerImpl::AppendQuads(QuadSink* quad_sink, |
| 159 AppendQuadsData* append_quads_data) { | 168 AppendQuadsData* append_quads_data) { |
| 169 DCHECK(tiler_); |
| 170 DCHECK(!tiler_->has_empty_bounds()); |
| 171 DCHECK(!visible_content_rect().IsEmpty()); |
| 172 |
| 160 gfx::Rect content_rect = visible_content_rect(); | 173 gfx::Rect content_rect = visible_content_rect(); |
| 161 | |
| 162 if (!tiler_ || tiler_->has_empty_bounds() || content_rect.IsEmpty()) | |
| 163 return; | |
| 164 | |
| 165 SharedQuadState* shared_quad_state = | 174 SharedQuadState* shared_quad_state = |
| 166 quad_sink->UseSharedQuadState(CreateSharedQuadState()); | 175 quad_sink->UseSharedQuadState(CreateSharedQuadState()); |
| 167 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); | 176 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); |
| 168 | 177 |
| 169 int left, top, right, bottom; | 178 int left, top, right, bottom; |
| 170 tiler_->ContentRectToTileIndices(content_rect, &left, &top, &right, &bottom); | 179 tiler_->ContentRectToTileIndices(content_rect, &left, &top, &right, &bottom); |
| 171 | 180 |
| 172 if (ShowDebugBorders()) { | 181 if (ShowDebugBorders()) { |
| 173 for (int j = top; j <= bottom; ++j) { | 182 for (int j = top; j <= bottom; ++j) { |
| 174 for (int i = left; i <= right; ++i) { | 183 for (int i = left; i <= right; ++i) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 CHECK(tiler_); | 318 CHECK(tiler_); |
| 310 tiler_->reset(); | 319 tiler_->reset(); |
| 311 s_safe_to_delete_drawable_tile = false; | 320 s_safe_to_delete_drawable_tile = false; |
| 312 } | 321 } |
| 313 | 322 |
| 314 const char* TiledLayerImpl::LayerTypeAsString() const { | 323 const char* TiledLayerImpl::LayerTypeAsString() const { |
| 315 return "cc::TiledLayerImpl"; | 324 return "cc::TiledLayerImpl"; |
| 316 } | 325 } |
| 317 | 326 |
| 318 } // namespace cc | 327 } // namespace cc |
| OLD | NEW |