[cairo-commit] cairo/src cairo-pattern.c,1.57,1.58
Carl Worth
commit at pdx.freedesktop.org
Fri Aug 19 07:39:50 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv7831/src
Modified Files:
cairo-pattern.c
Log Message:
2005-08-19 Carl Worth <cworth at cworth.org>
Fix for bug #3915:
* src/cairo-pattern.c: (_cairo_pattern_nil_for_status): Add new
NULL_POINTER nil pattern.
* src/cairo-pattern.c: (cairo_pattern_create_for_surface): Check
for surface == NULL and return a nil pattern.
* test/nil-surface.c: (draw): Verify that the above fix works.
Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- cairo-pattern.c 19 Aug 2005 06:10:41 -0000 1.57
+++ cairo-pattern.c 19 Aug 2005 14:39:48 -0000 1.58
@@ -59,6 +59,15 @@
CAIRO_EXTEND_DEFAULT }, /* extend */
};
+const cairo_solid_pattern_t cairo_pattern_nil_null_pointer = {
+ { CAIRO_PATTERN_SOLID, /* type */
+ (unsigned int)-1, /* ref_count */
+ CAIRO_STATUS_NULL_POINTER,/* status */
+ { 1., 0., 0., 1., 0., 0., }, /* matrix */
+ CAIRO_FILTER_DEFAULT, /* filter */
+ CAIRO_EXTEND_DEFAULT }, /* extend */
+};
+
const cairo_solid_pattern_t cairo_pattern_nil_file_not_found = {
{ CAIRO_PATTERN_SOLID, /* type */
(unsigned int)-1, /* ref_count */
@@ -81,6 +90,8 @@
_cairo_pattern_nil_for_status (cairo_status_t status)
{
switch (status) {
+ case CAIRO_STATUS_NULL_POINTER:
+ return &cairo_pattern_nil_null_pointer.base;
case CAIRO_STATUS_FILE_NOT_FOUND:
return &cairo_pattern_nil_file_not_found.base;
case CAIRO_STATUS_READ_ERROR:
@@ -394,6 +405,9 @@
{
cairo_surface_pattern_t *pattern;
+ if (surface == NULL)
+ return (cairo_pattern_t*) _cairo_pattern_nil_for_status (CAIRO_STATUS_NULL_POINTER);
+
if (surface->status)
return (cairo_pattern_t*) _cairo_pattern_nil_for_status (surface->status);
More information about the cairo-commit
mailing list