vcl/inc/headless/svpgdi.hxx | 2 vcl/inc/unx/gtk/gtkgdi.hxx | 2 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 83 ++++---------------------- 3 files changed, 15 insertions(+), 72 deletions(-)
New commits: commit 7c065a13e132b240b89801788a6e59d50001d224 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Mar 4 13:00:30 2015 +0000 GtkSalGraphics never operate on virtual devices the VirtualDevice is a SvpSalVirtualDevice and it uses its own SvpSalGraphics to render to itself, so we don't have to worry about being asked to render to a VirtualDevice i.e. Revert "just in case, fallback if not cairo-surface" This reverts commit 756b2c945143ee171ae80c9ba51ef0dd50fab789. Conflicts: vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx Change-Id: I3bd3ce42e7c943f8cfca1cc1d2ea6e5eb51bb349 diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index c45cf0f..e9f5110 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -55,7 +55,7 @@ protected: public: GlyphCache& getPlatformGlyphCache(); - virtual void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice); + void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice); void BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask, const basegfx::B2IPoint &rDstPoint); diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 3bc7ef0..a984f1b 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -35,10 +35,8 @@ class GtkSalFrame; class GtkSalGraphics : public SvpSalGraphics { GtkSalFrame *mpFrame; - bool m_bCairoCompatibleSurface; public: GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ); - virtual void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice) SAL_OVERRIDE; virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 281cd26..98b7850 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1555,20 +1555,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) gtk_widget_path_free(path); } -void GtkSalGraphics::setDevice(basebmp::BitmapDeviceSharedPtr& rDevice) -{ - SvpSalGraphics::setDevice(rDevice); - bool bCairoCompatibleSurface = rDevice->getScanlineFormat() == basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX; - if (bCairoCompatibleSurface != m_bCairoCompatibleSurface) - { - if (bCairoCompatibleSurface) - m_xTextRenderImpl.reset(new GtkCairoTextRender(*this)); - else - m_xTextRenderImpl.reset(new SvpTextRender(*this)); - m_bCairoCompatibleSurface = bCairoCompatibleSurface; - } -} - void GtkSalGraphics::copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, commit 1491e9800bee70b5902643bb1bf8c1789cf12459 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Mar 4 12:48:01 2015 +0000 simplify optimized scrolling route a little Change-Id: Ib5e4d84c1943e0286632a7d5a805c3c4e8688de9 diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 8ccf2e3..281cd26 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1555,27 +1555,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) gtk_widget_path_free(path); } -static void print_cairo_region (cairo_region_t *region, const char *msg) -{ - if (!region) { - fprintf (stderr, "%s - NULL\n", msg); - return; - } - int numrect = cairo_region_num_rectangles (region); - fprintf (stderr, "%s - %d rects\n", msg, numrect); - for (int i = 0; i < numrect; i++) { - cairo_rectangle_int_t rect; - cairo_region_get_rectangle (region, i, &rect); - fprintf( stderr, "\t%d -> %d,%d %dx%d\n", i, - rect.x, rect.y, rect.width, rect.height ); - } -} - -static void print_update_area (GdkWindow *window, const char *msg) -{ - print_cairo_region (gdk_window_get_update_area (window), msg); -} - void GtkSalGraphics::setDevice(basebmp::BitmapDeviceSharedPtr& rDevice) { SvpSalGraphics::setDevice(rDevice); @@ -1595,56 +1574,36 @@ void GtkSalGraphics::copyArea( long nDestX, long nDestY, long nSrcWidth, long nSrcHeight, sal_uInt16 nFlags ) { -#ifndef DISABLE_CLEVER_COPYAREA mpFrame->pushIgnoreDamage(); SvpSalGraphics::copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, nFlags ); mpFrame->popIgnoreDamage(); + cairo_rectangle_int_t rect = { (int)nSrcX, (int)nSrcY, (int)nSrcWidth, (int)nSrcHeight }; cairo_region_t *region = cairo_region_create_rectangle( &rect ); - print_update_area( gtk_widget_get_window( mpFrame->getWindow() ), "before copy area" ); - -// print_cairo_region( mpFrame->m_pRegion, "extremely odd SalFrame: shape combine region! - "); - - g_warning( "FIXME: copy area delta: %d %d needs clip intersect\n", - (int)(nDestX - nSrcX), (int)(nDestY - nSrcY) ); - - // get clip region and translate it in the opposite direction & intersect ... - cairo_region_t *clip_region; - - RectangleVector rects; - m_aClipRegion.GetRegionRectangles(rects); - if (rects.empty()) - { - basegfx::B2IVector aSize = GetSize(); - cairo_rectangle_int_t aCairoSize = { 0, 0, aSize.getX(), aSize.getY() }; - clip_region = cairo_region_create_rectangle( &aCairoSize ); - } - else + if (!m_aClipRegion.IsEmpty()) { - clip_region = cairo_region_create(); - for (RectangleVector::iterator i(rects.begin()); i != rects.end(); ++i) + // get clip region and translate it in the opposite direction & intersect ... + cairo_region_t *clip_region = cairo_region_create(); + + RectangleVector aRectangles; + m_aClipRegion.GetRegionRectangles(aRectangles); + for (RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter) { - cairo_rectangle_int_t aRect = { (int)i->Left(), (int)i->Top(), - (int)i->GetWidth(), (int)i->GetHeight() }; + cairo_rectangle_int_t aRect = { (int)aRectIter->Left(), (int)aRectIter->Top(), + (int)aRectIter->GetWidth(), (int)aRectIter->GetHeight() }; cairo_region_union_rectangle( clip_region, &aRect ); } + + cairo_region_translate( clip_region, - (nDestX - nSrcX), - (nDestY - nSrcY) ); + cairo_region_intersect( region, clip_region ); + cairo_region_destroy( clip_region ); } - print_cairo_region( clip_region, "pristine clip region" ); - cairo_region_translate( clip_region, - (nDestX - nSrcX), - (nDestY - nSrcY) ); - print_cairo_region( clip_region, "translated clip region" ); - cairo_region_intersect( region, clip_region ); - print_cairo_region( region, "reduced copy area region" ); // FIXME: this will queue (duplicate) gtk+ re-rendering for the exposed area, c'est la vie gdk_window_move_region( gtk_widget_get_window( mpFrame->getWindow() ), region, nDestX - nSrcX, nDestY - nSrcY ); - print_update_area( gtk_widget_get_window( mpFrame->getWindow() ), "after copy area" ); - cairo_region_destroy( clip_region ); cairo_region_destroy( region ); -#else - SvpSalGraphics::copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, nFlags ); -#endif } cairo_t* GtkSalGraphics::getCairoContext()
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits