1 diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
2 index c8b1b68..e6061e1 100644
3 --- a/Source/WebCore/ChangeLog
4 +++ b/Source/WebCore/ChangeLog
6 +2012-11-29 Kyungjin Kim <gen.kim@samsung.com>
8 + [EFL][WK2] Implement Accelerated2dCanvas on WK2 Efl port
9 + https://bugs.webkit.org/show_bug.cgi?id=XXXXX
11 + Reviewed by NOBODY (OOPS!).
13 + Implement accelerated 2d canvas using Coordinated Graphics on WK2 Efl port.
14 + This implementation is based on COORDINATED_GRAPHICS.
16 + No new tests. Covered by existing tests.
18 + * PlatformEfl.cmake:
19 + * platform/graphics/GraphicsContext.cpp:
21 + * platform/graphics/ImageBuffer.cpp:
23 + * platform/graphics/ImageBuffer.h:
25 + (WebCore::ImageBuffer::getSurface):
26 + * platform/graphics/cairo/GraphicsContextCairo.cpp:
27 + (WebCore::GraphicsContext::isAcceleratedContext):
29 + * platform/graphics/cairo/ImageBufferCairo.cpp:
30 + (WebCore::ImageBufferData::ImageBufferData):
31 + (WebCore::ImageBuffer::ImageBuffer):
33 + (WebCore::ImageBuffer::platformLayer):
34 + * platform/graphics/cairo/ImageBufferDataCairo.h:
37 + * platform/graphics/cairo/PlatformContextCairo.cpp:
38 + (WebCore::PlatformContextCairo::PlatformContextCairo):
39 + * platform/graphics/cairo/PlatformContextCairo.h:
40 + (WebCore::PlatformContextCairo::isAccelerated):
41 + (WebCore::PlatformContextCairo::setAccelerated):
42 + (PlatformContextCairo):
43 + * platform/graphics/efl/Canvas2DLayerEfl.cpp: Added.
45 + (WebCore::Canvas2DLayerEfl::create):
46 + (WebCore::Canvas2DLayerEfl::Canvas2DLayerEfl):
47 + (WebCore::Canvas2DLayerEfl::~Canvas2DLayerEfl):
48 + (WebCore::Canvas2DLayerEfl::copyToGraphicsSurface):
49 + (WebCore::Canvas2DLayerEfl::graphicsSurfaceToken):
50 + (WebCore::Canvas2DLayerEfl::paintContents):
51 + * platform/graphics/efl/Canvas2DLayerEfl.h: Added.
54 + (WebCore::Canvas2DLayerEfl::paintToTextureMapper):
55 + (WebCore::Canvas2DLayerEfl::platformLayerSize):
56 + (WebCore::Canvas2DLayerEfl::is2D):
57 + * platform/graphics/texmap/TextureMapperPlatformLayer.h:
59 + (TextureMapperPlatformLayer):
60 + (WebCore::TextureMapperPlatformLayer::paintContents):
61 + (WebCore::TextureMapperPlatformLayer::is2D):
63 2012-11-29 Sheriff Bot <webkit.review.bot@gmail.com>
65 Unreviewed, rolling out r136111.
66 diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake
67 index 31e4c87..28e8b18 100644
68 --- a/Source/WebCore/PlatformEfl.cmake
69 +++ b/Source/WebCore/PlatformEfl.cmake
70 @@ -299,6 +299,12 @@ IF (WTF_USE_3D_GRAPHICS)
74 +IF (ENABLE_ACCELERATED_2D_CANVAS)
75 + LIST(APPEND WebCore_SOURCES
76 + platform/graphics/efl/Canvas2DLayerEfl.cpp
80 ADD_DEFINITIONS(-DDATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}")
83 diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp
84 index c21173a..15e61f2 100644
85 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp
86 +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp
87 @@ -730,7 +730,7 @@ void GraphicsContext::setPlatformShouldSmoothFonts(bool)
91 -#if !USE(SKIA) && !USE(CG)
92 +#if !USE(SKIA) && !USE(CG) && !USE(CAIRO)
93 bool GraphicsContext::isAcceleratedContext() const
96 diff --git a/Source/WebCore/platform/graphics/ImageBuffer.cpp b/Source/WebCore/platform/graphics/ImageBuffer.cpp
97 index 138d078..67f2b11 100644
98 --- a/Source/WebCore/platform/graphics/ImageBuffer.cpp
99 +++ b/Source/WebCore/platform/graphics/ImageBuffer.cpp
100 @@ -99,7 +99,7 @@ void ImageBuffer::convertToLuminanceMask()
101 genericConvertToLuminanceMask();
104 -#if USE(ACCELERATED_COMPOSITING) && !USE(SKIA)
105 +#if USE(ACCELERATED_COMPOSITING) && !USE(SKIA) && !USE(CAIRO)
106 PlatformLayer* ImageBuffer::platformLayer() const
109 diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h
110 index 47cfeb8..476a31e 100644
111 --- a/Source/WebCore/platform/graphics/ImageBuffer.h
112 +++ b/Source/WebCore/platform/graphics/ImageBuffer.h
113 @@ -120,6 +120,9 @@ namespace WebCore {
115 AffineTransform baseTransform() const { return AffineTransform(1, 0, 0, -1, 0, internalSize().height()); }
118 + cairo_surface_t* getSurface() const { return m_data.m_surface; }
120 #if USE(ACCELERATED_COMPOSITING)
121 PlatformLayer* platformLayer() const;
123 diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
124 index b87af4a..ba8203e 100644
125 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
126 +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
127 @@ -1173,6 +1173,11 @@ void GraphicsContext::set3DTransform(const TransformationMatrix& transform)
131 +bool GraphicsContext::isAcceleratedContext() const
133 + return platformContext()->isAccelerated();
136 } // namespace WebCore
139 diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
140 index 026f449..363622f 100644
141 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
142 +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
143 @@ -51,10 +51,13 @@ namespace WebCore {
144 ImageBufferData::ImageBufferData(const IntSize&)
146 , m_platformContext(0)
147 +#if USE(ACCELERATED_COMPOSITING)
148 + , m_platformLayer(0)
153 -ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode, DeferralMode, bool& success)
154 +ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode renderingMode, DeferralMode, bool& success)
157 , m_logicalSize(size)
158 @@ -70,6 +73,14 @@ ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, Color
159 m_data.m_platformContext.setCr(cr.get());
160 m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext));
162 +#if ENABLE(ACCELERATED_2D_CANVAS) && PLATFORM(EFL)
163 + if (renderingMode == Accelerated) {
164 + m_data.m_platformLayer = Canvas2DLayerEfl::create(this, m_size);
165 + context()->platformContext()->setAccelerated(true);
168 + UNUSED_PARAM(renderingMode);
172 ImageBuffer::~ImageBuffer()
173 @@ -310,4 +321,11 @@ String ImageBuffer::toDataURL(const String& mimeType, const double*, CoordinateS
177 +#if USE(ACCELERATED_COMPOSITING)
178 +PlatformLayer* ImageBuffer::platformLayer() const
180 + return static_cast<TextureMapperPlatformLayer*>(m_data.m_platformLayer.get());
184 } // namespace WebCore
185 diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h b/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
186 index 5ca7262..466eaf9 100644
187 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
188 +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
192 #include "PlatformContextCairo.h"
193 +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
194 +#include <efl/Canvas2DLayerEfl.h>
197 typedef struct _cairo_surface cairo_surface_t;
202 +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
203 +class Canvas2DLayerEfl;
206 class ImageBufferData {
208 @@ -37,6 +43,9 @@ public:
210 cairo_surface_t* m_surface;
211 PlatformContextCairo m_platformContext;
212 +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
213 + RefPtr<Canvas2DLayerEfl> m_platformLayer;
217 } // namespace WebCore
218 diff --git a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp
219 index 865d152..92fd924 100644
220 --- a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp
221 +++ b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp
222 @@ -82,6 +82,7 @@ public:
224 PlatformContextCairo::PlatformContextCairo(cairo_t* cr)
226 + , m_accelerated(false)
228 m_stateStack.append(State());
229 m_state = &m_stateStack.last();
230 diff --git a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h
231 index d7f1205..436407a 100644
232 --- a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h
233 +++ b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h
234 @@ -67,6 +67,9 @@ public:
235 enum AlphaPreservation { DoNotPreserveAlpha, PreserveAlpha };
236 void prepareForStroking(const GraphicsContextState&, AlphaPreservation = PreserveAlpha);
238 + bool isAccelerated() const { return m_accelerated; }
239 + void setAccelerated(bool accelerated) { m_accelerated = accelerated; }
242 void clipForPatternFilling(const GraphicsContextState&);
244 @@ -79,6 +82,7 @@ private:
245 // GraphicsContext is responsible for managing the state of the ShadowBlur,
246 // so it does not need to be on the state stack.
247 ShadowBlur m_shadowBlur;
248 + bool m_accelerated;
252 diff --git a/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.cpp b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.cpp
254 index 0000000..0391ac1
256 +++ b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.cpp
259 + Copyright (C) 2012 Samsung Electronics
261 + This library is free software; you can redistribute it and/or
262 + modify it under the terms of the GNU Library General Public
263 + License as published by the Free Software Foundation; either
264 + version 2 of the License, or (at your option) any later version.
266 + This library is distributed in the hope that it will be useful,
267 + but WITHOUT ANY WARRANTY; without even the implied warranty of
268 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
269 + Library General Public License for more details.
271 + You should have received a copy of the GNU Library General Public License
272 + along with this library; see the file COPYING.LIB. If not, write to
273 + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
274 + Boston, MA 02110-1301, USA.
279 +#if USE(ACCELERATED_COMPOSITING) && ENABLE(ACCELERATED_2D_CANVAS)
280 +#include "Canvas2DLayerEfl.h"
282 +#include "CanvasRenderingContext2D.h"
286 +PassRefPtr<Canvas2DLayerEfl> Canvas2DLayerEfl::create(ImageBuffer* buffer, IntSize& size)
288 + return adoptRef(new Canvas2DLayerEfl(buffer, size));
291 +Canvas2DLayerEfl::Canvas2DLayerEfl(ImageBuffer* buffer, IntSize& size)
297 +Canvas2DLayerEfl::~Canvas2DLayerEfl()
301 +#if USE(GRAPHICS_SURFACE)
302 +uint32_t Canvas2DLayerEfl::copyToGraphicsSurface()
306 +GraphicsSurfaceToken Canvas2DLayerEfl::graphicsSurfaceToken() const
310 +void Canvas2DLayerEfl::paintContents(GraphicsContext& context, const IntRect& rect)
313 + context.clearRect(FloatRect(rect));
314 + context.platformContext()->drawSurfaceToContext(m_buffer->getSurface(), FloatRect(rect), FloatRect(rect), &context);
319 +} // namespace WebCore
322 diff --git a/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.h b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.h
324 index 0000000..69aa786
326 +++ b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.h
329 + Copyright (C) 2012 Samsung Electronics
331 + This library is free software; you can redistribute it and/or
332 + modify it under the terms of the GNU Library General Public
333 + License as published by the Free Software Foundation; either
334 + version 2 of the License, or (at your option) any later version.
336 + This library is distributed in the hope that it will be useful,
337 + but WITHOUT ANY WARRANTY; without even the implied warranty of
338 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
339 + Library General Public License for more details.
341 + You should have received a copy of the GNU Library General Public License
342 + along with this library; see the file COPYING.LIB. If not, write to
343 + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
344 + Boston, MA 02110-1301, USA.
347 +#ifndef Canvas2DLayerEfl_h
348 +#define Canvas2DLayerEfl_h
350 +#if USE(GRAPHICS_SURFACE)
351 +#include "GraphicsSurface.h"
353 +#if USE(TEXTURE_MAPPER_GL)
354 +#include <texmap/TextureMapperPlatformLayer.h>
358 +class CanvasRenderingContext2D;
360 +class Canvas2DLayerEfl :
361 +#if USE(TEXTURE_MAPPER_GL)
362 + public TextureMapperPlatformLayer
364 + , public RefCounted<Canvas2DLayerEfl> {
366 + static PassRefPtr<Canvas2DLayerEfl> create(ImageBuffer*, IntSize&);
367 + virtual ~Canvas2DLayerEfl();
369 +#if USE(TEXTURE_MAPPER_GL)
370 + virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) { }
372 +#if USE(GRAPHICS_SURFACE)
373 + virtual IntSize platformLayerSize() const { return m_size; }
374 + virtual uint32_t copyToGraphicsSurface();
375 + virtual GraphicsSurfaceToken graphicsSurfaceToken() const;
377 + void paintContents(GraphicsContext&, const IntRect&);
379 + virtual bool is2D() { return true; }
382 + Canvas2DLayerEfl(ImageBuffer*, IntSize&);
383 + ImageBuffer* m_buffer;
387 +} // namespace WebCore
389 +#endif // Canvas2DLayerEfl_h
390 diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
391 index 38af03e..0a26fca 100644
392 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
393 +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
395 #ifndef TextureMapperPlatformLayer_h
396 #define TextureMapperPlatformLayer_h
398 +#if ENABLE(ACCELERATED_2D_CANVAS)
399 +#include "GraphicsContext.h"
401 #if USE(GRAPHICS_SURFACE)
402 #include "GraphicsSurface.h"
404 @@ -41,6 +44,10 @@ public:
405 virtual uint32_t copyToGraphicsSurface() { return 0; }
406 virtual GraphicsSurfaceToken graphicsSurfaceToken() const { return GraphicsSurfaceToken(); }
408 +#if ENABLE(ACCELERATED_2D_CANVAS)
409 + virtual void paintContents(GraphicsContext&, const IntRect&) { }
410 + virtual bool is2D() { return false; }
415 diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
416 index b805594..1897c41 100644
417 --- a/Source/WebKit2/ChangeLog
418 +++ b/Source/WebKit2/ChangeLog
420 +2012-11-29 Kyungjin Kim <gen.kim@samsung.com>
422 + [EFL][WK2] Implement Accelerated2dCanvas on WK2 Efl port
423 + https://bugs.webkit.org/show_bug.cgi?id=XXXXX
425 + Reviewed by NOBODY (OOPS!).
427 + Implement accelerated 2d canvas using Coordinated Graphics on WK2 Efl port.
428 + This implementation is based on COORDINATED_GRAPHICS.
430 + * UIProcess/API/efl/EwkViewImpl.cpp:
431 + (EwkViewImpl::EwkViewImpl):
432 + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
433 + (WebCore::CoordinatedGraphicsLayer::setContentsToCanvas):
434 + (WebCore::CoordinatedGraphicsLayer::syncCanvas):
435 + (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaint):
436 + (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
438 2012-11-28 Jocelyn Turcotte <jocelyn.turcotte@digia.com>
440 [Qt] The WebView should be flickable only using touch events
441 diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
442 index 50e4cb2..d7b5a1a 100644
443 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
444 +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
445 @@ -151,6 +151,9 @@ EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, Pass
447 m_pageProxy->pageGroup()->preferences()->setWebGLEnabled(true);
449 +#if ENABLE(ACCELERATED_2D_CANVAS)
450 + m_pageProxy->pageGroup()->preferences()->setAccelerated2dCanvasEnabled(true);
452 if (behavior == DefaultBehavior)
453 m_pageProxy->setUseFixedLayout(true);
455 diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
456 index 349948e..c42c910 100644
457 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
458 +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
459 @@ -345,7 +345,10 @@ void CoordinatedGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer)
461 client()->notifyFlushRequired(this);
463 - UNUSED_PARAM(platformLayer);
464 + m_canvasPlatformLayer = platformLayer;
465 + m_canvasNeedsDisplay = true;
467 + client()->notifyFlushRequired(this);
471 @@ -553,6 +556,9 @@ void CoordinatedGraphicsLayer::syncCanvas()
472 ASSERT(m_canvasPlatformLayer);
473 #if USE(GRAPHICS_SURFACE)
474 m_coordinator->syncCanvas(m_id, m_canvasPlatformLayer);
475 +#elif ENABLE(ACCELERATED_2D_CANVAS)
476 + if (m_canvasPlatformLayer->is2D())
479 m_canvasNeedsDisplay = false;
481 @@ -667,6 +673,13 @@ void CoordinatedGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context,
486 +#if ENABLE(ACCELERATED_2D_CANVAS) && !USE(GRAPHICS_SURFACE)
487 + if (m_canvasPlatformLayer && m_canvasPlatformLayer->is2D()) {
488 + m_canvasPlatformLayer->paintContents(*context, rect);
492 paintGraphicsLayerContents(*context, rect);
495 @@ -747,6 +760,10 @@ void CoordinatedGraphicsLayer::removeTile(int tileID)
497 void CoordinatedGraphicsLayer::updateContentBuffers()
499 +#if ENABLE(ACCELERATED_2D_CANVAS) && !USE(GRAPHICS_SURFACE)
500 + if (m_canvasPlatformLayer && m_canvasPlatformLayer->is2D())
501 + setDrawsContent(true);
503 if (!drawsContent() || !contentsAreVisible() || m_size.isEmpty()) {
504 m_mainBackingStore.clear();
505 m_previousBackingStore.clear();