blob: b66d27baacb6ce2259c8662e7ca330b02cf16ba9 (
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
36
37
38
39
40
41
42
43
44
45
|
// 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_image_layer_impl.h"
#include "base/command_line.h"
#include "cc/image_layer.h"
#include "cc/picture_image_layer.h"
#include "cc/switches.h"
#include "webkit/compositor_bindings/web_layer_impl.h"
static bool usingPictureLayer()
{
return CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kEnableImplSidePainting);
}
namespace WebKit {
WebImageLayerImpl::WebImageLayerImpl()
{
if (usingPictureLayer())
m_layer.reset(new WebLayerImpl(cc::PictureImageLayer::create()));
else
m_layer.reset(new WebLayerImpl(cc::ImageLayer::create()));
}
WebImageLayerImpl::~WebImageLayerImpl()
{
}
WebLayer* WebImageLayerImpl::layer()
{
return m_layer.get();
}
void WebImageLayerImpl::setBitmap(SkBitmap bitmap)
{
if (usingPictureLayer())
static_cast<cc::PictureImageLayer*>(m_layer->layer())->setBitmap(bitmap);
else
static_cast<cc::ImageLayer*>(m_layer->layer())->setBitmap(bitmap);
}
} // namespace WebKit
|