OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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 NinePatchLayerImpl_h |
| 6 #define NinePatchLayerImpl_h |
| 7 |
| 8 #include "cc/cc_export.h" |
| 9 #include "cc/layer_impl.h" |
| 10 #include "cc/resource_provider.h" |
| 11 #include "ui/gfx/size.h" |
| 12 #include "ui/gfx/rect.h" |
| 13 |
| 14 namespace cc { |
| 15 |
| 16 class CC_EXPORT NinePatchLayerImpl : public LayerImpl { |
| 17 public: |
| 18 static scoped_ptr<NinePatchLayerImpl> create(int id) |
| 19 { |
| 20 return make_scoped_ptr(new NinePatchLayerImpl(id)); |
| 21 } |
| 22 virtual ~NinePatchLayerImpl(); |
| 23 |
| 24 void setResourceId(unsigned id) { m_resourceId = id; } |
| 25 void setLayout(const gfx::Size& imageBounds, const gfx::Rect& aperture); |
| 26 |
| 27 virtual void willDraw(ResourceProvider*) OVERRIDE; |
| 28 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; |
| 29 virtual void didDraw(ResourceProvider*) OVERRIDE; |
| 30 virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE; |
| 31 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; |
| 32 virtual void didLoseContext() OVERRIDE; |
| 33 |
| 34 protected: |
| 35 explicit NinePatchLayerImpl(int id); |
| 36 |
| 37 private: |
| 38 virtual const char* layerTypeAsString() const OVERRIDE; |
| 39 |
| 40 // The size of the NinePatch bitmap in pixels. |
| 41 gfx::Size m_imageBounds; |
| 42 |
| 43 // The transparent center region that shows the parent layer's contents in i
mage space. |
| 44 gfx::Rect m_imageAperture; |
| 45 |
| 46 ResourceProvider::ResourceId m_resourceId; |
| 47 }; |
| 48 |
| 49 } |
| 50 |
| 51 #endif |
OLD | NEW |