Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: cc/tiles/tile.cc

Issue 2566613002: [4/5] Add translated rasterization support for PictureLayerTilingSet & below (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h" 12 #include "base/trace_event/trace_event.h"
13 #include "base/trace_event/trace_event_argument.h" 13 #include "base/trace_event/trace_event_argument.h"
14 #include "cc/base/math_util.h" 14 #include "cc/base/math_util.h"
15 #include "cc/debug/traced_value.h" 15 #include "cc/debug/traced_value.h"
16 #include "cc/tiles/tile_manager.h" 16 #include "cc/tiles/tile_manager.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 Tile::Tile(TileManager* tile_manager, 20 Tile::Tile(TileManager* tile_manager,
21 const CreateInfo& info, 21 const CreateInfo& info,
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 content_rect_(info.content_rect), 26 content_rect_(info.content_rect),
27 enclosing_layer_rect_(info.enclosing_layer_rect), 27 enclosing_layer_rect_(info.enclosing_layer_rect),
28 raster_scales_(info.raster_scales), 28 raster_transform_(info.raster_transform),
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_(info.tiling_i_index), 32 tiling_i_index_(info.tiling_i_index),
33 tiling_j_index_(info.tiling_j_index), 33 tiling_j_index_(info.tiling_j_index),
34 required_for_activation_(false), 34 required_for_activation_(false),
35 required_for_draw_(false), 35 required_for_draw_(false),
36 is_solid_color_analysis_performed_(false), 36 is_solid_color_analysis_performed_(false),
37 id_(tile_manager->GetUniqueTileId()), 37 id_(tile_manager->GetUniqueTileId()),
38 invalidated_id_(0), 38 invalidated_id_(0),
39 scheduled_priority_(0) {} 39 scheduled_priority_(0) {}
40 40
41 Tile::~Tile() { 41 Tile::~Tile() {
42 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 42 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
43 TRACE_DISABLED_BY_DEFAULT("cc.debug"), 43 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
44 "cc::Tile", this); 44 "cc::Tile", this);
45 } 45 }
46 46
47 void Tile::AsValueInto(base::trace_event::TracedValue* value) const { 47 void Tile::AsValueInto(base::trace_event::TracedValue* value) const {
48 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 48 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
49 TRACE_DISABLED_BY_DEFAULT("cc.debug"), value, "cc::Tile", this); 49 TRACE_DISABLED_BY_DEFAULT("cc.debug"), value, "cc::Tile", this);
50 // TODO(vmpstr): Update tracing to use x/y scales. 50 // TODO(vmpstr): Update tracing to use x/y scales.
51 value->SetDouble("contents_scale", contents_scale_key()); 51 value->SetDouble("contents_scale", contents_scale_key());
52 52
53 value->BeginArray("raster_scales"); 53 value->BeginArray("raster_transform");
54 value->AppendDouble(raster_scales_.width()); 54 value->AppendDouble(raster_transform_.scale());
55 value->AppendDouble(raster_scales_.height()); 55 value->AppendDouble(raster_transform_.translation().x());
56 value->AppendDouble(raster_transform_.translation().y());
56 value->EndArray(); 57 value->EndArray();
57 58
58 MathUtil::AddToTracedValue("content_rect", content_rect_, value); 59 MathUtil::AddToTracedValue("content_rect", content_rect_, value);
59 60
60 value->SetInteger("layer_id", layer_id_); 61 value->SetInteger("layer_id", layer_id_);
61 62
62 value->BeginDictionary("draw_info"); 63 value->BeginDictionary("draw_info");
63 draw_info_.AsValueInto(value); 64 draw_info_.AsValueInto(value);
64 value->EndDictionary(); 65 value->EndDictionary();
65 66
(...skipping 14 matching lines...) Expand all
80 draw_info_.resource_->size(), draw_info_.resource_->format()); 81 draw_info_.resource_->size(), draw_info_.resource_->format());
81 } 82 }
82 return 0; 83 return 0;
83 } 84 }
84 85
85 void Tile::Deleter::operator()(Tile* tile) const { 86 void Tile::Deleter::operator()(Tile* tile) const {
86 tile->tile_manager_->Release(tile); 87 tile->tile_manager_->Release(tile);
87 } 88 }
88 89
89 } // namespace cc 90 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698