Modified: trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp (166636 => 166637)
--- trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp 2014-04-02 09:14:36 UTC (rev 166636)
+++ trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp 2014-04-02 09:23:10 UTC (rev 166637)
@@ -22,10 +22,13 @@
#if USE(TEXTURE_MAPPER_GL)
#include "AcceleratedCompositingContextEfl.h"
+#include "CairoUtilitiesEfl.h"
#include "GraphicsLayerTextureMapper.h"
#include "MainFrame.h"
+#include "PlatformContextCairo.h"
#include "TextureMapperGL.h"
#include "TextureMapperLayer.h"
+#include "ewk_private.h"
#include "ewk_view_private.h"
const double compositingFrameRate = 60;
@@ -35,44 +38,44 @@
AcceleratedCompositingContext::AcceleratedCompositingContext(Evas_Object* ewkView, Evas_Object* compositingObject)
: m_view(ewkView)
, m_compositingObject(compositingObject)
+ , m_rootLayer(nullptr)
, m_syncTimer(this, &AcceleratedCompositingContext::syncLayers)
+ , m_isAccelerated(true)
{
ASSERT(m_view);
ASSERT(m_compositingObject);
+
+ Evas* evas = evas_object_evas_get(m_view);
+ const char* engine = ecore_evas_engine_name_get(ecore_evas_ecore_evas_get(evas));
+ if (!strncmp(engine, "opengl_x11", strlen("opengl_x11"))) {
+ m_evasGL = EflUniquePtr<Evas_GL>(evas_gl_new(evas_object_evas_get(m_view)));
+ if (m_evasGL)
+ m_evasGLContext = EvasGLContext::create(m_evasGL.get());
+ }
+
+ if (!m_evasGLContext)
+ m_isAccelerated = false;
}
AcceleratedCompositingContext::~AcceleratedCompositingContext()
{
}
-bool AcceleratedCompositingContext::initialize()
-{
- m_evasGL = EflUniquePtr<Evas_GL>(evas_gl_new(evas_object_evas_get(m_view)));
- if (!m_evasGL)
- return false;
-
- m_evasGLContext = EvasGLContext::create(m_evasGL.get());
- if (!m_evasGLContext)
- return false;
-
- Evas_Coord width = 0;
- Evas_Coord height = 0;
- evas_object_geometry_get(m_view, 0, 0, &width, &height);
-
- IntSize webViewSize(width, height);
- if (webViewSize.isEmpty())
- return false;
-
- return resize(webViewSize);
-}
-
void AcceleratedCompositingContext::syncLayers(Timer<AcceleratedCompositingContext>*)
{
ewk_view_mark_for_sync(m_view);
}
-bool AcceleratedCompositingContext::resize(const IntSize& size)
+void AcceleratedCompositingContext::resize(const IntSize& size)
{
+ if (m_viewSize == size)
+ return;
+
+ m_viewSize = size;
+
+ if (!m_isAccelerated)
+ return;
+
static Evas_GL_Config evasGLConfig = {
EVAS_GL_RGBA_8888,
EVAS_GL_DEPTH_BIT_8,
@@ -82,91 +85,102 @@
};
m_evasGLSurface = EvasGLSurface::create(m_evasGL.get(), &evasGLConfig, size);
- if (!m_evasGLSurface)
- return false;
+ if (!m_evasGLSurface) {
+ ERR("Failed to create a EvasGLSurface.");
+ return;
+ }
Evas_Native_Surface nativeSurface;
evas_gl_native_surface_get(m_evasGL.get(), m_evasGLSurface->surface(), &nativeSurface);
evas_object_image_native_surface_set(m_compositingObject, &nativeSurface);
- return true;
-}
-bool AcceleratedCompositingContext::canComposite()
-{
- return m_rootGraphicsLayer && m_textureMapper;
+ if (!evas_gl_make_current(m_evasGL.get(), m_evasGLSurface->surface(), m_evasGLContext->context())) {
+ ERR("Failed to evas_gl_make_current.");
+ return;
+ }
+
+ evas_gl_api_get(m_evasGL.get())->glViewport(0, 0, size.width(), size.height());
+ evas_gl_api_get(m_evasGL.get())->glClearColor(1, 1, 1, 1);
+ evas_gl_api_get(m_evasGL.get())->glClear(GL_COLOR_BUFFER_BIT);
}
void AcceleratedCompositingContext::flushAndRenderLayers()
{
- if (!canComposite())
- return;
-
MainFrame& frame = EWKPrivate::corePage(m_view)->mainFrame();
if (!frame.contentRenderer() || !frame.view())
return;
frame.view()->updateLayoutAndStyleIfNeededRecursive();
- if (!canComposite())
- return;
-
- if (!evas_gl_make_current(m_evasGL.get(), m_evasGLSurface->surface(), m_evasGLContext->context()))
- return;
-
if (!flushPendingLayerChanges())
return;
- compositeLayersToContext();
-
- if (toTextureMapperLayer(m_rootGraphicsLayer.get())->descendantsOrSelfHaveRunningAnimations() && !m_syncTimer.isActive())
- m_syncTimer.startOneShot(1 / compositingFrameRate);
+ if (m_isAccelerated)
+ paintToCurrentGLContext();
+ else
+ paintToGraphicsContext();
}
bool AcceleratedCompositingContext::flushPendingLayerChanges()
{
- m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
+ if (!m_rootLayer)
+ return false;
+
+ m_rootLayer->flushCompositingStateForThisLayerOnly();
return EWKPrivate::corePage(m_view)->mainFrame().view()->flushCompositingStateIncludingSubframes();
}
-void AcceleratedCompositingContext::compositeLayersToContext()
+void AcceleratedCompositingContext::paintToGraphicsContext()
{
- Evas_Coord width = 0;
- Evas_Coord height = 0;
- evas_object_geometry_get(m_view, 0, 0, &width, &height);
+ if (!m_textureMapper)
+ m_textureMapper = TextureMapper::create(TextureMapper::SoftwareMode);
- evas_gl_api_get(m_evasGL.get())->glViewport(0, 0, width, height);
- evas_gl_api_get(m_evasGL.get())->glClear(GL_COLOR_BUFFER_BIT);
+ RefPtr<cairo_surface_t> surface = createSurfaceForImage(m_compositingObject);
+ if (!surface)
+ return;
- m_textureMapper->beginPainting();
- m_textureMapper->beginClip(TransformationMatrix(), FloatRect(0, 0, width, height));
- toTextureMapperLayer(m_rootGraphicsLayer.get())->paint();
- m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get());
- m_textureMapper->endClip();
- m_textureMapper->endPainting();
+ PlatformContextCairo platformContext(cairo_create(surface.get()));
+ GraphicsContext context(&platformContext);
+ m_textureMapper->setGraphicsContext(&context);
+
+ compositeLayers();
}
-void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* rootLayer)
+void AcceleratedCompositingContext::paintToCurrentGLContext()
{
- if (!rootLayer) {
- m_rootGraphicsLayer = nullptr;
- return;
- }
-
if (!m_textureMapper) {
- evas_gl_make_current(m_evasGL.get(), m_evasGLSurface->surface(), m_evasGLContext->context());
- m_textureMapper = TextureMapperGL::create();
+ m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
+ static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true);
}
- m_rootGraphicsLayer = GraphicsLayer::create(0, 0);
- m_rootGraphicsLayer->addChild(rootLayer);
- m_rootGraphicsLayer->setDrawsContent(false);
- m_rootGraphicsLayer->setMasksToBounds(false);
- m_rootGraphicsLayer->setSize(IntSize(1, 1));
+ if (!evas_gl_make_current(m_evasGL.get(), m_evasGLSurface->surface(), m_evasGLContext->context()))
+ return;
- toTextureMapperLayer(m_rootGraphicsLayer.get())->setTextureMapper(m_textureMapper.get());
+ evas_gl_api_get(m_evasGL.get())->glViewport(0, 0, m_viewSize.width(), m_viewSize.height());
+ evas_gl_api_get(m_evasGL.get())->glClear(GL_COLOR_BUFFER_BIT);
- m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
+ compositeLayers();
}
+void AcceleratedCompositingContext::compositeLayers()
+{
+ TextureMapperLayer* currentRootLayer = toTextureMapperLayer(m_rootLayer);
+ if (!currentRootLayer)
+ return;
+
+ currentRootLayer->setTextureMapper(m_textureMapper.get());
+ currentRootLayer->applyAnimationsRecursively();
+
+ m_textureMapper->beginPainting();
+ m_textureMapper->beginClip(TransformationMatrix(), FloatRect(FloatPoint(), m_viewSize));
+ currentRootLayer->paint();
+ m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get());
+ m_textureMapper->endClip();
+ m_textureMapper->endPainting();
+
+ if (currentRootLayer->descendantsOrSelfHaveRunningAnimations() && !m_syncTimer.isActive())
+ m_syncTimer.startOneShot(1 / compositingFrameRate);
+}
+
} // namespace WebCore
#endif // USE(TEXTURE_MAPPER_GL)
Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (166636 => 166637)
--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp 2014-04-02 09:14:36 UTC (rev 166636)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp 2014-04-02 09:23:10 UTC (rev 166637)
@@ -255,8 +255,6 @@
WebCore::ViewportArguments viewportArguments;
Ewk_History* history;
std::unique_ptr<WebCore::AcceleratedCompositingContext> acceleratedCompositingContext;
- bool isCompositingActive;
- RefPtr<Evas_Object> compositingObject;
#if ENABLE(INPUT_TYPE_COLOR)
WebCore::ColorChooserClient* colorChooserClient;
#endif
@@ -272,8 +270,6 @@
size_t count;
size_t allocated;
} repaints;
- WTF::Vector<WebCore::IntRect> m_rectsToScroll;
- WTF::Vector<WebCore::IntSize> m_scrollOffsets;
unsigned int imh; /**< input method hints */
struct {
bool viewCleared : 1;
@@ -472,12 +468,6 @@
_ewk_view_repaints_resize(priv, ewkViewRepaintsSizeMaximumFree);
}
-static void _ewk_view_scrolls_flush(Ewk_View_Private_Data* priv)
-{
- priv->m_scrollOffsets.clear();
- priv->m_rectsToScroll.clear();
-}
-
// Default Event Handling //////////////////////////////////////////////
static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData)
{
@@ -747,6 +737,7 @@
#endif
pageSettings.setInteractiveFormValidationEnabled(true);
pageSettings.setAcceleratedCompositingEnabled(true);
+ pageSettings.setForceCompositingMode(true);
char* debugVisualsEnvironment = getenv("WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS");
bool showDebugVisuals = debugVisualsEnvironment && !strcmp(debugVisualsEnvironment, "1");
pageSettings.setShowDebugBorders(showDebugVisuals);
@@ -834,8 +825,6 @@
priv->contextMenu = 0;
#endif
- priv->isCompositingActive = false;
-
return priv;
}
@@ -878,6 +867,11 @@
delete priv;
}
+static void _ewk_view_accelerated_compositing_cb(void* data, Evas_Object*)
+{
+ static_cast<WebCore::AcceleratedCompositingContext*>(data)->flushAndRenderLayers();
+}
+
static void _ewk_view_smart_add(Evas_Object* ewkView)
{
const Evas_Smart* smart = evas_object_smart_smart_get(ewkView);
@@ -910,23 +904,24 @@
EWK_VIEW_PRIV_GET(smartData, priv);
- smartData->backing_store = evas_object_image_add(smartData->base.evas);
- if (EINA_UNLIKELY(!smartData->backing_store)) {
+ smartData->image = evas_object_image_add(smartData->base.evas);
+ if (EINA_UNLIKELY(!smartData->image)) {
ERR("Could not create backing store object.");
return;
}
- const Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas);
- const char* engine = ecore_evas_engine_name_get(ecoreEvas);
- if (!strncmp(engine, "opengl_x11", strlen("opengl_x11")))
- evas_object_image_content_hint_set(smartData->backing_store, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+ evas_object_image_alpha_set(smartData->image, false);
+ evas_object_image_filled_set(smartData->image, true);
+ evas_object_image_smooth_scale_set(smartData->image, smartData->zoom_weak_smooth_scale);
+ evas_object_pass_events_set(smartData->image, true);
+ evas_object_smart_member_add(smartData->image, ewkView);
+ evas_object_show(smartData->image);
- evas_object_image_alpha_set(smartData->backing_store, false);
- evas_object_image_smooth_scale_set(smartData->backing_store, smartData->zoom_weak_smooth_scale);
- evas_object_pass_events_set(smartData->backing_store, true);
- evas_object_smart_member_add(smartData->backing_store, ewkView);
- evas_object_show(smartData->backing_store);
+ priv->acceleratedCompositingContext = std::make_unique<WebCore::AcceleratedCompositingContext>(ewkView, smartData->image);
+ // Set the pixel get callback.
+ evas_object_image_pixels_get_callback_set(smartData->image, _ewk_view_accelerated_compositing_cb, priv->acceleratedCompositingContext.get());
+
smartData->events_rect = evas_object_rectangle_add(smartData->base.evas);
evas_object_color_set(smartData->events_rect, 0, 0, 0, 0);
evas_object_smart_member_add(smartData->events_rect, ewkView);
@@ -981,34 +976,14 @@
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
// these should be queued and processed in calculate as well!
- evas_object_resize(smartData->backing_store, width, height);
- evas_object_image_size_set(smartData->backing_store, width, height);
+ evas_object_resize(smartData->image, width, height);
+ evas_object_image_size_set(smartData->image, width, height);
+ evas_object_image_fill_set(smartData->image, 0, 0, width, height);
- if (priv->compositingObject) {
- evas_object_resize(priv->compositingObject.get(), width, height);
- evas_object_image_size_set(priv->compositingObject.get(), width, height);
- evas_object_image_fill_set(priv->compositingObject.get(), 0, 0, width, height);
+ priv->acceleratedCompositingContext->resize(WebCore::IntSize(width, height));
- if (priv->acceleratedCompositingContext)
- priv->acceleratedCompositingContext->resize(WebCore::IntSize(width, height));
- }
-
smartData->changed.size = true;
_ewk_view_smart_changed(smartData);
-
- if (smartData->animated_zoom.zoom.current < std::numeric_limits<float>::epsilon()) {
- Evas_Object* clip = evas_object_clip_get(smartData->backing_store);
- Evas_Coord x, y, contentWidth, contentHeight;
- evas_object_image_fill_set(smartData->backing_store, 0, 0, width, height);
- evas_object_geometry_get(smartData->backing_store, &x, &y, 0, 0);
- evas_object_move(clip, x, y);
- ewk_frame_contents_size_get(smartData->main_frame, &contentWidth, &contentHeight);
- if (width > contentWidth)
- width = contentWidth;
- if (height > contentHeight)
- height = contentHeight;
- evas_object_resize(clip, width, height);
- }
}
static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord /*x*/, Evas_Coord /*y*/)
@@ -1053,173 +1028,6 @@
}
}
-static inline void _ewk_view_scroll_process(Ewk_View_Smart_Data* smartData, void* pixels, Evas_Coord width, Evas_Coord height, const WebCore::IntSize& scrollOffset, const WebCore::IntRect& rectToScroll)
-{
- int scrollX = rectToScroll.x();
- int scrollY = rectToScroll.y();
- int scrollWidth = rectToScroll.width();
- int scrollHeight = rectToScroll.height();
-
- if (abs(scrollOffset.width()) >= scrollWidth || abs(scrollOffset.height()) >= scrollHeight) {
- ewk_view_repaint_add(smartData->_priv, scrollX, scrollY, scrollWidth, scrollHeight);
- return;
- }
-
- if (scrollX < 0) {
- scrollWidth += scrollX;
- scrollX = 0;
- }
- if (scrollY < 0) {
- scrollHeight += scrollY;
- scrollY = 0;
- }
-
- if (scrollX + scrollWidth > width)
- scrollWidth = width - scrollX;
- if (scrollY + scrollHeight > height)
- scrollHeight = height - scrollY;
-
- if (scrollWidth <= 0 || scrollHeight <= 0)
- return;
-
- int sourceX = scrollOffset.width() < 0 ? abs(scrollOffset.width()) : 0;
- int sourceY = scrollOffset.height() < 0 ? abs(scrollOffset.height()) : 0;
- int destinationX = scrollOffset.width() < 0 ? 0 : scrollOffset.width();
- int destinationY = scrollOffset.height() < 0 ? 0 : scrollOffset.height();
- int copyWidth = scrollWidth - abs(scrollOffset.width());
- int copyHeight = scrollHeight - abs(scrollOffset.height());
- if (scrollOffset.width() || scrollOffset.height()) {
- _ewk_view_screen_move(static_cast<uint32_t*>(pixels), destinationX, destinationY, sourceX, sourceY, copyWidth, copyHeight, width);
- evas_object_image_data_update_add(smartData->backing_store, destinationX, destinationY, copyWidth, copyHeight);
- }
-
- Eina_Rectangle verticalUpdate;
- verticalUpdate.x = destinationX ? 0 : copyWidth - 1;
- verticalUpdate.y = 0;
- verticalUpdate.w = abs(scrollOffset.width());
- verticalUpdate.h = scrollHeight;
- if (verticalUpdate.w && verticalUpdate.h)
- ewk_view_repaint_add(smartData->_priv, verticalUpdate.x, verticalUpdate.y, verticalUpdate.w, verticalUpdate.h);
-
- Eina_Rectangle horizontalUpdate;
- horizontalUpdate.x = destinationX;
- horizontalUpdate.y = destinationY ? 0 : copyHeight - 1;
- horizontalUpdate.w = copyWidth;
- horizontalUpdate.h = abs(scrollOffset.height());
- if (horizontalUpdate.w && horizontalUpdate.h)
- ewk_view_repaint_add(smartData->_priv, horizontalUpdate.x, horizontalUpdate.y, horizontalUpdate.w, horizontalUpdate.h);
-}
-
-static void _ewk_view_smart_scrolls_process(Ewk_View_Smart_Data* smartData)
-{
- Evas_Coord imageWidth, imageHeight;
- const WTF::Vector<WebCore::IntSize>& scrollOffsets = smartData->_priv->m_scrollOffsets;
- const WTF::Vector<WebCore::IntRect>& rectsToScroll = smartData->_priv->m_rectsToScroll;
-
- if (!scrollOffsets.size())
- return;
-
- evas_object_image_size_get(smartData->backing_store, &imageWidth, &imageHeight);
-
- WebCore::IntRect rectToScroll(0, 0, imageWidth, imageHeight);
- WebCore::IntSize scrollOffset;
- for (size_t i = 0; i < scrollOffsets.size(); ++i) {
- rectToScroll.intersect(rectsToScroll[i]);
- scrollOffset += scrollOffsets[i];
- }
-
- if (scrollOffset.isZero())
- return;
-
- void* pixels = evas_object_image_data_get(smartData->backing_store, 1);
- _ewk_view_scroll_process(smartData, pixels, imageWidth, imageHeight, scrollOffset, rectToScroll);
-
- evas_object_image_data_set(smartData->backing_store, pixels);
-
- return;
-}
-
-static bool _ewk_view_smart_repaints_process(Ewk_View_Smart_Data* smartData)
-{
- EWK_VIEW_PRIV_GET(smartData, priv);
-
- if (smartData->animated_zoom.zoom.current < std::numeric_limits<float>::epsilon()) {
- Evas_Object* clip = evas_object_clip_get(smartData->backing_store);
-
- // reset effects of zoom_weak_set()
- evas_object_image_fill_set(smartData->backing_store, 0, 0, smartData->view.w, smartData->view.h);
- evas_object_move(clip, smartData->view.x, smartData->view.y);
-
- Evas_Coord width = smartData->view.w;
- Evas_Coord height = smartData->view.h;
-
- Evas_Coord centerWidth, centerHeight;
- ewk_frame_contents_size_get(smartData->main_frame, ¢erWidth, ¢erHeight);
- if (width > centerWidth)
- width = centerWidth;
-
- if (height > centerHeight)
- height = centerHeight;
-
- evas_object_resize(clip, width, height);
- }
-
- Evas_Coord imageWidth, imageHeight;
- evas_object_image_size_get(smartData->backing_store, &imageWidth, &imageHeight);
-
- Eina_Tiler* tiler = eina_tiler_new(imageWidth, imageHeight);
- if (!tiler) {
- ERR("could not create tiler %dx%d", imageWidth, imageHeight);
- return false;
- }
-
- ewk_view_layout_if_needed_recursive(priv);
-
- size_t count;
- const Eina_Rectangle* paintRequest = ewk_view_repaints_pop(priv, &count);
- const Eina_Rectangle* paintRequestEnd = paintRequest + count;
- for (; paintRequest < paintRequestEnd; paintRequest++)
- eina_tiler_rect_add(tiler, paintRequest);
-
- Eina_Iterator* iterator = eina_tiler_iterator_new(tiler);
- if (!iterator) {
- ERR("could not get iterator for tiler");
- eina_tiler_free(tiler);
- return false;
- }
-
-#if USE(TILED_BACKING_STORE)
- if (priv->page->mainFrame().tiledBackingStore())
- priv->page->mainFrame().tiledBackingStore()->coverWithTilesIfNeeded();
-#endif
-
- Ewk_Paint_Context* context = ewk_paint_context_from_image_new(smartData->backing_store);
- ewk_paint_context_save(context);
-
- Eina_Rectangle* rect;
- EINA_ITERATOR_FOREACH(iterator, rect) {
- ewk_view_paint(smartData->_priv, context, rect);
- evas_object_image_data_update_add(smartData->backing_store, rect->x, rect->y, rect->w, rect->h);
- }
-
-#if ENABLE(INSPECTOR)
- WebCore::Page* page = EWKPrivate::corePage(smartData->self);
- if (page) {
- WebCore::InspectorController& controller = page->inspectorController();
- if (controller.highlightedNode())
- controller.drawHighlight(*context->graphicContext);
- }
-#endif
-
- ewk_paint_context_restore(context);
- ewk_paint_context_free(context);
-
- eina_tiler_free(tiler);
- eina_iterator_free(iterator);
-
- return true;
-}
-
static void _ewk_view_smart_calculate(Evas_Object* ewkView)
{
EWK_VIEW_SD_GET(ewkView, smartData);
@@ -1258,7 +1066,7 @@
if (smartData->changed.position && ((x != smartData->view.x) || (y != smartData->view.y))) {
evas_object_move(smartData->main_frame, x, y);
- evas_object_move(smartData->backing_store, x, y);
+ evas_object_move(smartData->image, x, y);
evas_object_move(smartData->events_rect, x, y);
smartData->changed.frame_rect = true;
smartData->view.x = x;
@@ -1266,12 +1074,6 @@
}
smartData->changed.position = false;
- _ewk_view_smart_scrolls_process(smartData);
- _ewk_view_scrolls_flush(priv);
-
- if (!_ewk_view_smart_repaints_process(smartData))
- ERR("failed to process repaints.");
-
if (smartData->changed.frame_rect) {
priv->page->mainFrame().view()->frameRectsChanged();
smartData->changed.frame_rect = false;
@@ -1285,10 +1087,7 @@
if (evas_object_clipees_get(smartData->base.clipper))
evas_object_show(smartData->base.clipper);
- evas_object_show(smartData->backing_store);
-
- if (priv->isCompositingActive)
- evas_object_show(priv->compositingObject.get());
+ evas_object_show(smartData->image);
}
static void _ewk_view_smart_hide(Evas_Object* ewkView)
@@ -1297,10 +1096,7 @@
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
evas_object_hide(smartData->base.clipper);
- evas_object_hide(smartData->backing_store);
-
- if (priv->isCompositingActive)
- evas_object_hide(priv->compositingObject.get());
+ evas_object_hide(smartData->image);
}
static Eina_Bool _ewk_view_smart_contents_resize(Ewk_View_Smart_Data*, int /*width*/, int /*height*/)
@@ -1340,7 +1136,6 @@
{
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
_ewk_view_repaints_flush(priv);
- _ewk_view_scrolls_flush(priv);
}
static void _ewk_view_zoom_animated_mark_stop(Ewk_View_Smart_Data* smartData)
@@ -1381,7 +1176,7 @@
Evas_Coord w = smartData->view.w * scale;
Evas_Coord h = smartData->view.h * scale;
Evas_Coord deltaX, deltaY, contentWidth, contentHeight;
- Evas_Object* clip = evas_object_clip_get(smartData->backing_store);
+ Evas_Object* clip = evas_object_clip_get(smartData->image);
ewk_frame_contents_size_get(smartData->main_frame, &contentWidth, &contentHeight);
if (smartData->view.w > 0 && smartData->view.h > 0) {
@@ -1392,7 +1187,7 @@
deltaY = 0;
}
- evas_object_image_fill_set(smartData->backing_store, centerX + deltaX, centerY + deltaY, w, h);
+ evas_object_image_fill_set(smartData->image, centerX + deltaX, centerY + deltaY, w, h);
if (smartData->view.w > 0 && smartData->view.h > 0) {
deltaX = ((smartData->view.w - w) * centerX) / smartData->view.w;
@@ -1414,7 +1209,7 @@
static void _ewk_view_smart_zoom_weak_smooth_scale_set(Ewk_View_Smart_Data* smartData, Eina_Bool smooth_scale)
{
- evas_object_image_smooth_scale_set(smartData->backing_store, smooth_scale);
+ evas_object_image_smooth_scale_set(smartData->image, smooth_scale);
}
static Eina_Bool _ewk_view_zoom_animator_cb(void* data)
@@ -1698,7 +1493,7 @@
smartData->bg_color.b = blue;
smartData->bg_color.a = alpha;
- evas_object_image_alpha_set(smartData->backing_store, alpha < 255);
+ evas_object_image_alpha_set(smartData->image, alpha < 255);
WebCore::FrameView* view = smartData->_priv->page->mainFrame().view();
if (view) {
@@ -2939,15 +2734,6 @@
view->updateLayoutAndStyleIfNeededRecursive();
}
-void ewk_view_scrolls_process(Ewk_View_Smart_Data* smartData)
-{
- EINA_SAFETY_ON_NULL_RETURN(smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- _ewk_view_smart_scrolls_process(smartData);
- _ewk_view_scrolls_flush(priv);
-}
-
/* internal methods ****************************************************/
/**
* @internal
@@ -3743,15 +3529,7 @@
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- priv->m_rectsToScroll.append(rectToScroll);
- priv->m_scrollOffsets.append(delta);
-
- for (size_t i = 0; i < priv->repaints.count; ++i) {
- priv->repaints.array[i].x += delta.width();
- priv->repaints.array[i].y += delta.height();
- }
-
- _ewk_view_smart_changed(smartData);
+ ewk_view_mark_for_sync(ewkView);
}
/**
@@ -4626,79 +4404,12 @@
#endif
}
-void _ewk_view_accelerated_compositing_cb(void* data, Evas_Object*)
-{
- Ewk_View_Private_Data* priv = static_cast<Ewk_View_Private_Data*>(data);
-
- if (priv->isCompositingActive)
- priv->acceleratedCompositingContext->flushAndRenderLayers();
-}
-
-bool _ewk_view_accelerated_compositing_context_create_if_needed(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
-
- if (!priv->acceleratedCompositingContext) {
- priv->acceleratedCompositingContext = std::make_unique<WebCore::AcceleratedCompositingContext>(ewkView, priv->compositingObject.get());
- if (!priv->acceleratedCompositingContext->initialize()) {
- priv->acceleratedCompositingContext = nullptr;
- return false;
- }
- }
- return true;
-}
-
-void _ewk_view_accelerated_compositing_object_create_if_needed(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
- EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
-
- if (!priv->compositingObject) {
- priv->compositingObject = adoptRef(evas_object_image_add(smartData->base.evas));
-
- evas_object_pass_events_set(priv->compositingObject.get(), true); // Just for rendering, ignore events.
- evas_object_image_alpha_set(priv->compositingObject.get(), true);
- evas_object_image_content_hint_set(priv->compositingObject.get(), EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
-
- // Set the pixel get callback.
- evas_object_image_pixels_get_callback_set(priv->compositingObject.get(), _ewk_view_accelerated_compositing_cb, priv);
-
- evas_object_smart_member_add(priv->compositingObject.get(), ewkView);
- }
-
- evas_object_image_size_set(priv->compositingObject.get(), smartData->view.w, smartData->view.h);
- evas_object_image_fill_set(priv->compositingObject.get(), 0, 0, smartData->view.w, smartData->view.h);
-
- evas_object_move(priv->compositingObject.get(), smartData->view.x, smartData->view.y);
- evas_object_resize(priv->compositingObject.get(), smartData->view.w, smartData->view.h);
- evas_object_hide(priv->compositingObject.get());
-}
-
void ewk_view_root_graphics_layer_set(Evas_Object* ewkView, WebCore::GraphicsLayer* rootLayer)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- bool active = !!rootLayer;
- if (priv->isCompositingActive == active)
- return;
-
- priv->isCompositingActive = active;
-
- if (priv->isCompositingActive) {
- _ewk_view_accelerated_compositing_object_create_if_needed(ewkView);
- if (_ewk_view_accelerated_compositing_context_create_if_needed(ewkView))
- evas_object_show(priv->compositingObject.get());
- else
- priv->isCompositingActive = false;
- }
-
- if (!priv->isCompositingActive)
- evas_object_hide(priv->compositingObject.get());
-
- if (priv->acceleratedCompositingContext)
- priv->acceleratedCompositingContext->attachRootGraphicsLayer(rootLayer);
+ priv->acceleratedCompositingContext->setRootGraphicsLayer(rootLayer);
}
void ewk_view_mark_for_sync(Evas_Object* ewkView)
@@ -4708,7 +4419,7 @@
// Mark the image as "dirty" meaning it needs an update next time evas renders.
// It will call the pixel get callback then.
- evas_object_image_pixels_dirty_set(priv->compositingObject.get(), true);
+ evas_object_image_pixels_dirty_set(smartData->image, true);
}
void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor)