diff options
| author | Ted Gould <ted@gould.cx> | 2008-10-31 15:06:16 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-10-31 15:06:16 +0000 |
| commit | 7e67d66e7817a9321c4e94b2184a9226b20b396a (patch) | |
| tree | a857d7aae5f544c4243a331e4eb4e4629bbc27a9 /src/extension | |
| parent | Merge from trunk (diff) | |
| download | inkscape-7e67d66e7817a9321c4e94b2184a9226b20b396a.tar.gz inkscape-7e67d66e7817a9321c4e94b2184a9226b20b396a.zip | |
Merge from trunk
(bzr r6887)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/internal/Makefile_insert | 9 | ||||
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 14 | ||||
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 62 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-inout.cpp | 19 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-inout.h | 16 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-print.cpp | 7 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-print.h | 19 | ||||
| -rw-r--r-- | src/extension/internal/win32.cpp | 25 | ||||
| -rw-r--r-- | src/extension/internal/win32.h | 103 |
9 files changed, 156 insertions, 118 deletions
diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert index 0bab68456..1de46034e 100644 --- a/src/extension/internal/Makefile_insert +++ b/src/extension/internal/Makefile_insert @@ -140,9 +140,14 @@ extension_internal_libinternal_a_SOURCES = \ extension/internal/latex-pstricks-out.h \ $(extension_internal_libwpg) \ $(extension_internal_image_magick_sources) \ - \ extension/internal/filter/filter-all.cpp \ extension/internal/filter/filter-file.cpp \ extension/internal/filter/filter.cpp \ - extension/internal/filter/filter.h + extension/internal/filter/filter.h \ + extension/internal/win32.h \ + extension/internal/win32.cpp \ + extension/internal/emf-win32-print.h \ + extension/internal/emf-win32-print.cpp \ + extension/internal/emf-win32-inout.h \ + extension/internal/emf-win32-inout.cpp diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 6bbaa5c06..656cd4a08 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1305,7 +1305,11 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con return true; } - if (style->fill.isNone() && style->stroke.isNone()) + bool no_fill = style->fill.isNone() || style->fill_opacity.value == 0; + bool no_stroke = style->stroke.isNone() || style->stroke_width.computed < 1e-9 || + style->fill_opacity.value == 0; + + if (no_fill && no_stroke) return true; bool need_layer = ( !_state->merge_opacity && !_state->need_layer && @@ -1316,7 +1320,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con else pushLayer(); - if (!style->fill.isNone()) { + if (!no_fill) { _setFillStyle(style, pbox); setPathVector(pathv); @@ -1326,15 +1330,15 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); } - if (style->stroke.isNone()) + if (no_stroke) cairo_fill(_cr); else cairo_fill_preserve(_cr); } - if (!style->stroke.isNone()) { + if (!no_stroke) { _setStrokeStyle(style, pbox); - if (style->fill.isNone()) + if (no_fill) setPathVector(pathv); cairo_stroke(_cr); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 86e04fb54..af9c3cd6e 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -155,7 +155,6 @@ static void sp_image_render(SPItem *item, CairoRenderContext *ctx); static void sp_symbol_render(SPItem *item, CairoRenderContext *ctx); static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx); -/* TODO FIXME: this does not render painting-marker-01-f.svg of SVG1.1 Test suite correctly. (orientation of one of the markers middle left ) */ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) { NRRect pbox; @@ -164,7 +163,6 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) if (!shape->curve) return; - /* fixme: Think (Lauris) */ sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE); SPStyle* style = SP_OBJECT_STYLE (item); @@ -187,16 +185,22 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(path_it->front().pointAt(0)); } + bool render = true; if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + if (style->stroke_width.computed > 1e-9) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } else { + render = false; // stroke width zero and marker is thus scaled down to zero, skip + } } - tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr; - - Geom::Matrix old_tr = marker_item->transform; - marker_item->transform = tr; - renderer->renderItem (ctx, marker_item); - marker_item->transform = old_tr; + if (render) { + tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr; + Geom::Matrix old_tr = marker_item->transform; + marker_item->transform = tr; + renderer->renderItem (ctx, marker_item); + marker_item->transform = old_tr; + } } if ( shape->marker[SP_MARKER_LOC_MID] && (path_it->size_default() > 1) ) { @@ -218,16 +222,22 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(curve_it1->pointAt(1)); } + bool render = true; if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + if (style->stroke_width.computed > 1e-9) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } else { + render = false; // stroke width zero and marker is thus scaled down to zero, skip + } } - tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr; - - Geom::Matrix old_tr = marker_item->transform; - marker_item->transform = tr; - renderer->renderItem (ctx, marker_item); - marker_item->transform = old_tr; + if (render) { + tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr; + Geom::Matrix old_tr = marker_item->transform; + marker_item->transform = tr; + renderer->renderItem (ctx, marker_item); + marker_item->transform = old_tr; + } ++curve_it1; ++curve_it2; @@ -253,16 +263,22 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1)); } + bool render = true; if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + if (style->stroke_width.computed > 1e-9) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } else { + render = false; // stroke width zero and marker is thus scaled down to zero, skip + } } - tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr; - - Geom::Matrix old_tr = marker_item->transform; - marker_item->transform = tr; - renderer->renderItem (ctx, marker_item); - marker_item->transform = old_tr; + if (render) { + tr = (Geom::Matrix)marker_item->transform * (Geom::Matrix)marker->c2p * tr; + Geom::Matrix old_tr = marker_item->transform; + marker_item->transform = tr; + renderer->renderItem (ctx, marker_item); + marker_item->transform = old_tr; + } } } } diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index 8dd793f92..bc7a3ac78 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -1,15 +1,13 @@ -/** \file - * Enhanced Metafile Input and Output. +/** @file + * @brief Windows-only Enhanced Metafile input and output. */ -/* - * Authors: +/* Authors: * Ulf Erikson <ulferikson@users.sf.net> * * Copyright (C) 2006-2008 Authors * * Released under GNU GPL, read the file 'COPYING' for more information - */ -/* + * * References: * - How to Create & Play Enhanced Metafiles in Win32 * http://support.microsoft.com/kb/q145999/ @@ -2447,17 +2445,14 @@ EmfWin32::init (void) } } } /* namespace Inkscape, Extension, Implementation */ - #endif /* WIN32 */ - - /* Local Variables: - mode:cpp + mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/emf-win32-inout.h b/src/extension/internal/emf-win32-inout.h index 01aa91bdc..49c1826e4 100644 --- a/src/extension/internal/emf-win32-inout.h +++ b/src/extension/internal/emf-win32-inout.h @@ -1,17 +1,15 @@ -/* - * Enhanced Metafile Input/Output. - * - * Authors: +/** @file + * @brief Enhanced Metafile Input/Output + */ +/* Authors: * Ulf Erikson <ulferikson@users.sf.net> * * Copyright (C) 2006-2008 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ - -#ifndef EXTENSION_INTERNAL_EMF_WIN32_H -#define EXTENSION_INTERNAL_EMF_WIN32_H - +#ifndef SEEN_EXTENSION_INTERNAL_EMF_WIN32_H +#define SEEN_EXTENSION_INTERNAL_EMF_WIN32_H #ifdef WIN32 #include "extension/implementation/implementation.h" @@ -56,4 +54,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index d5bdcb6d3..8c92fc320 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -1,8 +1,7 @@ -/** \file - * Enhanced Metafile Printing. +/** @file + * @brief Enhanced Metafile printing */ -/* - * Authors: +/* Authors: * Ulf Erikson <ulferikson@users.sf.net> * * Copyright (C) 2006-2008 Authors diff --git a/src/extension/internal/emf-win32-print.h b/src/extension/internal/emf-win32-print.h index 374aaef45..ab9a1a4cf 100644 --- a/src/extension/internal/emf-win32-print.h +++ b/src/extension/internal/emf-win32-print.h @@ -1,16 +1,15 @@ -#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ -#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ - -/* - * Enhanced Metafile Printing. - * - * Author: +/** @file + * @brief Enhanced Metafile printing - implementation + */ +/* Author: * Ulf Erikson <ulferikson@users.sf.net> * * Copyright (C) 2006-2008 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ +#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ #ifdef WIN32 @@ -100,11 +99,11 @@ protected: /* Local Variables: - mode:cpp + mode:c++ c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/win32.cpp b/src/extension/internal/win32.cpp index ecf66ca1f..0fa70d734 100644 --- a/src/extension/internal/win32.cpp +++ b/src/extension/internal/win32.cpp @@ -1,14 +1,14 @@ -#define __SP_MODULE_WIN32_C__ - -/* - * Windows stuff - * - * Author: +/** @file + * @brief Windows-specific stuff + */ +/* Author: * Lauris Kaplinski <lauris@kaplinski.com> * * This code is in public domain */ +#ifdef WIN32 + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -494,3 +494,16 @@ PrintWin32::init (void) } /* namespace Internal */ } /* namespace Extension */ } /* namespace Inkscape */ + +#endif // ifdef WIN32 + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/win32.h b/src/extension/internal/win32.h index 4fb726fae..9462115c6 100644 --- a/src/extension/internal/win32.h +++ b/src/extension/internal/win32.h @@ -1,10 +1,7 @@ -#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__ -#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__ - -/* - * Windows stuff - * - * Author: +/** @file + * @brief Windows-specific stuff + */ +/* Author: * Lauris Kaplinski <lauris@kaplinski.com> * Ted Gould <ted@gould.cx> * @@ -12,10 +9,12 @@ * Ted: This code is released under the GNU GPL */ -#include <config.h> +#ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__ +#define __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__ +#ifdef WIN32 -#ifndef WIN32 -#error "This file is only usable for Windows" +#ifdef HAVE_CONFIG_H + #include <config.h> #endif #ifdef DATADIR @@ -33,55 +32,65 @@ namespace Internal { /* Initialization */ class PrintWin32 : public Inkscape::Extension::Implementation::Implementation { - /* Document dimensions */ - float _PageWidth; - float _PageHeight; + /* Document dimensions */ + float _PageWidth; + float _PageHeight; - HDC _hDC; + HDC _hDC; - unsigned int _landscape; + unsigned int _landscape; - void main_init (int argc, char **argv, const char *name); - void finish (void); + void main_init (int argc, char **argv, const char *name); + void finish (void); - /* File dialogs */ - char *get_open_filename (unsigned char *dir, unsigned char *filter, unsigned char *title); - char *get_write_filename (unsigned char *dir, unsigned char *filter, unsigned char *title); - char *get_save_filename (unsigned char *dir, unsigned int *spns); + /* File dialogs */ + char *get_open_filename (unsigned char *dir, unsigned char *filter, unsigned char *title); + char *get_write_filename (unsigned char *dir, unsigned char *filter, unsigned char *title); + char *get_save_filename (unsigned char *dir, unsigned int *spns); - VOID CALLBACK timer (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); + VOID CALLBACK timer (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); public: - PrintWin32 (void); - virtual ~PrintWin32 (void); - - /* Tell modules about me */ - static void init (void); - - /* Platform detection */ - static gboolean is_os_wide(); - - /* Print functions */ - virtual unsigned int setup (Inkscape::Extension::Print * module); - //virtual unsigned int set_preview (Inkscape::Extension::Print * module); - - virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); - virtual unsigned int finish (Inkscape::Extension::Print * module); - - /* Rendering methods */ - /* - virtual unsigned int bind (Inkscape::Extension::Print * module, const Geom::Matrix *transform, float opacity); - virtual unsigned int release (Inkscape::Extension::Print * module); - virtual unsigned int comment (Inkscape::Extension::Print * module, const char * comment); - virtual unsigned int image (Inkscape::Extension::Print * module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, - const Geom::Matrix *transform, const SPStyle *style); - */ - + PrintWin32 (void); + virtual ~PrintWin32 (void); + + /* Tell modules about me */ + static void init (void); + + /* Platform detection */ + static gboolean is_os_wide(); + + /* Print functions */ + virtual unsigned int setup (Inkscape::Extension::Print * module); + //virtual unsigned int set_preview (Inkscape::Extension::Print * module); + + virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); + virtual unsigned int finish (Inkscape::Extension::Print * module); + + /* Rendering methods */ + /* + virtual unsigned int bind (Inkscape::Extension::Print * module, const Geom::Matrix *transform, float opacity); + virtual unsigned int release (Inkscape::Extension::Print * module); + virtual unsigned int comment (Inkscape::Extension::Print * module, const char * comment); + virtual unsigned int image (Inkscape::Extension::Print * module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, + const Geom::Matrix *transform, const SPStyle *style); + */ }; } /* namespace Internal */ } /* namespace Extension */ } /* namespace Inkscape */ +#endif // ifdef WIN32 #endif /* __INKSCAPE_EXTENSION_INTERNAL_PRINT_WIN32_H__ */ +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
