diff options
author | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 05:53:00 +0000 |
---|---|---|
committer | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 05:53:00 +0000 |
commit | 35680c0ca726980e1a380e668bf7565b39eb7ce9 (patch) | |
tree | f6c147c60ca4beae0d663efc9d211f55325a6854 /cc/nine_patch_layer_impl.h | |
parent | ae8be5cadd06887ae263a9e906afe297e8cffb8b (diff) | |
download | chromium_src-35680c0ca726980e1a380e668bf7565b39eb7ce9.zip chromium_src-35680c0ca726980e1a380e668bf7565b39eb7ce9.tar.gz chromium_src-35680c0ca726980e1a380e668bf7565b39eb7ce9.tar.bz2 |
cc: Nine patch layer.
Review URL: https://chromiumcodereview.appspot.com/11304020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/nine_patch_layer_impl.h')
-rw-r--r-- | cc/nine_patch_layer_impl.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cc/nine_patch_layer_impl.h b/cc/nine_patch_layer_impl.h new file mode 100644 index 0000000..476f5bb --- /dev/null +++ b/cc/nine_patch_layer_impl.h @@ -0,0 +1,51 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NinePatchLayerImpl_h +#define NinePatchLayerImpl_h + +#include "cc/cc_export.h" +#include "cc/layer_impl.h" +#include "cc/resource_provider.h" +#include "ui/gfx/size.h" +#include "ui/gfx/rect.h" + +namespace cc { + +class CC_EXPORT NinePatchLayerImpl : public LayerImpl { +public: + static scoped_ptr<NinePatchLayerImpl> create(int id) + { + return make_scoped_ptr(new NinePatchLayerImpl(id)); + } + virtual ~NinePatchLayerImpl(); + + void setResourceId(unsigned id) { m_resourceId = id; } + void setLayout(const gfx::Size& imageBounds, const gfx::Rect& aperture); + + virtual void willDraw(ResourceProvider*) OVERRIDE; + virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; + virtual void didDraw(ResourceProvider*) OVERRIDE; + virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE; + virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; + virtual void didLoseContext() OVERRIDE; + +protected: + explicit NinePatchLayerImpl(int id); + +private: + virtual const char* layerTypeAsString() const OVERRIDE; + + // The size of the NinePatch bitmap in pixels. + gfx::Size m_imageBounds; + + // The transparent center region that shows the parent layer's contents in image space. + gfx::Rect m_imageAperture; + + ResourceProvider::ResourceId m_resourceId; +}; + +} + +#endif |