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 /webkit | |
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 'webkit')
-rw-r--r-- | webkit/compositor_bindings/compositor_bindings.gyp | 2 | ||||
-rw-r--r-- | webkit/compositor_bindings/web_nine_patch_layer_impl.cc | 36 | ||||
-rw-r--r-- | webkit/compositor_bindings/web_nine_patch_layer_impl.h | 31 |
3 files changed, 69 insertions, 0 deletions
diff --git a/webkit/compositor_bindings/compositor_bindings.gyp b/webkit/compositor_bindings/compositor_bindings.gyp index 9f6417c..abcbaee 100644 --- a/webkit/compositor_bindings/compositor_bindings.gyp +++ b/webkit/compositor_bindings/compositor_bindings.gyp @@ -25,6 +25,8 @@ 'web_image_layer_impl.h', 'web_layer_impl.cc', 'web_layer_impl.h', + 'web_nine_patch_layer_impl.cc', + 'web_nine_patch_layer_impl.h', 'web_to_ccinput_handler_adapter.cc', 'web_to_ccinput_handler_adapter.h', 'web_layer_tree_view_impl.cc', diff --git a/webkit/compositor_bindings/web_nine_patch_layer_impl.cc b/webkit/compositor_bindings/web_nine_patch_layer_impl.cc new file mode 100644 index 0000000..2d30b35 --- /dev/null +++ b/webkit/compositor_bindings/web_nine_patch_layer_impl.cc @@ -0,0 +1,36 @@ +// 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. + +#include "config.h" +#include "web_nine_patch_layer_impl.h" + +#include "cc/nine_patch_layer.h" +#include "ui/gfx/rect.h" +#include "web_layer_impl.h" +#include "SkBitmap.h" + +using cc::NinePatchLayer; + +namespace WebKit { + +WebNinePatchLayerImpl::WebNinePatchLayerImpl() + : m_layer(new WebLayerImpl(NinePatchLayer::create())) +{ + m_layer->layer()->setIsDrawable(true); +} + +WebNinePatchLayerImpl::~WebNinePatchLayerImpl() +{ +} + +WebLayer* WebNinePatchLayerImpl::layer() +{ + return m_layer.get(); +} + +void WebNinePatchLayerImpl::setBitmap(const SkBitmap& bitmap, const WebRect& aperture) { + static_cast<NinePatchLayer*>(m_layer->layer())->setBitmap(bitmap, gfx::Rect(aperture)); +} + +} // namespace WebKit diff --git a/webkit/compositor_bindings/web_nine_patch_layer_impl.h b/webkit/compositor_bindings/web_nine_patch_layer_impl.h new file mode 100644 index 0000000..02605d8 --- /dev/null +++ b/webkit/compositor_bindings/web_nine_patch_layer_impl.h @@ -0,0 +1,31 @@ +// 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 WebNinePatchLayerImpl_h +#define WebNinePatchLayerImpl_h + +#include "web_layer_impl.h" +#include "base/memory/scoped_ptr.h" +#include "SkBitmap.h" + +namespace WebKit { + +class WebLayerImpl; + +class WebNinePatchLayerImpl { +public: + WebNinePatchLayerImpl(); + virtual ~WebNinePatchLayerImpl(); + + WebLayer* layer(); + + void setBitmap(const SkBitmap& bitmap, const WebRect& aperture); + +private: + scoped_ptr<WebLayerImpl> m_layer; +}; + +} // namespace WebKit + +#endif |