Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Unified Diff: webkit/compositor_bindings/web_nine_patch_layer_impl.cc

Issue 11304020: cc: Nine patch layer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add unit tests and address code review Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
danakj 2012/11/02 16:04:14 Heh, we're super inconsistent with this, some laye
+}
+
+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

Powered by Google App Engine
This is Rietveld 408576698