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/tiles/tile.h" | 5 #include "cc/tiles/tile.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
12 #include "base/trace_event/trace_event_argument.h" | 12 #include "base/trace_event/trace_event_argument.h" |
13 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
14 #include "cc/debug/traced_value.h" | 14 #include "cc/debug/traced_value.h" |
15 #include "cc/tiles/tile_manager.h" | 15 #include "cc/tiles/tile_manager.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 | 18 |
19 Tile::Tile(TileManager* tile_manager, | 19 Tile::Tile(TileManager* tile_manager, |
20 const CreateInfo& info, | 20 const CreateInfo& info, |
21 int layer_id, | 21 int layer_id, |
22 int source_frame_number, | 22 int source_frame_number, |
23 int flags) | 23 int flags) |
24 : tile_manager_(tile_manager), | 24 : tile_manager_(tile_manager), |
25 content_rect_(info.content_rect), | 25 content_rect_(info.content_rect), |
26 enclosing_layer_rect_(info.enclosing_layer_rect), | 26 enclosing_layer_rect_(info.enclosing_layer_rect), |
27 contents_scale_(info.contents_scale), | 27 contents_transform_(info.contents_transform), |
28 layer_id_(layer_id), | 28 layer_id_(layer_id), |
29 source_frame_number_(source_frame_number), | 29 source_frame_number_(source_frame_number), |
30 flags_(flags), | 30 flags_(flags), |
31 tiling_i_index_(info.tiling_i_index), | 31 tiling_i_index_(info.tiling_i_index), |
32 tiling_j_index_(info.tiling_j_index), | 32 tiling_j_index_(info.tiling_j_index), |
33 required_for_activation_(false), | 33 required_for_activation_(false), |
34 required_for_draw_(false), | 34 required_for_draw_(false), |
35 id_(tile_manager->GetUniqueTileId()), | 35 id_(tile_manager->GetUniqueTileId()), |
36 invalidated_id_(0), | 36 invalidated_id_(0), |
37 scheduled_priority_(0) {} | 37 scheduled_priority_(0) {} |
38 | 38 |
39 Tile::~Tile() { | 39 Tile::~Tile() { |
40 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 40 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
41 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 41 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
42 "cc::Tile", this); | 42 "cc::Tile", this); |
43 } | 43 } |
44 | 44 |
45 void Tile::AsValueInto(base::trace_event::TracedValue* value) const { | 45 void Tile::AsValueInto(base::trace_event::TracedValue* value) const { |
46 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 46 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
47 TRACE_DISABLED_BY_DEFAULT("cc.debug"), value, "cc::Tile", this); | 47 TRACE_DISABLED_BY_DEFAULT("cc.debug"), value, "cc::Tile", this); |
48 value->SetDouble("contents_scale", contents_scale_); | 48 value->SetDouble("contents_transform_pre_scale", |
enne (OOO)
2016/08/29 20:21:19
bikeshed: I'd leave this as contents_scale and con
| |
49 contents_transform_.pre_scale()); | |
50 MathUtil::AddToTracedValue("contents_transform_translation", | |
51 contents_transform_.translation(), value); | |
49 | 52 |
50 MathUtil::AddToTracedValue("content_rect", content_rect_, value); | 53 MathUtil::AddToTracedValue("content_rect", content_rect_, value); |
51 | 54 |
52 value->SetInteger("layer_id", layer_id_); | 55 value->SetInteger("layer_id", layer_id_); |
53 | 56 |
54 value->BeginDictionary("draw_info"); | 57 value->BeginDictionary("draw_info"); |
55 draw_info_.AsValueInto(value); | 58 draw_info_.AsValueInto(value); |
56 value->EndDictionary(); | 59 value->EndDictionary(); |
57 | 60 |
58 value->SetBoolean("has_resource", draw_info().has_resource()); | 61 value->SetBoolean("has_resource", draw_info().has_resource()); |
(...skipping 13 matching lines...) Expand all Loading... | |
72 draw_info_.resource_->size(), draw_info_.resource_->format()); | 75 draw_info_.resource_->size(), draw_info_.resource_->format()); |
73 } | 76 } |
74 return 0; | 77 return 0; |
75 } | 78 } |
76 | 79 |
77 void Tile::Deleter::operator()(Tile* tile) const { | 80 void Tile::Deleter::operator()(Tile* tile) const { |
78 tile->tile_manager_->Release(tile); | 81 tile->tile_manager_->Release(tile); |
79 } | 82 } |
80 | 83 |
81 } // namespace cc | 84 } // namespace cc |
OLD | NEW |