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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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, PICTURE_PILE_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 28
29 ResourceProvider::ResourceId resource_id() const { 29 ResourceProvider::ResourceId resource_id() const {
30 DCHECK(mode_ == RESOURCE_MODE); 30 DCHECK(mode_ == RESOURCE_MODE);
(...skipping 11 matching lines...) Expand all
42 DCHECK(mode_ == SOLID_COLOR_MODE); 42 DCHECK(mode_ == SOLID_COLOR_MODE);
43 return solid_color_; 43 return solid_color_;
44 } 44 }
45 45
46 bool contents_swizzled() const { 46 bool contents_swizzled() const {
47 DCHECK(resource_); 47 DCHECK(resource_);
48 return !PlatformColor::SameComponentOrder(resource_->format()); 48 return !PlatformColor::SameComponentOrder(resource_->format());
49 } 49 }
50 50
51 bool requires_resource() const { 51 bool requires_resource() const {
52 return mode_ == RESOURCE_MODE || mode_ == OOM_MODE; 52 return mode_ == RESOURCE_MODE || mode_ == PICTURE_PILE_MODE;
53 } 53 }
54 54
55 inline bool has_resource() const { return !!resource_; } 55 inline bool has_resource() const { return !!resource_; }
56 56
57 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } 57 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); }
58 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) { 58 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) {
59 resource_ = resource.Pass(); 59 resource_ = resource.Pass();
60 } 60 }
61 61
62 void AsValueInto(base::trace_event::TracedValue* state) const; 62 void AsValueInto(base::trace_event::TracedValue* state) const;
63 63
64 private: 64 private:
65 friend class Tile; 65 friend class Tile;
66 friend class TileManager; 66 friend class TileManager;
67 67
68 void set_use_resource() { mode_ = RESOURCE_MODE; } 68 void set_use_resource() { mode_ = RESOURCE_MODE; }
69 69
70 void set_solid_color(const SkColor& color) { 70 void set_solid_color(const SkColor& color) {
71 mode_ = SOLID_COLOR_MODE; 71 mode_ = SOLID_COLOR_MODE;
72 solid_color_ = color; 72 solid_color_ = color;
73 } 73 }
74 74
75 void set_oom() { mode_ = OOM_MODE; } 75 void set_rasterize_on_demand() { mode_ = PICTURE_PILE_MODE; }
76 76
77 Mode mode_; 77 Mode mode_;
78 SkColor solid_color_; 78 SkColor solid_color_;
79 scoped_ptr<ScopedResource> resource_; 79 scoped_ptr<ScopedResource> resource_;
80 }; 80 };
81 81
82 } // namespace cc 82 } // namespace cc
83 83
84 #endif // CC_RESOURCES_TILE_DRAW_INFO_H_ 84 #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