gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog backend/Makefile.am backend/ren...


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog backend/Makefile.am backend/ren...
Date: Thu, 18 Oct 2007 11:23:23 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/10/18 11:23:22

Modified files:
        .              : ChangeLog 
        backend        : Makefile.am render_handler_cairo.cpp 
        gui            : gtk_glue_cairo.cpp 
        testsuite      : Makefile.am MovieTester.cpp 

Log message:
                * backend/render_handler_cairo.cpp: Implement getPixel and
                related methods to enable automated renderer testing.
                * backend/Makefile.am: Add CAIRO_LIBS.
                * gui/gtk_glue_cairo.cpp: Let the renderer deal with
                cairo_t destruction.
                * testsuite/Makefile.am: Add CAIRO_CFLAGS so we can include
                render_handler_cairo.h.
                * testsuite/MovieTester.cpp: Enable Cairo renderer testing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4627&r2=1.4628
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/Makefile.am?cvsroot=gnash&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_cairo.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_cairo.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/Makefile.am?cvsroot=gnash&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.53&r2=1.54

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4627
retrieving revision 1.4628
diff -u -b -r1.4627 -r1.4628
--- ChangeLog   18 Oct 2007 09:07:17 -0000      1.4627
+++ ChangeLog   18 Oct 2007 11:23:20 -0000      1.4628
@@ -1,3 +1,14 @@
+2007-10-17 Bastiaan Jacques <address@hidden>
+
+       * backend/render_handler_cairo.cpp: Implement getPixel and
+       related methods to enable automated renderer testing.
+       * backend/Makefile.am: Add CAIRO_LIBS.
+       * gui/gtk_glue_cairo.cpp: Let the renderer deal with
+       cairo_t destruction.
+       * testsuite/Makefile.am: Add CAIRO_CFLAGS so we can include
+       render_handler_cairo.h.
+       * testsuite/MovieTester.cpp: Enable Cairo renderer testing.
+
 2007-10-17 Sandro Santilli <address@hidden>
 
        * server/edit_text_character.{cpp,h}: add initial support for

Index: backend/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/backend/Makefile.am,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- backend/Makefile.am 27 Sep 2007 23:59:50 -0000      1.62
+++ backend/Makefile.am 18 Oct 2007 11:23:22 -0000      1.63
@@ -118,6 +118,7 @@
 # plugins_LTLIBRARIES += libgnashcairo.la
 libgnashcairo_la_SOURCES = render_handler_tri.cpp  render_handler_cairo.cpp
 #libgnashcairo_la_LDFLAGS = -module -avoid-version -no-undefined
+libgnashcairo_la_LIBADD = $(CAIRO_LIBS)
 endif
 endif
 

Index: backend/render_handler_cairo.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_cairo.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- backend/render_handler_cairo.cpp    18 Oct 2007 09:05:40 -0000      1.25
+++ backend/render_handler_cairo.cpp    18 Oct 2007 11:23:22 -0000      1.26
@@ -28,7 +28,6 @@
 // - Implement unimplemented methods.
 // - Would be nice to have a header/implementation separation.
 // - Document workings of Cairo and this renderer.
-// - Implement getPixel and friends.
 // - Test bitmap implementation correctness.
 // - Figure out what extend types should be used and when.
 // - Figure out what the deal with subpixel offsets is.
@@ -849,9 +848,9 @@
     if (context == _cr) {
       return;    
     }
-    if (cairo_get_reference_count(_cr)) {
+
       cairo_destroy(_cr);
-    }
+
     _cr = context;
   }
   
@@ -864,6 +863,77 @@
            gnash_matrix.m_[0][2], gnash_matrix.m_[1][2]);
   }
     
+  bool initTestBuffer(unsigned width, unsigned height)
+  {    
+    cairo_surface_t* test_surface =
+      cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+    
+    if (cairo_surface_status(test_surface) != CAIRO_STATUS_SUCCESS) {
+      return false;
+    }
+    
+    cairo_t* context = cairo_create(test_surface);
+    
+    if (cairo_status(context) != CAIRO_STATUS_NO_MEMORY) {    
+      return false;    
+    }
+    
+    cairo_surface_destroy(test_surface);
+    
+    set_context(context);    
+  
+    return true;
+  }
+  
+  unsigned int getBitsPerPixel() const
+  {
+    cairo_surface_t* surface = cairo_get_target (_cr);
+    
+    cairo_format_t format = cairo_image_surface_get_format (surface);
+    
+    switch(format) {
+      case CAIRO_FORMAT_ARGB32:
+        return 32;
+      case CAIRO_FORMAT_RGB24:
+        // In practice this is 32 with 8 bits unused...
+        return 24;
+      case CAIRO_FORMAT_A8:
+        return 8;
+      case CAIRO_FORMAT_A1:
+        return 1;    
+    }   
+  }
+  
+  bool getPixel(rgba& color_return, int x, int y)
+  {
+    if (x < 0 || y < 0) {
+      return false;
+    }
+
+    cairo_surface_t* surface = cairo_get_target (_cr);
+    
+    assert(cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32);
+    
+    unsigned char* data = cairo_image_surface_get_data (surface);
+    int width = cairo_image_surface_get_width(surface);
+    int height = cairo_image_surface_get_height(surface);
+    int stride = cairo_image_surface_get_stride(surface);
+    
+    if (x >= width || y >= height) {    
+      return false;
+    }
+    
+    unsigned char* ptr = data + x * stride + y * 4;
+    
+    color_return.m_a = ptr[0];
+    color_return.m_r = ptr[1];
+    color_return.m_g = ptr[2];
+    color_return.m_b = ptr[3];
+
+    return true;
+  }
+  
+    
 private:
   /// The cairo context.
   cairo_t* _cr;

Index: gui/gtk_glue_cairo.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk_glue_cairo.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- gui/gtk_glue_cairo.cpp      18 Oct 2007 09:05:40 -0000      1.12
+++ gui/gtk_glue_cairo.cpp      18 Oct 2007 11:23:22 -0000      1.13
@@ -82,19 +82,9 @@
     if (!_drawing_area)  return;
 
     // Create cairo handle for output window
-    if (_cairo_handle) {
-      assert(cairo_get_reference_count(_cairo_handle));
-      cairo_destroy(_cairo_handle);
-    }
     _cairo_handle = gdk_cairo_create(_drawing_area->window);
-    assert(_cairo_handle);
 
     // Create offscreen image for rendering
-    if (_cairo_offscreen) {
-      assert(cairo_get_reference_count(_cairo_offscreen));
-      cairo_destroy(_cairo_offscreen);
-    }
-    
     cairo_surface_t* surface = cairo_image_surface_create(
       CAIRO_FORMAT_RGB24, event->width, event->height);
     _cairo_offscreen = cairo_create(surface);

Index: testsuite/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/Makefile.am,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- testsuite/Makefile.am       27 Sep 2007 23:59:56 -0000      1.42
+++ testsuite/Makefile.am       18 Oct 2007 11:23:22 -0000      1.43
@@ -46,6 +46,7 @@
        -I$(top_srcdir)/server/parser  \
        -I$(top_srcdir)/server/vm  \
        $(BOOST_CFLAGS) \
+       $(CAIRO_CFLAGS) \
        $(NULL)
 
 if ENABLE_MING

Index: testsuite/MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- testsuite/MovieTester.cpp   1 Oct 2007 22:41:59 -0000       1.53
+++ testsuite/MovieTester.cpp   18 Oct 2007 11:23:22 -0000      1.54
@@ -36,6 +36,7 @@
 #include "render.h"
 #include "render_handler.h"
 #include "render_handler_agg.h"
+#include "render_handler_cairo.h"
 
 #include <cstdio>
 #include <string>
@@ -423,6 +424,9 @@
 
 #ifdef RENDERER_CAIRO
        // Initialize Cairo
+       handler.reset(renderer::cairo::create_handler());
+
+        addTestingRenderer(handler, "Cairo");
 #endif
 
 #ifdef RENDERER_OPENGL




reply via email to

[Prev in Thread] Current Thread [Next in Thread]