OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/compositor_bindings/web_content_layer_impl.h" | 5 #include "webkit/compositor_bindings/web_content_layer_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "cc/base/switches.h" | 8 #include "cc/base/switches.h" |
9 #include "cc/layers/content_layer.h" | 9 #include "cc/layers/content_layer.h" |
10 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie
nt.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie
nt.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
16 #include "third_party/skia/include/utils/SkMatrix44.h" | 16 #include "third_party/skia/include/utils/SkMatrix44.h" |
17 | 17 |
18 using namespace cc; | 18 using cc::ContentLayer; |
| 19 using cc::PictureLayer; |
19 | 20 |
20 namespace WebKit { | 21 namespace webkit { |
21 | 22 |
22 static bool usingPictureLayer() { | 23 static bool usingPictureLayer() { |
23 return cc::switches::IsImplSidePaintingEnabled(); | 24 return cc::switches::IsImplSidePaintingEnabled(); |
24 } | 25 } |
25 | 26 |
26 WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) | 27 WebContentLayerImpl::WebContentLayerImpl(WebKit::WebContentLayerClient* client) |
27 : client_(client) { | 28 : client_(client) { |
28 if (usingPictureLayer()) | 29 if (usingPictureLayer()) |
29 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); | 30 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); |
30 else | 31 else |
31 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); | 32 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); |
32 layer_->layer()->SetIsDrawable(true); | 33 layer_->layer()->SetIsDrawable(true); |
33 } | 34 } |
34 | 35 |
35 WebContentLayerImpl::~WebContentLayerImpl() { | 36 WebContentLayerImpl::~WebContentLayerImpl() { |
36 if (usingPictureLayer()) | 37 if (usingPictureLayer()) |
37 static_cast<PictureLayer*>(layer_->layer())->ClearClient(); | 38 static_cast<PictureLayer*>(layer_->layer())->ClearClient(); |
38 else | 39 else |
39 static_cast<ContentLayer*>(layer_->layer())->ClearClient(); | 40 static_cast<ContentLayer*>(layer_->layer())->ClearClient(); |
40 } | 41 } |
41 | 42 |
42 WebLayer* WebContentLayerImpl::layer() { return layer_.get(); } | 43 WebKit::WebLayer* WebContentLayerImpl::layer() { return layer_.get(); } |
43 | 44 |
44 void WebContentLayerImpl::setDoubleSided(bool double_sided) { | 45 void WebContentLayerImpl::setDoubleSided(bool double_sided) { |
45 layer_->layer()->SetDoubleSided(double_sided); | 46 layer_->layer()->SetDoubleSided(double_sided); |
46 } | 47 } |
47 | 48 |
48 void WebContentLayerImpl::setBoundsContainPageScale( | 49 void WebContentLayerImpl::setBoundsContainPageScale( |
49 bool bounds_contain_page_scale) { | 50 bool bounds_contain_page_scale) { |
50 return layer_->layer()->SetBoundsContainPageScale(bounds_contain_page_scale); | 51 return layer_->layer()->SetBoundsContainPageScale(bounds_contain_page_scale); |
51 } | 52 } |
52 | 53 |
(...skipping 11 matching lines...) Expand all Loading... |
64 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { | 65 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { |
65 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); | 66 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); |
66 } | 67 } |
67 | 68 |
68 void WebContentLayerImpl::PaintContents(SkCanvas* canvas, | 69 void WebContentLayerImpl::PaintContents(SkCanvas* canvas, |
69 gfx::Rect clip, | 70 gfx::Rect clip, |
70 gfx::RectF* opaque) { | 71 gfx::RectF* opaque) { |
71 if (!client_) | 72 if (!client_) |
72 return; | 73 return; |
73 | 74 |
74 WebFloatRect web_opaque; | 75 WebKit::WebFloatRect web_opaque; |
75 client_->paintContents( | 76 client_->paintContents( |
76 canvas, clip, layer_->layer()->can_use_lcd_text(), web_opaque); | 77 canvas, clip, layer_->layer()->can_use_lcd_text(), web_opaque); |
77 *opaque = web_opaque; | 78 *opaque = web_opaque; |
78 } | 79 } |
79 | 80 |
80 } // namespace WebKit | 81 } // namespace webkit |
OLD | NEW |