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

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

Issue 1139673008: cc: Make IsReadyToDraw/NeedsRaster usage consistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/tile.cc ('k') | cc/resources/tile_draw_info.cc » ('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 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_RESOURCES_TILE_DRAW_INFO_H_ 5 #ifndef CC_RESOURCES_TILE_DRAW_INFO_H_
6 #define CC_RESOURCES_TILE_DRAW_INFO_H_ 6 #define CC_RESOURCES_TILE_DRAW_INFO_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
10 #include "cc/resources/platform_color.h" 10 #include "cc/resources/platform_color.h"
11 #include "cc/resources/resource_provider.h" 11 #include "cc/resources/resource_provider.h"
12 #include "cc/resources/scoped_resource.h" 12 #include "cc/resources/scoped_resource.h"
13 #include "cc/resources/tile_task_runner.h" 13 #include "cc/resources/tile_task_runner.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 // This class holds all the state relevant to drawing a tile. 17 // This class holds all the state relevant to drawing a tile.
18 class CC_EXPORT TileDrawInfo { 18 class CC_EXPORT TileDrawInfo {
19 public: 19 public:
20 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, OOM_MODE }; 20 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, OOM_MODE };
21 21
22 TileDrawInfo(); 22 TileDrawInfo();
23 ~TileDrawInfo(); 23 ~TileDrawInfo();
24 24
25 Mode mode() const { return mode_; } 25 Mode mode() const { return mode_; }
26 26
27 bool IsReadyToDraw() const; 27 bool IsReadyToDraw() const {
28 switch (mode_) {
29 case RESOURCE_MODE:
30 return !!resource_;
31 case SOLID_COLOR_MODE:
32 case OOM_MODE:
33 return true;
34 }
35 NOTREACHED();
36 return false;
37 }
38 bool NeedsRaster() const {
39 switch (mode_) {
40 case RESOURCE_MODE:
41 return !resource_;
42 case SOLID_COLOR_MODE:
43 return false;
44 case OOM_MODE:
45 return true;
46 }
47 NOTREACHED();
48 return false;
49 }
28 50
29 ResourceProvider::ResourceId resource_id() const { 51 ResourceProvider::ResourceId resource_id() const {
30 DCHECK(mode_ == RESOURCE_MODE); 52 DCHECK(mode_ == RESOURCE_MODE);
31 DCHECK(resource_); 53 DCHECK(resource_);
32 return resource_->id(); 54 return resource_->id();
33 } 55 }
34 56
35 gfx::Size resource_size() const { 57 gfx::Size resource_size() const {
36 DCHECK(mode_ == RESOURCE_MODE); 58 DCHECK(mode_ == RESOURCE_MODE);
37 DCHECK(resource_); 59 DCHECK(resource_);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void set_oom() { mode_ = OOM_MODE; } 97 void set_oom() { mode_ = OOM_MODE; }
76 98
77 Mode mode_; 99 Mode mode_;
78 SkColor solid_color_; 100 SkColor solid_color_;
79 scoped_ptr<ScopedResource> resource_; 101 scoped_ptr<ScopedResource> resource_;
80 }; 102 };
81 103
82 } // namespace cc 104 } // namespace cc
83 105
84 #endif // CC_RESOURCES_TILE_DRAW_INFO_H_ 106 #endif // CC_RESOURCES_TILE_DRAW_INFO_H_
OLDNEW
« no previous file with comments | « cc/resources/tile.cc ('k') | cc/resources/tile_draw_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698