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

Side by Side Diff: cc/tiles/tile_draw_info.h

Issue 2726343004: cc: Optimize decode scheduling for checker-images. (Closed)
Patch Set: fixed tile iteration Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TILES_TILE_DRAW_INFO_H_ 5 #ifndef CC_TILES_TILE_DRAW_INFO_H_
6 #define CC_TILES_TILE_DRAW_INFO_H_ 6 #define CC_TILES_TILE_DRAW_INFO_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool requires_resource() const { 70 bool requires_resource() const {
71 return mode_ == RESOURCE_MODE || mode_ == OOM_MODE; 71 return mode_ == RESOURCE_MODE || mode_ == OOM_MODE;
72 } 72 }
73 73
74 inline bool has_resource() const { return !!resource_; } 74 inline bool has_resource() const { return !!resource_; }
75 75
76 inline bool has_compressed_resource() const { 76 inline bool has_compressed_resource() const {
77 return resource_ ? IsResourceFormatCompressed(resource_->format()) : false; 77 return resource_ ? IsResourceFormatCompressed(resource_->format()) : false;
78 } 78 }
79 79
80 bool is_checker_imaged() const {
81 DCHECK(!resource_is_checker_imaged_ || resource_);
82
83 return resource_is_checker_imaged_;
84 }
85
80 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } 86 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); }
81 87
82 void AsValueInto(base::trace_event::TracedValue* state) const; 88 void AsValueInto(base::trace_event::TracedValue* state) const;
83 89
84 private: 90 private:
85 friend class Tile; 91 friend class Tile;
86 friend class TileManager; 92 friend class TileManager;
87 93
88 const Resource* resource() const { return resource_; } 94 const Resource* resource() const { return resource_; }
89 95
90 void set_resource(Resource* resource) { 96 void set_resource(Resource* resource, bool resource_is_checker_imaged) {
97 DCHECK(!resource_is_checker_imaged || resource)
98 << "Need to have a resource for it to be checker-imaged";
99
91 mode_ = RESOURCE_MODE; 100 mode_ = RESOURCE_MODE;
92 is_resource_ready_to_draw_ = false; 101 is_resource_ready_to_draw_ = false;
102 resource_is_checker_imaged_ = resource_is_checker_imaged;
93 resource_ = resource; 103 resource_ = resource;
94 } 104 }
95 105
96 void set_resource_ready_for_draw() { 106 void set_resource_ready_for_draw() {
97 is_resource_ready_to_draw_ = true; 107 is_resource_ready_to_draw_ = true;
98 } 108 }
99 109
100 Resource* TakeResource(); 110 Resource* TakeResource();
101 111
102 void set_solid_color(const SkColor& color) { 112 void set_solid_color(const SkColor& color) {
103 mode_ = SOLID_COLOR_MODE; 113 mode_ = SOLID_COLOR_MODE;
104 solid_color_ = color; 114 solid_color_ = color;
105 } 115 }
106 116
107 void set_oom() { mode_ = OOM_MODE; } 117 void set_oom() { mode_ = OOM_MODE; }
108 118
109 Mode mode_ = RESOURCE_MODE; 119 Mode mode_ = RESOURCE_MODE;
110 SkColor solid_color_ = SK_ColorWHITE; 120 SkColor solid_color_ = SK_ColorWHITE;
111 Resource* resource_ = nullptr; 121 Resource* resource_ = nullptr;
112 bool contents_swizzled_ = false; 122 bool contents_swizzled_ = false;
113 bool is_resource_ready_to_draw_ = false; 123 bool is_resource_ready_to_draw_ = false;
124
125 // Set to true if |resource_| was rasterized with checker-imaged content. The
126 // flag can only be true iff we have a valid |resource_|.
127 bool resource_is_checker_imaged_ = false;
114 }; 128 };
115 129
116 } // namespace cc 130 } // namespace cc
117 131
118 #endif // CC_TILES_TILE_DRAW_INFO_H_ 132 #endif // CC_TILES_TILE_DRAW_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698