OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 #include "config.h" | 27 #include "config.h" |
28 #include "WebViewBenchmarkSupportImpl.h" | 28 #include "WebViewBenchmarkSupportImpl.h" |
29 | 29 |
30 #include "WebViewImpl.h" | 30 #include "WebViewImpl.h" |
31 #include "core/page/FrameView.h" | 31 #include "core/page/FrameView.h" |
32 #include "core/platform/graphics/FloatSize.h" | 32 #include "core/platform/graphics/FloatSize.h" |
| 33 #include "core/platform/graphics/GraphicsContext.h" |
33 #include "core/platform/graphics/GraphicsLayer.h" | 34 #include "core/platform/graphics/GraphicsLayer.h" |
34 #include "core/platform/graphics/IntRect.h" | 35 #include "core/platform/graphics/IntRect.h" |
35 #include "core/platform/graphics/IntSize.h" | 36 #include "core/platform/graphics/IntSize.h" |
36 #include "painting/GraphicsContextBuilder.h" | |
37 | 37 |
38 #include <public/WebCanvas.h> | 38 #include <public/WebCanvas.h> |
39 #include <wtf/CurrentTime.h> | 39 #include <wtf/CurrentTime.h> |
40 #include <wtf/OwnPtr.h> | 40 #include <wtf/OwnPtr.h> |
41 #include <wtf/Vector.h> | 41 #include <wtf/Vector.h> |
42 | 42 |
43 using namespace WebCore; | 43 using namespace WebCore; |
44 | 44 |
45 namespace WebKit { | 45 namespace WebKit { |
46 | 46 |
47 void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsL
ayer& layer, const IntRect& clip) | 47 void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsL
ayer& layer, const IntRect& clip) |
48 { | 48 { |
49 WebSize canvasSize(clip.width(), clip.height()); | 49 WebSize canvasSize(clip.width(), clip.height()); |
50 WebCanvas* canvas = paintClient->willPaint(canvasSize); | 50 WebCanvas* canvas = paintClient->willPaint(canvasSize); |
51 GraphicsContextBuilder builder(canvas); | 51 GraphicsContext context(canvas); |
52 | 52 |
53 layer.paintGraphicsLayerContents(builder.context(), clip); | 53 layer.paintGraphicsLayerContents(context, clip); |
54 paintClient->didPaint(canvas); | 54 paintClient->didPaint(canvas); |
55 } | 55 } |
56 | 56 |
57 void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintCl
ient, GraphicsLayer& layer) | 57 void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintCl
ient, GraphicsLayer& layer) |
58 { | 58 { |
59 FloatSize layerSize = layer.size(); | 59 FloatSize layerSize = layer.size(); |
60 IntRect clip(0, 0, layerSize.width(), layerSize.height()); | 60 IntRect clip(0, 0, layerSize.width(), layerSize.height()); |
61 | 61 |
62 if (layer.drawsContent()) | 62 if (layer.drawsContent()) |
63 paintLayer(paintClient, layer, clip); | 63 paintLayer(paintClient, layer, clip); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (!m_webViewImpl->isAcceleratedCompositingActive()) | 95 if (!m_webViewImpl->isAcceleratedCompositingActive()) |
96 return softwarePaint(paintClient, paintMode); | 96 return softwarePaint(paintClient, paintMode); |
97 GraphicsLayer* layer = m_webViewImpl->rootGraphicsLayer(); | 97 GraphicsLayer* layer = m_webViewImpl->rootGraphicsLayer(); |
98 switch (paintMode) { | 98 switch (paintMode) { |
99 case PaintModeEverything: | 99 case PaintModeEverything: |
100 acceleratedPaintUnclipped(paintClient, *layer); | 100 acceleratedPaintUnclipped(paintClient, *layer); |
101 break; | 101 break; |
102 } | 102 } |
103 } | 103 } |
104 } | 104 } |
OLD | NEW |