Chromium Code Reviews| Index: cc/tile_drawing_info.h |
| diff --git a/cc/tile_drawing_info.h b/cc/tile_drawing_info.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a11651594a55a2dca70eb957fdbefa1d25d51ad9 |
| --- /dev/null |
| +++ b/cc/tile_drawing_info.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_TILE_DRAWING_INFO_H_ |
| +#define CC_TILE_DRAWING_INFO_H_ |
| + |
| +#include "cc/resource_provider.h" |
| +#include "cc/tile_manager.h" |
| + |
| +namespace cc { |
| + |
| +class CC_EXPORT TileDrawingInfo { |
| + public: |
| + enum Mode { |
| + TEXTURE_MODE, |
| + SOLID_COLOR_MODE, |
| + TRANSPARENT_MODE, |
| + PICTURE_PILE_MODE, |
| + NUM_MODES |
| + }; |
| + |
| + TileDrawingInfo() |
| + : mode_(TEXTURE_MODE), |
| + initializing_resource_(false), |
| + can_be_freed_(true), |
| + contents_swizzled_(false) {} |
| + |
| + Mode mode() const { |
| + return mode_; |
| + } |
| + |
| + bool IsReadyToDraw() const; |
| + |
| + ResourceProvider::ResourceId get_resource_id() const { |
| + DCHECK(mode_ == TEXTURE_MODE); |
| + DCHECK(resource_); |
| + DCHECK(!initializing_resource_); |
| + return resource_->id(); |
| + } |
| + |
| + SkColor get_solid_color() const { |
| + DCHECK(mode_ == SOLID_COLOR_MODE); |
| + |
| + return solid_color_; |
| + } |
| + |
| + bool contents_swizzled() const { |
| + return contents_swizzled_; |
| + } |
| + |
| + private: |
| + friend class TileManager; |
| + |
| + void set_transparent() { |
| + mode_ = TRANSPARENT_MODE; |
| + } |
| + |
| + void set_solid_color(const SkColor& color) { |
| + mode_ = SOLID_COLOR_MODE; |
| + solid_color_ = color; |
| + } |
| + |
| + Mode mode_; |
| + SkColor solid_color_; |
| + |
| + scoped_ptr<ResourcePool::Resource> resource_; |
| + bool initializing_resource_; |
|
reveman
2013/03/07 22:02:14
is there a good reason for not calling this resour
|
| + bool can_be_freed_; |
| + bool contents_swizzled_; |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_TILE_DRAWING_INFO_H_ |