On 25 April 2013 03:37, Jianhua Shao <alex....@gmail.com> wrote: > On Thu, Apr 25, 2013 at 5:32 AM, Emmanuel Rodriguez < > emmanuel.rodrig...@gmail.com> wrote: > >> >> >> Thanks for sharing your experience. >> > The version 1.6.3 does not meet my requirements. > "enable-accelerated-compositing" is what I need in the newer version, from > the dev document I found it is available from version 1.7.5. > Seems I can give a try on version 1.7.x. > I just ment to try it and see if the transparencies where still enabled in 1.6.3
> > And have you read my another mail, > > cairo_surface_t* surface = webkit_web_view_get_snapshot(view); > cairo_surface_write_to_png(surface, "/home/meego/dump.png"); > > will result a transparent png file... > Maybe I need to do some configuration on cario/gtk, but I am new on this > subject, anyone can give me some hint? > By the looks of the code of 1.6.3 and 1.10.2 it seems that webkit_web_view_get_snapshot() behaves like the old webkit_web_view_draw(). In 1.6.3 the draw operation is done with: static void paintWebView(Frame* frame, gboolean transparent, GraphicsContext& context, const IntRect& clipRect, const Vector<IntRect>& rects) { bool coalesce = true; if (rects.size() > 0) coalesce = shouldCoalesce(clipRect, rects); if (coalesce) { context.clip(clipRect); if (transparent) context.clearRect(clipRect); frame->view()->paint(&context, clipRect); } else { for (size_t i = 0; i < rects.size(); i++) { IntRect rect = rects[i]; context.save(); context.clip(rect); if (transparent) context.clearRect(rect); frame->view()->paint(&context, rect); context.restore(); } } context.save(); context.clip(clipRect); frame->page()->inspectorController()->drawHighlight(context); context.restore(); } In 1.10.2 webkit_web_view_get_snapshot is done with: cairo_surface_t* webkit_web_view_get_snapshot(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); Frame* frame = core(webView)->mainFrame(); if (!frame || !frame->contentRenderer() || !frame->view()) return 0; frame->view()->updateLayoutAndStyleIfNeededRecursive(); GtkAllocation allocation; gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation); cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation.width, allocation.height); RefPtr<cairo_t> cr = adoptRef(cairo_create(surface)); GraphicsContext gc(cr.get()); IntRect rect = allocation; gc.applyDeviceScaleFactor(frame->page()->deviceScaleFactor()); gc.save(); gc.clip(rect); if (webView->priv->transparent) gc.clearRect(rect); frame->view()->paint(&gc, rect); gc.restore(); return surface; } Both functions have the same drawing logic: context.clip(clipRect); if (transparent) context.clearRect(clipRect); frame->view()->paint(&context, clipRect); context.restore(); Wit the exception that webkit_web_view_get_snapshot() forces the drawing into an image surface except of accepting a cairo context. -- Emmanuel Rodriguez
_______________________________________________ webkit-help mailing list webkit-help@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-help