[cairo-commit] src/cairo-skia-surface.cpp
Bryce Harrington
bryce at kemper.freedesktop.org
Thu Jul 10 12:08:13 PDT 2014
src/cairo-skia-surface.cpp | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
New commits:
commit e279709bf32f13314b8008e6f640d2fab8cc8a78
Author: Ravi Nanjundappa <nravi.n at samsung.com>
Date: Thu Jul 10 16:14:46 2014 +0530
skia : Add Debug support for skia backend
Enable the DEBUG support for skia backend to provide more
descriptive information on the unexpected operational behaviours.
Signed-off-by: Ravi Nanjundappa <nravi.n at samsung.com>
Reviewed-by: Bryce Harrington <b.harrington at samsung.com>
diff --git a/src/cairo-skia-surface.cpp b/src/cairo-skia-surface.cpp
index 4cf8b7f..0282c2b 100644
--- a/src/cairo-skia-surface.cpp
+++ b/src/cairo-skia-surface.cpp
@@ -85,13 +85,20 @@
# define CAIRO_INT_STATUS_SUCCESS ((cairo_int_status_t) CAIRO_STATUS_SUCCESS)
#endif
-#define CAIRO_MAYBE_UNSUPPORTED CAIRO_INT_STATUS_UNSUPPORTED
-//#define CAIRO_MAYBE_UNSUPPORTED _skia_unsupported ()
+#define DEBUG_SKIA 0
+
+#if DEBUG_SKIA
+#define UNSUPPORTED(reason) ({ \
+ fprintf (stderr, \
+ "cairo-skia : hit unsupported operation in %s(), line %d: %s\n", \
+ __FUNCTION__, __LINE__, reason); \
+ return CAIRO_INT_STATUS_UNSUPPORTED; \
+})
+#else
+#define UNSUPPORTED(reason) ({ \
+ return CAIRO_INT_STATUS_UNSUPPORTED; \
+})#endif
-static cairo_int_status_t _skia_unsupported () {
- printf ("unsupported!\n");
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
typedef struct cairo_skia_surface {
cairo_surface_t base;
@@ -563,8 +570,7 @@ _cairo_skia_surface_create_similar (void *asurface,
if (! format_to_sk_config (_cairo_format_from_content (content),
config, opaque))
{
- _skia_unsupported ();
- return NULL;
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
}
return &_cairo_skia_surface_create_internal (config, opaque,
@@ -802,7 +808,7 @@ _cairo_skia_surface_paint (void *asurface,
shader = pattern_to_sk_shader (surface, source, &image, &image_extra);
if (!bitmap && !shader)
- return CAIRO_MAYBE_UNSUPPORTED;
+ return UNSUPPORTED("pattern to bitmap and shader conversion");
SkPaint paint;
paint.setFilterBitmap (pattern_filter_to_sk (source));
@@ -859,7 +865,7 @@ _cairo_skia_surface_stroke (void *asurface,
SkShader *shader = pattern_to_sk_shader (surface,
source, &image, &image_extra);
if (shader == NULL)
- return CAIRO_MAYBE_UNSUPPORTED;
+ return UNSUPPORTED("pattern to shader conversion");
paint.setShader (shader);
shader->unref ();
@@ -962,7 +968,7 @@ _cairo_skia_surface_fill (void *asurface,
SkShader *shader = pattern_to_sk_shader (surface,
source, &image, &image_extra);
if (shader == NULL)
- return CAIRO_MAYBE_UNSUPPORTED;
+ return UNSUPPORTED("pattern to shader conversion");
paint.setShader (shader);
shader->unref ();
More information about the cairo-commit
mailing list