blob: d8f09781dede6f6094cbfdd29e310b270bdfcf3d [file] [log] [blame]
[email protected]35680c02012-11-06 05:53:001// 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
[email protected]ffaa2a632012-11-11 14:47:505#ifndef CC_NINE_PATCH_LAYER_IMPL_H_
6#define CC_NINE_PATCH_LAYER_IMPL_H_
[email protected]35680c02012-11-06 05:53:007
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
[email protected]4a23c374c2012-12-08 08:38:5514namespace base {
15class DictionaryValue;
16}
17
[email protected]35680c02012-11-06 05:53:0018namespace cc {
19
20class CC_EXPORT NinePatchLayerImpl : public LayerImpl {
[email protected]37adf942013-03-08 04:43:1721 public:
22 static scoped_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl,
23 int id) {
24 return make_scoped_ptr(new NinePatchLayerImpl(tree_impl, id));
25 }
26 virtual ~NinePatchLayerImpl();
[email protected]35680c02012-11-06 05:53:0027
[email protected]37adf942013-03-08 04:43:1728 void SetResourceId(unsigned id) { resource_id_ = id; }
29 void SetLayout(gfx::Size image_bounds, gfx::Rect aperture);
[email protected]35680c02012-11-06 05:53:0030
[email protected]37adf942013-03-08 04:43:1731 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* tree_impl)
32 OVERRIDE;
33 virtual void pushPropertiesTo(LayerImpl* layer) OVERRIDE;
[email protected]48871fc2013-01-23 07:36:5134
[email protected]37adf942013-03-08 04:43:1735 virtual void willDraw(ResourceProvider* resource_provider) OVERRIDE;
36 virtual void appendQuads(QuadSink& quad_sink,
37 AppendQuadsData& append_quads_data) OVERRIDE;
38 virtual void didDraw(ResourceProvider* FIXMENAME) OVERRIDE;
39 virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
40 virtual void dumpLayerProperties(std::string* str, int indent) const OVERRIDE;
41 virtual void didLoseOutputSurface() OVERRIDE;
[email protected]35680c02012-11-06 05:53:0042
[email protected]37adf942013-03-08 04:43:1743 virtual base::DictionaryValue* layerTreeAsJson() const OVERRIDE;
[email protected]4a23c374c2012-12-08 08:38:5544
[email protected]37adf942013-03-08 04:43:1745 protected:
46 NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id);
[email protected]35680c02012-11-06 05:53:0047
[email protected]37adf942013-03-08 04:43:1748 private:
49 virtual const char* layerTypeAsString() const OVERRIDE;
[email protected]35680c02012-11-06 05:53:0050
[email protected]37adf942013-03-08 04:43:1751 // The size of the NinePatch bitmap in pixels.
52 gfx::Size image_bounds_;
[email protected]35680c02012-11-06 05:53:0053
[email protected]37adf942013-03-08 04:43:1754 // The transparent center region that shows the parent layer's contents in
55 // image space.
56 gfx::Rect image_aperture_;
[email protected]35680c02012-11-06 05:53:0057
[email protected]37adf942013-03-08 04:43:1758 ResourceProvider::ResourceId resource_id_;
[email protected]35680c02012-11-06 05:53:0059};
60
[email protected]ffaa2a632012-11-11 14:47:5061} // namespace cc
[email protected]35680c02012-11-06 05:53:0062
[email protected]ffaa2a632012-11-11 14:47:5063#endif // CC_NINE_PATCH_LAYER_IMPL_H_