tiled_layer_impl.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
1// Copyright 2011 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CC_LAYERS_TILED_LAYER_IMPL_H_ 6#define CC_LAYERS_TILED_LAYER_IMPL_H_ 7 8#include "cc/base/cc_export.h" 9#include "cc/layers/layer_impl.h" 10 11namespace cc { 12 13class LayerTilingData; 14class DrawableTile; 15 16class CC_EXPORT TiledLayerImpl : public LayerImpl { 17 public: 18 static scoped_ptr<TiledLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { 19 return make_scoped_ptr(new TiledLayerImpl(tree_impl, id)); 20 } 21 virtual ~TiledLayerImpl(); 22 23 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 24 OVERRIDE; 25 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 26 27 virtual void AppendQuads(QuadSink* quad_sink, 28 AppendQuadsData* append_quads_data) OVERRIDE; 29 30 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; 31 32 virtual void DumpLayerProperties(std::string* str, int indent) const OVERRIDE; 33 34 void set_skips_draw(bool skips_draw) { skips_draw_ = skips_draw; } 35 void SetTilingData(const LayerTilingData& tiler); 36 void PushTileProperties(int i, 37 int j, 38 ResourceProvider::ResourceId resource, 39 gfx::Rect opaque_rect, 40 bool contents_swizzled); 41 void PushInvalidTile(int i, int j); 42 43 virtual Region VisibleContentOpaqueRegion() const OVERRIDE; 44 virtual void DidLoseOutputSurface() OVERRIDE; 45 46 protected: 47 TiledLayerImpl(LayerTreeImpl* tree_impl, int id); 48 // Exposed for testing. 49 bool HasTileAt(int i, int j) const; 50 bool HasResourceIdForTileAt(int i, int j) const; 51 52 virtual void GetDebugBorderProperties(SkColor* color, float* width) const 53 OVERRIDE; 54 55 private: 56 virtual const char* LayerTypeAsString() const OVERRIDE; 57 58 DrawableTile* TileAt(int i, int j) const; 59 DrawableTile* CreateTile(int i, int j); 60 61 bool skips_draw_; 62 63 scoped_ptr<LayerTilingData> tiler_; 64 65 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl); 66}; 67 68} // namespace cc 69 70#endif // CC_LAYERS_TILED_LAYER_IMPL_H_ 71