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

Side by Side Diff: cc/resources/tile.h

Issue 15995033: cc: Low quality support for low res tiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase fix Created 7 years, 6 months 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
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CC_RESOURCES_TILE_H_ 5 #ifndef CC_RESOURCES_TILE_H_
6 #define CC_RESOURCES_TILE_H_ 6 #define CC_RESOURCES_TILE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "cc/resources/managed_tile_state.h" 11 #include "cc/resources/managed_tile_state.h"
12 #include "cc/resources/picture_pile_impl.h" 12 #include "cc/resources/picture_pile_impl.h"
13 #include "cc/resources/tile_manager.h"
13 #include "cc/resources/tile_priority.h" 14 #include "cc/resources/tile_priority.h"
14 #include "cc/trees/layer_tree_host_impl.h" 15 #include "cc/trees/layer_tree_host_impl.h"
15 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 17 #include "ui/gfx/size.h"
17 18
18 namespace cc { 19 namespace cc {
19 20
20 class Tile; 21 class Tile;
21 class TileManager;
22 22
23 class CC_EXPORT Tile : public base::RefCounted<Tile> { 23 class CC_EXPORT Tile : public base::RefCounted<Tile> {
24 public: 24 public:
25 Tile(TileManager* tile_manager, 25 Tile(TileManager* tile_manager,
26 PicturePileImpl* picture_pile, 26 PicturePileImpl* picture_pile,
27 gfx::Size tile_size, 27 gfx::Size tile_size,
28 gfx::Rect content_rect, 28 gfx::Rect content_rect,
29 gfx::Rect opaque_rect, 29 gfx::Rect opaque_rect,
30 float contents_scale, 30 float contents_scale,
31 int layer_id, 31 int layer_id,
32 int source_frame_number); 32 int source_frame_number);
33 33
34 PicturePileImpl* picture_pile() { 34 PicturePileImpl* picture_pile() {
35 return picture_pile_.get(); 35 return picture_pile_.get();
36 } 36 }
37 37
38 const PicturePileImpl* picture_pile() const {
39 return picture_pile_.get();
40 }
41
38 const TilePriority& priority(WhichTree tree) const { 42 const TilePriority& priority(WhichTree tree) const {
39 return priority_[tree]; 43 return priority_[tree];
40 } 44 }
41 45
42 TilePriority combined_priority() const { 46 TilePriority combined_priority() const {
43 return TilePriority(priority_[ACTIVE_TREE], 47 return TilePriority(priority_[ACTIVE_TREE],
44 priority_[PENDING_TREE]); 48 priority_[PENDING_TREE]);
45 } 49 }
46 50
47 void SetPriority(WhichTree tree, const TilePriority& priority) { 51 void SetPriority(WhichTree tree, const TilePriority& priority) {
48 priority_[tree] = priority; 52 priority_[tree] = priority;
49 } 53 }
50 54
51 void mark_required_for_activation() { 55 void mark_required_for_activation() {
52 priority_[PENDING_TREE].required_for_activation = true; 56 priority_[PENDING_TREE].required_for_activation = true;
53 } 57 }
54 58
55 bool required_for_activation() const { 59 bool required_for_activation() const {
56 return priority_[PENDING_TREE].required_for_activation; 60 return priority_[PENDING_TREE].required_for_activation;
57 } 61 }
58 62
59 scoped_ptr<base::Value> AsValue() const; 63 scoped_ptr<base::Value> AsValue() const;
60 64
61 const ManagedTileState::TileVersion& tile_version() const { 65 bool IsReadyToDraw(TileRasterMode* ready_mode) const {
62 return managed_state_.tile_version; 66 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) {
67 if (managed_state_.tile_versions[mode].IsReadyToDraw()) {
68 if (ready_mode)
69 *ready_mode = static_cast<TileRasterMode>(mode);
70 return true;
71 }
72 }
73 return false;
63 } 74 }
64 ManagedTileState::TileVersion& tile_version() { 75
65 return managed_state_.tile_version; 76 const ManagedTileState::TileVersion& tile_version(TileRasterMode mode) const {
77 return managed_state_.tile_versions[mode];
78 }
79
80 ManagedTileState::TileVersion& tile_version(TileRasterMode mode) {
81 return managed_state_.tile_versions[mode];
66 } 82 }
67 83
68 gfx::Rect opaque_rect() const { return opaque_rect_; } 84 gfx::Rect opaque_rect() const { return opaque_rect_; }
69 bool has_text() const { 85 bool has_text() const {
70 return managed_state_.picture_pile_analysis.has_text; 86 return managed_state_.picture_pile_analysis.has_text;
71 } 87 }
72 88
73 float contents_scale() const { return contents_scale_; } 89 float contents_scale() const { return contents_scale_; }
74 gfx::Rect content_rect() const { return content_rect_; } 90 gfx::Rect content_rect() const { return content_rect_; }
75 91
76 int layer_id() const { return layer_id_; } 92 int layer_id() const { return layer_id_; }
77 93
78 int source_frame_number() const { return source_frame_number_; } 94 int source_frame_number() const { return source_frame_number_; }
79 95
80 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { 96 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) {
81 DCHECK(pile->CanRaster(contents_scale_, content_rect_)); 97 DCHECK(pile->CanRaster(contents_scale_, content_rect_));
82 picture_pile_ = pile; 98 picture_pile_ = pile;
83 } 99 }
84 100
85 // For test only methods. 101 // For test only methods.
86 bool HasRasterTaskForTesting() const { 102 bool HasRasterTaskForTesting() const {
87 return !managed_state().raster_task.is_null(); 103 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) {
104 if (!managed_state().tile_versions[mode].raster_task_.is_null())
105 return true;
106 }
107 return false;
88 } 108 }
89 void ResetRasterTaskForTesting() { 109 void ResetRasterTaskForTesting() {
90 managed_state().raster_task.Reset(); 110 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode)
111 managed_state().tile_versions[mode].raster_task_.Reset();
91 } 112 }
92 113
93 private: 114 private:
94 // Methods called by by tile manager. 115 // Methods called by by tile manager.
95 friend class TileManager; 116 friend class TileManager;
96 friend class BinComparator; 117 friend class BinComparator;
97 ManagedTileState& managed_state() { return managed_state_; } 118 ManagedTileState& managed_state() { return managed_state_; }
98 const ManagedTileState& managed_state() const { return managed_state_; } 119 const ManagedTileState& managed_state() const { return managed_state_; }
99 120
100 inline size_t bytes_consumed_if_allocated() const { 121 inline size_t bytes_consumed_if_allocated() const {
(...skipping 16 matching lines...) Expand all
117 ManagedTileState managed_state_; 138 ManagedTileState managed_state_;
118 int layer_id_; 139 int layer_id_;
119 int source_frame_number_; 140 int source_frame_number_;
120 141
121 DISALLOW_COPY_AND_ASSIGN(Tile); 142 DISALLOW_COPY_AND_ASSIGN(Tile);
122 }; 143 };
123 144
124 } // namespace cc 145 } // namespace cc
125 146
126 #endif // CC_RESOURCES_TILE_H_ 147 #endif // CC_RESOURCES_TILE_H_
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698