[dasher] Comment out unused screens to hopefully make bug #607775 more obvious. BTW the idea behind screen dr



commit e3a59cdc32b911b51d3d682acd25ebf61b21ecec
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Fri Jan 22 15:39:30 2010 +0000

    Comment out unused screens to hopefully make bug #607775 more obvious.
    BTW the idea behind screen drawing is to draw the rectangles etc on one
    screen, the mouse pointer/buttons/lines ("decoration") on another, so
    that the costly rectangles drawing doesn't need to happen as often e.g.
    in button mode. It isn't "double buffered" as such, and said flag is
    turned off on the GtkDrawingArea.

 ChangeLog                              |    5 ++++
 Src/DasherCore/DasherInterfaceBase.cpp |    7 +++++-
 Src/Gtk2/Canvas.cpp                    |   35 +++++++++++--------------------
 Src/Gtk2/Canvas.h                      |   10 ++++----
 Src/Gtk2/DasherControl.cpp             |    5 +++-
 5 files changed, 33 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3376070..e1d87f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-22  Patrick Welche <prlw1 cam ac uk>
+
+	* Comment out unused screens to hopefully make bug #607775 more
+	  obvious.
+
 2009-01-13  Patrick Welche <prlw1 cam ac uk>
 
 	* Rename gconf-2.m4 and intltool.m4 to make it obvious that
diff --git a/Src/DasherCore/DasherInterfaceBase.cpp b/Src/DasherCore/DasherInterfaceBase.cpp
index 0fa78fc..dbd7881 100644
--- a/Src/DasherCore/DasherInterfaceBase.cpp
+++ b/Src/DasherCore/DasherInterfaceBase.cpp
@@ -493,7 +493,12 @@ void CDasherInterfaceBase::NewFrame(unsigned long iTime, bool bForceRedraw) {
   // Prevent NewFrame from being reentered. This can happen occasionally and
   // cause crashes.
   static bool bReentered=false;
-  if(bReentered) return;
+  if (bReentered) {
+#ifdef DEBUG
+    std::cout << "CDasherInterfaceBase::NewFrame was re-entered" << std::endl;
+#endif
+    return;
+  }
   bReentered=true;
 
   // Fail if Dasher is locked
diff --git a/Src/Gtk2/Canvas.cpp b/Src/Gtk2/Canvas.cpp
index 493feb0..61ac7ea 100644
--- a/Src/Gtk2/Canvas.cpp
+++ b/Src/Gtk2/Canvas.cpp
@@ -29,15 +29,15 @@ CCanvas::CCanvas(GtkWidget *pCanvas, CPangoCache *pPangoCache)
 
   m_pDisplaySurface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, m_iWidth, m_iHeight);
   m_pDecorationSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, m_iWidth, m_iHeight);
-  m_pOnscreenSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, m_iWidth, m_iHeight);
+  //m_pOnscreenSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, m_iWidth, m_iHeight);
 
 #else
 
-  m_pDummyBuffer = gdk_pixmap_new(pCanvas->window, m_iWidth, m_iHeight, -1);
+  //m_pDummyBuffer = gdk_pixmap_new(pCanvas->window, m_iWidth, m_iHeight, -1);
 
   m_pDisplayBuffer = gdk_pixmap_new(pCanvas->window, m_iWidth, m_iHeight, -1);
   m_pDecorationBuffer = gdk_pixmap_new(pCanvas->window, m_iWidth, m_iHeight, -1);
-  m_pOnscreenBuffer = gdk_pixmap_new(pCanvas->window, m_iWidth, m_iHeight, -1);
+  //m_pOnscreenBuffer = gdk_pixmap_new(pCanvas->window, m_iWidth, m_iHeight, -1);
 
   // Set the display buffer to be current
 
@@ -59,10 +59,9 @@ CCanvas::CCanvas(GtkWidget *pCanvas, CPangoCache *pPangoCache)
   cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
   cairo_set_line_width(cr, 1.0);
 
-  onscreen_cr = cairo_create(m_pOnscreenSurface);
-
-  widget_cr = gdk_cairo_create(m_pCanvas->window) ;
+  //onscreen_cr = cairo_create(m_pOnscreenSurface);
 
+  widget_cr = gdk_cairo_create(m_pCanvas->window);
 #endif
 
   m_pPangoInk = new PangoRectangle;
@@ -76,16 +75,16 @@ CCanvas::~CCanvas() {
   cr = NULL;
   cairo_surface_destroy(m_pDisplaySurface);
   cairo_surface_destroy(m_pDecorationSurface);
-  cairo_surface_destroy(m_pOnscreenSurface);  
+  //cairo_surface_destroy(m_pOnscreenSurface);  
   cairo_destroy(display_cr);
   cairo_destroy(decoration_cr);
-  cairo_destroy(onscreen_cr);
+  //cairo_destroy(onscreen_cr);
   cairo_destroy(widget_cr);
 #else
-  g_object_unref(m_pDummyBuffer);
+  //g_object_unref(m_pDummyBuffer);
   g_object_unref(m_pDisplayBuffer);
   g_object_unref(m_pDecorationBuffer);
-  g_object_unref(m_pOnscreenBuffer);
+  //g_object_unref(m_pOnscreenBuffer);
 #endif
 
 #if WITH_CAIRO
@@ -122,16 +121,12 @@ void CCanvas::Display() {
   // FIXME - Some of this stuff is probably not needed
   //  GdkRectangle update_rect;
 
-  GdkGC *graphics_context;
 #if WITH_CAIRO
 #else
+  GdkGC *graphics_context;
   GdkColormap *colormap;
-#endif
 
   graphics_context = m_pCanvas->style->fg_gc[GTK_WIDGET_STATE(m_pCanvas)];
-
-#if WITH_CAIRO
-#else
   colormap = gdk_colormap_get_system();
 #endif
 
@@ -182,7 +177,7 @@ void CCanvas::Display() {
 
   //   gdk_window_end_paint(m_pCanvas->window);
 
-  // Restore original graphics context (?)
+  // Restore original graphics context (colours)
 
   END_DRAWING;
 
@@ -302,7 +297,7 @@ void CCanvas::DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour
 
 void CCanvas::Polygon(Dasher::CDasherScreen::point *Points, int Number, int Colour, int iWidth) {
 
-  if(iWidth == 1) // This is to make it work propely on Windows
+  if(iWidth == 1) // This is to make it work properly on Windows
     iWidth = 0; 
 
 #if WITH_CAIRO
@@ -441,18 +436,14 @@ void CCanvas::SendMarker(int iMarker) {
   case 1: // Switch to decorations buffer
 
 #if WITH_CAIRO
-    BEGIN_DRAWING;
     cairo_set_source_surface(decoration_cr, m_pDisplaySurface, 0, 0);
     cairo_rectangle(decoration_cr, 0, 0, m_iWidth, m_iHeight);
     cairo_fill(decoration_cr);
-    END_DRAWING;
+    cr = decoration_cr;
 #else
     gdk_draw_drawable(m_pDecorationBuffer, m_pCanvas->style->fg_gc[GTK_WIDGET_STATE(m_pCanvas)], m_pDisplayBuffer, 0, 0, 0, 0, m_iWidth, m_iHeight);
     m_pOffscreenBuffer = m_pDecorationBuffer;
 #endif
-#if WITH_CAIRO
-    cr = decoration_cr;
-#endif
     break;
   }
 }
diff --git a/Src/Gtk2/Canvas.h b/Src/Gtk2/Canvas.h
index 1a7e000..ffe3896 100644
--- a/Src/Gtk2/Canvas.h
+++ b/Src/Gtk2/Canvas.h
@@ -253,7 +253,7 @@ private:
 
   cairo_surface_t *m_pDisplaySurface;
   cairo_surface_t *m_pDecorationSurface;
-  cairo_surface_t *m_pOnscreenSurface;
+  //cairo_surface_t *m_pOnscreenSurface;
 
   cairo_surface_t *m_pOffscreenbuffer;
 
@@ -277,14 +277,14 @@ private:
   /// The onscreen buffer - copied onscreen whenever an expose event occurs.
   ///
 
-  GdkPixmap *m_pOnscreenBuffer;
+  //GdkPixmap *m_pOnscreenBuffer;
 
   ///
   /// Pointer to which of the offscreen buffers is currently active.
   ///
 
   GdkPixmap *m_pOffscreenBuffer;
-  GdkPixmap *m_pDummyBuffer;
+  //GdkPixmap *m_pDummyBuffer;
 
 #endif
 
@@ -304,11 +304,11 @@ private:
 #if WITH_CAIRO
   cairo_t *display_cr;
   cairo_t *decoration_cr;
-  cairo_t *onscreen_cr; // TODO: do we need to do our own double buffering?
+  //cairo_t *onscreen_cr; // TODO: do we need to do our own double buffering?
 
   cairo_t *widget_cr;
 
-  cairo_t *cr;
+  cairo_t *cr; // offscreen
   my_cairo_colour_t *cairo_colours;
 #else
   GdkColor *colours;
diff --git a/Src/Gtk2/DasherControl.cpp b/Src/Gtk2/DasherControl.cpp
index 59dc26c..2c3cf66 100644
--- a/Src/Gtk2/DasherControl.cpp
+++ b/Src/Gtk2/DasherControl.cpp
@@ -69,7 +69,7 @@ void CDasherControl::CreateModules() {
 void CDasherControl::SetupUI() {
   m_pCanvas = gtk_drawing_area_new();
   GTK_WIDGET_SET_FLAGS(m_pCanvas, GTK_CAN_FOCUS);
-  gtk_widget_set_double_buffered(m_pCanvas, false);
+  GTK_WIDGET_UNSET_FLAGS(m_pCanvas, GTK_DOUBLE_BUFFERED);
 
   GtkWidget *pFrame = gtk_frame_new(NULL);
   gtk_frame_set_shadow_type(GTK_FRAME(pFrame), GTK_SHADOW_IN); 
@@ -252,6 +252,9 @@ GArray *CDasherControl::GetAllowedValues(int iParameter) {
 
 void CDasherControl::RealizeCanvas(GtkWidget *pWidget) {
   // TODO: Pointless function - call directly from C callback.
+#ifdef DEBUG
+  std::cout << "RealizeCanvas()" << std::endl;
+#endif
   OnUIRealised();
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]