diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 9a2cab829c9884bcf7ca30a9fe0aeca6c30e7c60..d7fbbc1aa90aac4939567c01612c4ace0a13290b 100644 (file)
#endif
-#ifndef PANGO_ENABLE_BACKEND
+#ifdef CAIRO_HAS_FT_FONT
#include <cairo-ft.h>
#endif
_ps_level(1),
_is_texttopath(FALSE),
_is_filtertobitmap(FALSE),
+ _bitmapresolution(72),
_stream(NULL),
_is_valid(FALSE),
_vector_based_target(FALSE),
_ps_level = level;
}
+unsigned int CairoRenderContext::getPSLevel(void)
+{
+ return _ps_level;
+}
+
void CairoRenderContext::setPDFLevel(unsigned int level)
{
_pdf_level = level;
_is_filtertobitmap = filtertobitmap;
}
+bool CairoRenderContext::getFilterToBitmap(void)
+{
+ return _is_filtertobitmap;
+}
+
+void CairoRenderContext::setBitmapResolution(int resolution)
+{
+ _bitmapresolution = resolution;
+}
+
+int CairoRenderContext::getBitmapResolution(void)
+{
+ return _bitmapresolution;
+}
+
cairo_surface_t*
CairoRenderContext::getSurface(void)
{
#ifdef CAIRO_HAS_PS_SURFACE
case CAIRO_SURFACE_TYPE_PS:
surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height);
-#if (CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 5, 2))
+#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2))
+ if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) {
+ return FALSE;
+ }
cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level);
#endif
break;
bool
CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface)
{
+ if(surface == NULL) {
+ return FALSE;
+ }
+ if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) {
+ return FALSE;
+ }
+
_cr = cairo_create(surface);
_surface = surface;
@@ -1220,7 +1251,7 @@ CairoRenderContext::renderPath(NRBPath const *bpath, SPStyle const *style, NRRec
cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING);
}
cairo_fill(_cr);
- cairo_surface_write_to_png (_surface, "gtar2.png");
+ TEST(cairo_surface_write_to_png (_surface, "pathmask.png"));
}
return true;
}
@@ -1395,7 +1426,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, NRMatrix const *font_matrix
cairo_save(_cr);
-#ifndef PANGO_ENABLE_BACKEND
+#ifdef CAIRO_HAS_FT_FONT
cairo_font_face_t *font_face = cairo_ft_font_face_create_for_pattern(fc_pattern);
cairo_set_font_face(_cr, font_face);
@@ -1414,25 +1445,21 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, NRMatrix const *font_matrix
} else {
cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING);
}
- cairo_set_source_rgba (_cr, 1.0, 1.0, 1.0, 1.0);
- cairo_rectangle (_cr, 0, 0, 30, 40);
- cairo_fill (_cr);
_showGlyphs(_cr, font, glyphtext, FALSE);
- //cairo_fill(_cr);
} else {
// just add the glyph paths to the current context
_showGlyphs(_cr, font, glyphtext, TRUE);
}
} else {
- if (style->fill.type == SP_PAINT_TYPE_COLOR || style->fill.type == SP_PAINT_TYPE_PAINTSERVER) {
+ if (style->fill.isColor() || style->fill.isPaintserver()) {
// set fill style
_setFillStyle(style, NULL);
_showGlyphs(_cr, font, glyphtext, FALSE);
}
- if (style->stroke.type == SP_PAINT_TYPE_COLOR || style->stroke.type == SP_PAINT_TYPE_PAINTSERVER) {
+ if (style->stroke.isColor() || style->stroke.isPaintserver()) {
// set stroke style
_setStrokeStyle(style, NULL);
@@ -1448,6 +1475,8 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, NRMatrix const *font_matrix
#else
(void)size;
(void)fc_pattern;
+
+ cairo_restore(_cr);
#endif
return true;