| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/tile.h" | 5 #include "cc/resources/tile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 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/debug/traced_value.h" | 11 #include "cc/debug/traced_value.h" |
| 12 #include "cc/resources/tile_manager.h" | 12 #include "cc/resources/tile_manager.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 Tile::Id Tile::s_next_id_ = 0; | 16 Tile::Id Tile::s_next_id_ = 1; |
| 17 | 17 |
| 18 Tile::Tile(TileManager* tile_manager, | 18 Tile::Tile(TileManager* tile_manager, |
| 19 const gfx::Size& desired_texture_size, | 19 const gfx::Size& desired_texture_size, |
| 20 const gfx::Rect& content_rect, | 20 const gfx::Rect& content_rect, |
| 21 float contents_scale, | 21 float contents_scale, |
| 22 int layer_id, | 22 int layer_id, |
| 23 int source_frame_number, | 23 int source_frame_number, |
| 24 int flags) | 24 int flags) |
| 25 : tile_manager_(tile_manager), | 25 : tile_manager_(tile_manager), |
| 26 desired_texture_size_(desired_texture_size), | 26 desired_texture_size_(desired_texture_size), |
| 27 content_rect_(content_rect), | 27 content_rect_(content_rect), |
| 28 contents_scale_(contents_scale), | 28 contents_scale_(contents_scale), |
| 29 layer_id_(layer_id), | 29 layer_id_(layer_id), |
| 30 source_frame_number_(source_frame_number), | 30 source_frame_number_(source_frame_number), |
| 31 flags_(flags), | 31 flags_(flags), |
| 32 tiling_i_index_(-1), | 32 tiling_i_index_(-1), |
| 33 tiling_j_index_(-1), | 33 tiling_j_index_(-1), |
| 34 required_for_activation_(false), | 34 required_for_activation_(false), |
| 35 required_for_draw_(false), | 35 required_for_draw_(false), |
| 36 id_(s_next_id_++), | 36 id_(s_next_id_++), |
| 37 invalidated_id_(0), |
| 37 scheduled_priority_(0) { | 38 scheduled_priority_(0) { |
| 38 } | 39 } |
| 39 | 40 |
| 40 Tile::~Tile() { | 41 Tile::~Tile() { |
| 41 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 42 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 42 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 43 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 43 "cc::Tile", this); | 44 "cc::Tile", this); |
| 44 } | 45 } |
| 45 | 46 |
| 46 void Tile::AsValueInto(base::trace_event::TracedValue* value) const { | 47 void Tile::AsValueInto(base::trace_event::TracedValue* value) const { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 return draw_info_.resource_->bytes(); | 70 return draw_info_.resource_->bytes(); |
| 70 return 0; | 71 return 0; |
| 71 } | 72 } |
| 72 | 73 |
| 73 void Tile::Deleter::operator()(Tile* tile) const { | 74 void Tile::Deleter::operator()(Tile* tile) const { |
| 74 TileManager* tile_manager = tile->tile_manager_; | 75 TileManager* tile_manager = tile->tile_manager_; |
| 75 tile_manager->Release(tile); | 76 tile_manager->Release(tile); |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace cc | 79 } // namespace cc |
| OLD | NEW |