summaryrefslogtreecommitdiffstats
path: root/webkit/compositor_bindings/web_nine_patch_layer_impl.cc
blob: f9ee87aa0f2aa146c56fb7fd19f0fbd9d2b02598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 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 "webkit/compositor_bindings/web_nine_patch_layer_impl.h"

#include "cc/nine_patch_layer.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/rect.h"
#include "webkit/compositor_bindings/web_layer_impl.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