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.
5 #ifndef CC_NINE_PATCH_LAYER_IMPL_H_
6 #define CC_NINE_PATCH_LAYER_IMPL_H_
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"
15 class DictionaryValue
;
20 class CC_EXPORT NinePatchLayerImpl
: public LayerImpl
{
22 static scoped_ptr
<NinePatchLayerImpl
> create(LayerTreeImpl
* treeImpl
, int id
)
24 return make_scoped_ptr(new NinePatchLayerImpl(treeImpl
, id
));
26 virtual ~NinePatchLayerImpl();
28 void setResourceId(unsigned id
) { m_resourceId
= id
; }
29 void setLayout(const gfx::Size
& imageBounds
, const gfx::Rect
& aperture
);
31 virtual scoped_ptr
<LayerImpl
> createLayerImpl(LayerTreeImpl
* treeImpl
) OVERRIDE
;
32 virtual void pushPropertiesTo(LayerImpl
*) OVERRIDE
;
34 virtual void willDraw(ResourceProvider
*) OVERRIDE
;
35 virtual void appendQuads(QuadSink
&, AppendQuadsData
&) OVERRIDE
;
36 virtual void didDraw(ResourceProvider
*) OVERRIDE
;
37 virtual ResourceProvider::ResourceId
contentsResourceId() const OVERRIDE
;
38 virtual void dumpLayerProperties(std::string
*, int indent
) const OVERRIDE
;
39 virtual void didLoseOutputSurface() OVERRIDE
;
41 virtual base::DictionaryValue
* layerTreeAsJson() const OVERRIDE
;
44 NinePatchLayerImpl(LayerTreeImpl
* treeImpl
, int id
);
47 virtual const char* layerTypeAsString() const OVERRIDE
;
49 // The size of the NinePatch bitmap in pixels.
50 gfx::Size m_imageBounds
;
52 // The transparent center region that shows the parent layer's contents in image space.
53 gfx::Rect m_imageAperture
;
55 ResourceProvider::ResourceId m_resourceId
;
60 #endif // CC_NINE_PATCH_LAYER_IMPL_H_