Index: webkit/compositor_bindings/web_nine_patch_layer_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 0000000000000000000000000000000000000000..2d30b356a45ed48dc105abeb2ded345d7ac9c883 |
--- /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 |