OLD | NEW |
| (Empty) |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "WebContentLayerImpl.h" | |
7 | |
8 #include "ContentLayerChromium.h" | |
9 #include "SkMatrix44.h" | |
10 #include <public/WebContentLayerClient.h> | |
11 #include <public/WebFloatPoint.h> | |
12 #include <public/WebFloatRect.h> | |
13 #include <public/WebRect.h> | |
14 #include <public/WebSize.h> | |
15 | |
16 using namespace WebCore; | |
17 | |
18 namespace WebKit { | |
19 | |
20 WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) | |
21 { | |
22 return new WebContentLayerImpl(client); | |
23 } | |
24 | |
25 WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) | |
26 : m_layer(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) | |
27 , m_client(client) | |
28 { | |
29 m_layer->layer()->setIsDrawable(true); | |
30 } | |
31 | |
32 WebContentLayerImpl::~WebContentLayerImpl() | |
33 { | |
34 static_cast<ContentLayerChromium*>(m_layer->layer())->clearClient(); | |
35 } | |
36 | |
37 WebLayer* WebContentLayerImpl::layer() | |
38 { | |
39 return m_layer.get(); | |
40 } | |
41 | |
42 void WebContentLayerImpl::setDoubleSided(bool doubleSided) | |
43 { | |
44 m_layer->layer()->setDoubleSided(doubleSided); | |
45 } | |
46 | |
47 void WebContentLayerImpl::setContentsScale(float scale) | |
48 { | |
49 m_layer->layer()->setContentsScale(scale); | |
50 } | |
51 | |
52 void WebContentLayerImpl::setUseLCDText(bool enable) | |
53 { | |
54 m_layer->layer()->setUseLCDText(enable); | |
55 } | |
56 | |
57 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) | |
58 { | |
59 m_layer->layer()->setDrawCheckerboardForMissingTiles(enable); | |
60 } | |
61 | |
62 | |
63 void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, F
loatRect& opaque) | |
64 { | |
65 if (!m_client) | |
66 return; | |
67 WebFloatRect webOpaque; | |
68 m_client->paintContents(canvas, WebRect(clip), webOpaque); | |
69 opaque = webOpaque; | |
70 } | |
71 | |
72 } // namespace WebKit | |
OLD | NEW |