blob: 4841059fcafcb44f89bc442e01f057be1620475c [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
avi02a4d172015-12-21 06:14:3610#include "base/macros.h"
danakj60bc3bc2016-04-09 00:24:4811#include "base/memory/ptr_util.h"
chrishtrac41ff92017-03-17 05:07:3012#include "cc/cc_export.h"
[email protected]cc3cfaa2013-03-18 09:05:5213#include "cc/layers/layer_impl.h"
danakj83d0eb4f2017-09-19 17:31:5814#include "cc/layers/nine_patch_generator.h"
[email protected]efbdb3a2013-10-04 00:35:1315#include "cc/layers/ui_resource_layer_impl.h"
[email protected]741fba422013-09-20 03:34:1416#include "cc/resources/ui_resource_client.h"
heejin.r.chungd28506ba2014-10-23 16:36:2017#include "ui/gfx/geometry/rect.h"
18#include "ui/gfx/geometry/size.h"
[email protected]35680c02012-11-06 05:53:0019
[email protected]4a23c374c2012-12-08 08:38:5520namespace base {
21class DictionaryValue;
22}
23
[email protected]35680c02012-11-06 05:53:0024namespace cc {
25
[email protected]efbdb3a2013-10-04 00:35:1326class CC_EXPORT NinePatchLayerImpl : public UIResourceLayerImpl {
[email protected]37adf942013-03-08 04:43:1727 public:
danakj60bc3bc2016-04-09 00:24:4828 static std::unique_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl,
29 int id) {
30 return base::WrapUnique(new NinePatchLayerImpl(tree_impl, id));
[email protected]37adf942013-03-08 04:43:1731 }
dcheng716bedf2014-10-21 09:51:0832 ~NinePatchLayerImpl() override;
[email protected]35680c02012-11-06 05:53:0033
bokane7a058a2017-03-02 22:42:5134 // For parameter meanings, see the declaration of NinePatchGenerator.
[email protected]0023fc72014-01-10 20:05:0635 void SetLayout(const gfx::Rect& image_aperture,
36 const gfx::Rect& border,
lionel.g.landwerlin258c7d32016-07-27 09:55:2437 const gfx::Rect& layer_occlusion,
kkimlabs22367f642016-01-23 23:23:2438 bool fill_center,
39 bool nearest_neighbor);
[email protected]35680c02012-11-06 05:53:0040
danakj60bc3bc2016-04-09 00:24:4841 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
dcheng716bedf2014-10-21 09:51:0842 void PushPropertiesTo(LayerImpl* layer) override;
[email protected]48871fc2013-01-23 07:36:5143
danakje5805be2017-09-15 19:24:5544 void AppendQuads(viz::RenderPass* render_pass,
dcheng716bedf2014-10-21 09:51:0845 AppendQuadsData* append_quads_data) override;
[email protected]35680c02012-11-06 05:53:0046
Philip Rogers80890552017-10-12 02:42:1947 std::unique_ptr<base::DictionaryValue> LayerAsJson() override;
[email protected]4a23c374c2012-12-08 08:38:5548
[email protected]37adf942013-03-08 04:43:1749 protected:
50 NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id);
[email protected]35680c02012-11-06 05:53:0051
[email protected]37adf942013-03-08 04:43:1752 private:
dcheng716bedf2014-10-21 09:51:0853 const char* LayerTypeAsString() const override;
[email protected]35680c02012-11-06 05:53:0054
bokane7a058a2017-03-02 22:42:5155 NinePatchGenerator quad_generator_;
lionel.g.landwerlin258c7d32016-07-27 09:55:2456
[email protected]fa2d9a52013-03-27 18:47:0857 DISALLOW_COPY_AND_ASSIGN(NinePatchLayerImpl);
[email protected]35680c02012-11-06 05:53:0058};
59
[email protected]ffaa2a632012-11-11 14:47:5060} // namespace cc
[email protected]35680c02012-11-06 05:53:0061
[email protected]cc3cfaa2013-03-18 09:05:5262#endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_