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

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

Issue 2726343004: cc: Optimize decode scheduling for checker-images. (Closed)
Patch Set: tested 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 return resource_is_checker_imaged_;
83 }
84
80 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } 85 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); }
81 86
82 void AsValueInto(base::trace_event::TracedValue* state) const; 87 void AsValueInto(base::trace_event::TracedValue* state) const;
83 88
84 private: 89 private:
85 friend class Tile; 90 friend class Tile;
86 friend class TileManager; 91 friend class TileManager;
87 92
88 const Resource* resource() const { return resource_; } 93 const Resource* resource() const { return resource_; }
89 94
90 void set_resource(Resource* resource) { 95 void set_resource(Resource* resource, bool resource_is_checker_imaged) {
vmpstr 2017/04/18 00:20:00 You could just make false the default value.
Khushal 2017/04/19 06:16:41 Do we have default values for arguments? I never n
96 DCHECK(!resource_is_checker_imaged || resource)
97 << "Need to have a resource for it to be checker-imaged";
98
91 mode_ = RESOURCE_MODE; 99 mode_ = RESOURCE_MODE;
92 is_resource_ready_to_draw_ = false; 100 is_resource_ready_to_draw_ = false;
101 resource_is_checker_imaged_ = resource_is_checker_imaged;
93 resource_ = resource; 102 resource_ = resource;
94 } 103 }
95 104
96 void set_resource_ready_for_draw() { 105 void set_resource_ready_for_draw() {
97 is_resource_ready_to_draw_ = true; 106 is_resource_ready_to_draw_ = true;
98 } 107 }
99 108
100 Resource* TakeResource(); 109 Resource* TakeResource();
101 110
102 void set_solid_color(const SkColor& color) { 111 void set_solid_color(const SkColor& color) {
103 mode_ = SOLID_COLOR_MODE; 112 mode_ = SOLID_COLOR_MODE;
104 solid_color_ = color; 113 solid_color_ = color;
105 } 114 }
106 115
107 void set_oom() { mode_ = OOM_MODE; } 116 void set_oom() { mode_ = OOM_MODE; }
108 117
109 Mode mode_ = RESOURCE_MODE; 118 Mode mode_ = RESOURCE_MODE;
110 SkColor solid_color_ = SK_ColorWHITE; 119 SkColor solid_color_ = SK_ColorWHITE;
111 Resource* resource_ = nullptr; 120 Resource* resource_ = nullptr;
112 bool contents_swizzled_ = false; 121 bool contents_swizzled_ = false;
113 bool is_resource_ready_to_draw_ = false; 122 bool is_resource_ready_to_draw_ = false;
123
124 // Set to true if |resource_| was rasterized with checker-imaged content. The
125 // flag can only be true iff we have a valid |resource_|.
126 bool resource_is_checker_imaged_ = false;
114 }; 127 };
115 128
116 } // namespace cc 129 } // namespace cc
117 130
118 #endif // CC_TILES_TILE_DRAW_INFO_H_ 131 #endif // CC_TILES_TILE_DRAW_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698