[Libreoffice-commits] .: Branch 'feature/gtk3' - vcl/inc vcl/unx

Michael Meeks michael at kemper.freedesktop.org
Mon Jul 11 07:33:35 PDT 2011


 vcl/inc/unx/headless/svpgdi.hxx |    3 ++
 vcl/unx/gtk/window/gtkframe.cxx |   42 ++++++++++++++++++++++++++++++++++------
 vcl/unx/headless/svpgdi.cxx     |    4 +--
 3 files changed, 41 insertions(+), 8 deletions(-)

New commits:
commit c978c592f747ee09ad91fa57814e92e43a735394
Author: Michael Meeks <michael.meeks at novell.com>
Date:   Mon Jul 11 15:31:50 2011 +0100

    add mroe debugging, and fix silly copyarea offset issue

diff --git a/vcl/inc/unx/headless/svpgdi.hxx b/vcl/inc/unx/headless/svpgdi.hxx
index 0113d34..0596621 100644
--- a/vcl/inc/unx/headless/svpgdi.hxx
+++ b/vcl/inc/unx/headless/svpgdi.hxx
@@ -55,7 +55,10 @@ class SvpSalGraphics : public SalGraphics
 
     basebmp::BitmapDeviceSharedPtr       m_aClipMap;
 
+protected:
     Region                               m_aClipRegion;
+    basegfx::B2IVector                   GetSize() { return m_aOrigDevice->getSize(); }
+private:
     bool                                 m_bClipSetup;
     struct ClipUndoHandle {
         SvpSalGraphics                &m_rGfx;
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index b32ecba..c03e544 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -4215,9 +4215,8 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
 {
 }
 
-static void print_update_area (GdkWindow *window, const char *msg)
+static void print_cairo_region (cairo_region_t *region, const char *msg)
 {
-    cairo_region_t *region = gdk_window_get_update_area (window);
     if (!region) {
         fprintf (stderr, "%s - NULL\n", msg);
         return;
@@ -4232,13 +4231,18 @@ static void print_update_area (GdkWindow *window, const char *msg)
     }
 }
 
+static void print_update_area (GdkWindow *window, const char *msg)
+{
+    print_cairo_region (gdk_window_get_update_area (window), msg);
+}
+
 void GtkSalGraphics::copyArea( long nDestX, long nDestY,
                                long nSrcX, long nSrcY,
                                long nSrcWidth, long nSrcHeight,
                                sal_uInt16 nFlags )
 {
     mpFrame->pushIgnoreDamage();
-    SvpSalGraphics::copyArea( nDestY, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, nFlags );
+    SvpSalGraphics::copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, nFlags );
     mpFrame->popIgnoreDamage();
 
     cairo_rectangle_int_t rect = { (int)nSrcX, (int)nSrcY, (int)nSrcWidth, (int)nSrcHeight };
@@ -4246,16 +4250,42 @@ void GtkSalGraphics::copyArea( long nDestX, long nDestY,
 
     print_update_area( gtk_widget_get_window( mpFrame->getWindow() ), "before copy area" );
 
-    g_warning ("FIXME: copy area delta: %d %d needs clip intersect\n",
+//    print_cairo_region( mpFrame->m_pRegion, "extremely odd SalFrame: shape combine region! - ");
+
+    g_warning( "FIXME: copy area delta: %d %d needs clip intersect\n",
                nDestX - nSrcX, nDestY - nSrcY );
-    // cairo_region_intersect (copy_area, window->clip_region_with_children);
+
+    // get clip region and translate it in the opposite direction & intersect ...
+    cairo_region_t *clip_region;
+
+    if( m_aClipRegion.GetRectCount() <= 0)
+    {
+        basegfx::B2IVector aSize = GetSize();
+        cairo_rectangle_int_t aCairoSize = { 0, 0, aSize.getX(), aSize.getY() };
+        clip_region = cairo_region_create_rectangle( &aCairoSize );
+    }
+    else
+    {
+        clip_region = cairo_region_create();
+        Rectangle aClipRect;
+        RegionHandle aHnd = m_aClipRegion.BeginEnumRects();
+        while( m_aClipRegion.GetNextEnumRect( aHnd, aClipRect ) )
+        {
+            cairo_rectangle_int_t aRect = { aClipRect.Left(), aClipRect.Top(),
+                                            aClipRect.Right(), aClipRect.Bottom() };
+            cairo_region_union_rectangle( clip_region, &aRect );
+        }
+        m_aClipRegion.EndEnumRects (aHnd);
+    }
+    cairo_region_translate( clip_region, - (nDestX - nSrcX), - (nDestY - nSrcY) );
+    cairo_region_intersect( region, clip_region );
 
     // FIXME: this will queue (duplicate) gtk+ re-rendering for the exposed area, c'est la vie
-    // FIXME: if 'implicit_paint' is set - we will queue a complete re-draw ...
     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 );
 }
 
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index 9bb5e21..43ebd29 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -229,6 +229,7 @@ SvpSalGraphics::ClipUndoHandle SvpSalGraphics::ensureClipFor( const basegfx::B2I
     if( nHit == 0 )
     {
         // degenerate case - we're all clipped ... hmm.
+        fprintf (stderr, "FIXME: denegerate case detected ...\n");
     }
     else if( nHit == 1 )
     {
@@ -267,11 +268,11 @@ SvpSalGraphics::ClipUndoHandle SvpSalGraphics::ensureClipFor( const basegfx::B2I
 // bitmapdevice instead.
 bool SvpSalGraphics::setClipRegion( const Region& i_rClip )
 {
+    m_aClipRegion = i_rClip;
     if( i_rClip.IsEmpty() )
     {
         m_aClipMap.reset();
         m_bClipSetup = true;
-        fprintf( stderr, "clip region reset\n" );
     }
     else if( i_rClip.GetRectCount() == 1 )
     {
@@ -283,7 +284,6 @@ bool SvpSalGraphics::setClipRegion( const Region& i_rClip )
     }
     else
     {
-        m_aClipRegion = i_rClip;
         m_bClipSetup = false;
     }
     return true;


More information about the Libreoffice-commits mailing list