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/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/trace_event/trace_event_argument.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/layer_tree_impl.h" |
19 #include "cc/trees/occlusion.h" | 20 #include "cc/trees/occlusion.h" |
20 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
21 #include "ui/gfx/geometry/quad_f.h" | 22 #include "ui/gfx/geometry/quad_f.h" |
22 | 23 |
23 namespace cc { | 24 namespace cc { |
24 | 25 |
25 class DrawableTile : public LayerTilingData::Tile { | 26 class DrawableTile : public LayerTilingData::Tile { |
26 public: | 27 public: |
27 static scoped_ptr<DrawableTile> Create() { | 28 static scoped_ptr<DrawableTile> Create() { |
28 return make_scoped_ptr(new DrawableTile()); | 29 return make_scoped_ptr(new DrawableTile()); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // offset the same amount. | 253 // offset the same amount. |
253 gfx::Vector2d display_offset = tile_rect.origin() - display_rect.origin(); | 254 gfx::Vector2d display_offset = tile_rect.origin() - display_rect.origin(); |
254 gfx::Vector2d texture_offset = | 255 gfx::Vector2d texture_offset = |
255 tiler_->texture_offset(i, j) + display_offset; | 256 tiler_->texture_offset(i, j) + display_offset; |
256 gfx::RectF tex_coord_rect = gfx::RectF(tile_rect.size()) + texture_offset; | 257 gfx::RectF tex_coord_rect = gfx::RectF(tile_rect.size()) + texture_offset; |
257 | 258 |
258 float tile_width = static_cast<float>(tiler_->tile_size().width()); | 259 float tile_width = static_cast<float>(tiler_->tile_size().width()); |
259 float tile_height = static_cast<float>(tiler_->tile_size().height()); | 260 float tile_height = static_cast<float>(tiler_->tile_size().height()); |
260 gfx::Size texture_size(tile_width, tile_height); | 261 gfx::Size texture_size(tile_width, tile_height); |
261 | 262 |
| 263 // TODO(danakj): crbug.com/455931 |
| 264 layer_tree_impl()->resource_provider()->ValidateResource( |
| 265 tile->resource_id()); |
262 TileDrawQuad* quad = render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); | 266 TileDrawQuad* quad = render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); |
263 quad->SetNew(shared_quad_state, | 267 quad->SetNew(shared_quad_state, |
264 tile_rect, | 268 tile_rect, |
265 tile_opaque_rect, | 269 tile_opaque_rect, |
266 visible_tile_rect, | 270 visible_tile_rect, |
267 tile->resource_id(), | 271 tile->resource_id(), |
268 tex_coord_rect, | 272 tex_coord_rect, |
269 texture_size, | 273 texture_size, |
270 tile->contents_swizzled(), | 274 tile->contents_swizzled(), |
271 false); | 275 false); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 317 |
314 void TiledLayerImpl::ReleaseResources() { | 318 void TiledLayerImpl::ReleaseResources() { |
315 tiler_->reset(); | 319 tiler_->reset(); |
316 } | 320 } |
317 | 321 |
318 const char* TiledLayerImpl::LayerTypeAsString() const { | 322 const char* TiledLayerImpl::LayerTypeAsString() const { |
319 return "cc::TiledLayerImpl"; | 323 return "cc::TiledLayerImpl"; |
320 } | 324 } |
321 | 325 |
322 } // namespace cc | 326 } // namespace cc |
OLD | NEW |