blob: d87f78569cb625fb1b9d90e6d0a3e27938c6aadd [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]cc3cfaa2013-03-18 09:05:525#ifndef CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_
6#define CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_
[email protected]35680c02012-11-06 05:53:007
[email protected]bf691c22013-03-26 21:15:068#include <string>
9
[email protected]681ccff2013-03-18 06:13:5210#include "cc/base/cc_export.h"
[email protected]cc3cfaa2013-03-18 09:05:5211#include "cc/layers/layer_impl.h"
[email protected]e12dd0e2013-03-18 08:24:4012#include "cc/resources/resource_provider.h"
[email protected]35680c02012-11-06 05:53:0013#include "ui/gfx/rect.h"
[email protected]681ccff2013-03-18 06:13:5214#include "ui/gfx/size.h"
[email protected]35680c02012-11-06 05:53:0015
[email protected]4a23c374c2012-12-08 08:38:5516namespace base {
17class DictionaryValue;
18}
19
[email protected]35680c02012-11-06 05:53:0020namespace cc {
21
22class CC_EXPORT NinePatchLayerImpl : public LayerImpl {
[email protected]37adf942013-03-08 04:43:1723 public:
24 static scoped_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl,
25 int id) {
26 return make_scoped_ptr(new NinePatchLayerImpl(tree_impl, id));
27 }
28 virtual ~NinePatchLayerImpl();
[email protected]35680c02012-11-06 05:53:0029
[email protected]37adf942013-03-08 04:43:1730 void SetResourceId(unsigned id) { resource_id_ = id; }
31 void SetLayout(gfx::Size image_bounds, gfx::Rect aperture);
[email protected]35680c02012-11-06 05:53:0032
[email protected]7aba6662013-03-12 10:17:3433 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
[email protected]37adf942013-03-08 04:43:1734 OVERRIDE;
[email protected]7aba6662013-03-12 10:17:3435 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
[email protected]48871fc2013-01-23 07:36:5136
[email protected]7aba6662013-03-12 10:17:3437 virtual void WillDraw(ResourceProvider* resource_provider) OVERRIDE;
38 virtual void AppendQuads(QuadSink* quad_sink,
39 AppendQuadsData* append_quads_data) OVERRIDE;
[email protected]cccb13d2013-03-21 20:12:5040 virtual void DidDraw(ResourceProvider* resource_provider) OVERRIDE;
[email protected]7aba6662013-03-12 10:17:3441 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE;
42 virtual void DumpLayerProperties(std::string* str, int indent) const OVERRIDE;
43 virtual void DidLoseOutputSurface() OVERRIDE;
[email protected]35680c02012-11-06 05:53:0044
[email protected]7aba6662013-03-12 10:17:3445 virtual base::DictionaryValue* LayerTreeAsJson() const OVERRIDE;
[email protected]4a23c374c2012-12-08 08:38:5546
[email protected]37adf942013-03-08 04:43:1747 protected:
48 NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id);
[email protected]35680c02012-11-06 05:53:0049
[email protected]37adf942013-03-08 04:43:1750 private:
[email protected]7aba6662013-03-12 10:17:3451 virtual const char* LayerTypeAsString() const OVERRIDE;
[email protected]35680c02012-11-06 05:53:0052
[email protected]37adf942013-03-08 04:43:1753 // The size of the NinePatch bitmap in pixels.
54 gfx::Size image_bounds_;
[email protected]35680c02012-11-06 05:53:0055
[email protected]37adf942013-03-08 04:43:1756 // The transparent center region that shows the parent layer's contents in
57 // image space.
58 gfx::Rect image_aperture_;
[email protected]35680c02012-11-06 05:53:0059
[email protected]37adf942013-03-08 04:43:1760 ResourceProvider::ResourceId resource_id_;
[email protected]35680c02012-11-06 05:53:0061};
62
[email protected]ffaa2a632012-11-11 14:47:5063} // namespace cc
[email protected]35680c02012-11-06 05:53:0064
[email protected]cc3cfaa2013-03-18 09:05:5265#endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_