| OLD | NEW |
| 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 "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/raster/tile_task_runner.h" | 10 #include "cc/raster/tile_task_runner.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 DCHECK(mode_ == RESOURCE_MODE); | 58 DCHECK(mode_ == RESOURCE_MODE); |
| 59 DCHECK(resource_); | 59 DCHECK(resource_); |
| 60 return resource_->size(); | 60 return resource_->size(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 SkColor solid_color() const { | 63 SkColor solid_color() const { |
| 64 DCHECK(mode_ == SOLID_COLOR_MODE); | 64 DCHECK(mode_ == SOLID_COLOR_MODE); |
| 65 return solid_color_; | 65 return solid_color_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool contents_swizzled() const { | 68 bool contents_swizzled() const { return contents_swizzled_; } |
| 69 DCHECK(resource_); | |
| 70 return !PlatformColor::SameComponentOrder(resource_->format()); | |
| 71 } | |
| 72 | 69 |
| 73 bool requires_resource() const { | 70 bool requires_resource() const { |
| 74 return mode_ == RESOURCE_MODE || mode_ == OOM_MODE; | 71 return mode_ == RESOURCE_MODE || mode_ == OOM_MODE; |
| 75 } | 72 } |
| 76 | 73 |
| 77 inline bool has_resource() const { return !!resource_; } | 74 inline bool has_resource() const { return !!resource_; } |
| 78 | 75 |
| 79 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } | 76 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } |
| 80 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) { | 77 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) { |
| 81 resource_ = resource.Pass(); | 78 resource_ = resource.Pass(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 92 void set_solid_color(const SkColor& color) { | 89 void set_solid_color(const SkColor& color) { |
| 93 mode_ = SOLID_COLOR_MODE; | 90 mode_ = SOLID_COLOR_MODE; |
| 94 solid_color_ = color; | 91 solid_color_ = color; |
| 95 } | 92 } |
| 96 | 93 |
| 97 void set_oom() { mode_ = OOM_MODE; } | 94 void set_oom() { mode_ = OOM_MODE; } |
| 98 | 95 |
| 99 Mode mode_; | 96 Mode mode_; |
| 100 SkColor solid_color_; | 97 SkColor solid_color_; |
| 101 scoped_ptr<ScopedResource> resource_; | 98 scoped_ptr<ScopedResource> resource_; |
| 99 bool contents_swizzled_; |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 } // namespace cc | 102 } // namespace cc |
| 105 | 103 |
| 106 #endif // CC_TILES_TILE_DRAW_INFO_H_ | 104 #endif // CC_TILES_TILE_DRAW_INFO_H_ |
| OLD | NEW |