~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to src/extension/internal/emf-win32-inout.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2011-07-10 11:35:30 UTC
  • mfrom: (1.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110710113530-de50n95mt3dbn4xd
Tags: 0.48.2-0ubuntu1
* New upstream release (LP: #807912).  Fixes several Ubuntu bugs:
  - [SVG Font Editor] Crash when kerning an empty pair (LP: #706506)
  - Connector tool crash Inkscake (orthogonal mode) (LP: #771738)
  - Errors printed to console if openclipart search fails (LP: #638844)
  - pdf export with cairo 1.10 defaults to version PDF-1.5 (LP: #664335)
  - Cairo rendering broken for "use" elements when scaling or a viewBox 
    (LP: #705345)
  - gimp_xcf.py crashed with TypeError in effect() (LP: #565296)
  - Enable build against libwpg-0.2 (LP: #778951)
  - Please add supported filetypes into MimeType line of inkscape.desktop 
    (LP: #278307)
  - Inkscape fails to build with gcc 4.6 (LP: #707205)
* Drop 01-libwpg0.2.dpatch - Applied upstream
* Drop 03-add-missing-mimetypes.dpatch - Applied upstream
* Drop 04-fix-build-with-gcc4.6.dpatch - Applied upstream
* Drop 05-add-missing-includes.dpatch - Applied upstream
* Drop fix-fontforge-glyph-template.dpatch - Applied upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 */
4
4
/* Authors:
5
5
 *   Ulf Erikson <ulferikson@users.sf.net>
 
6
 *   Jon A. Cruz <jon@joncruz.org>
 
7
 *   Abhishek Sharma
6
8
 *
7
9
 * Copyright (C) 2006-2008 Authors
8
10
 *
26
28
#endif
27
29
 
28
30
//#include "inkscape.h"
 
31
#include "sp-root.h"
29
32
#include "sp-path.h"
30
33
#include "style.h"
31
34
//#include "color.h"
32
35
//#include "display/curve.h"
33
36
//#include "libnr/nr-point-matrix-ops.h"
34
 
//#include "gtk/gtk.h"
 
37
//#include <gtk/gtk.h>
35
38
#include "print.h"
36
39
//#include "glibmm/i18n.h"
37
40
//#include "extension/extension.h"
73
76
#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
74
77
#endif
75
78
 
 
79
#define DPA 0x00A000C9    // TernaryRasterOperation
76
80
 
77
81
namespace Inkscape {
78
82
namespace Extension {
79
83
namespace Internal {
80
84
 
 
85
static float device_scale = DEVICESCALE;
 
86
static RECTL rc_old;
 
87
static bool clipset = false;
81
88
 
82
89
EmfWin32::EmfWin32 (void) // The null constructor
83
90
{
201
208
typedef struct emf_callback_data {
202
209
    Glib::ustring *outsvg;
203
210
    Glib::ustring *path;
 
211
    Glib::ustring *outdef;
204
212
 
205
213
    EMF_DEVICE_CONTEXT dc[EMF_MAX_DC+1]; // FIXME: This should be dynamic..
206
214
    int level;
225
233
static void
226
234
output_style(PEMF_CALLBACK_DATA d, int iType)
227
235
{
228
 
    SVGOStringStream tmp_id;
 
236
//    SVGOStringStream tmp_id;
229
237
    SVGOStringStream tmp_style;
230
238
    char tmp[1024] = {0};
231
239
 
235
243
    float stroke_rgb[3];
236
244
    sp_color_get_rgb_floatv(&(d->dc[d->level].style.stroke.value.color), stroke_rgb);
237
245
 
238
 
    tmp_id << "\n\tid=\"" << (d->id++) << "\"";
239
 
    *(d->outsvg) += tmp_id.str().c_str();
 
246
//    tmp_id << "\n\tid=\"" << (d->id++) << "\"";
 
247
//    *(d->outsvg) += tmp_id.str().c_str();
240
248
    *(d->outsvg) += "\n\tstyle=\"";
241
249
    if (iType == EMR_STROKEPATH || !d->dc[d->level].fill_set) {
242
250
        tmp_style << "fill:none;";
307
315
        tmp_style << "stroke-opacity:1;";
308
316
    }
309
317
    tmp_style << "\" ";
 
318
    if (clipset)
 
319
        tmp_style << "\n\tclip-path=\"url(#clipEmfPath" << d->id << ")\" ";
 
320
    clipset = false;
310
321
 
311
322
    *(d->outsvg) += tmp_style.str().c_str();
312
323
}
338
349
    double ppy = _pix_y_to_point(d, py);
339
350
 
340
351
    double x = ppx * d->dc[d->level].worldTransform.eM11 + ppy * d->dc[d->level].worldTransform.eM21 + d->dc[d->level].worldTransform.eDx;
341
 
    x *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : DEVICESCALE;
 
352
    x *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : device_scale;
342
353
    
343
354
    return x;
344
355
}
350
361
    double ppy = _pix_y_to_point(d, py);
351
362
 
352
363
    double y = ppx * d->dc[d->level].worldTransform.eM12 + ppy * d->dc[d->level].worldTransform.eM22 + d->dc[d->level].worldTransform.eDy;
353
 
    y *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : DEVICESCALE;
 
364
    y *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : device_scale;
354
365
    
355
366
    return y;
356
367
}
362
373
    double ppy = 0;
363
374
 
364
375
    double dx = ppx * d->dc[d->level].worldTransform.eM11 + ppy * d->dc[d->level].worldTransform.eM21;
365
 
    dx *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : DEVICESCALE;
 
376
    dx *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : device_scale;
366
377
    double dy = ppx * d->dc[d->level].worldTransform.eM12 + ppy * d->dc[d->level].worldTransform.eM22;
367
 
    dy *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : DEVICESCALE;
 
378
    dy *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : device_scale;
368
379
 
369
380
    double tmp = sqrt(dx * dx + dy * dy);
370
381
    return tmp;
684
695
        g_free(d->dc[d->level].tstyle.font_family.value);
685
696
    d->dc[d->level].tstyle.font_family.value =
686
697
        (gchar *) g_utf16_to_utf8( (gunichar2*) pEmr->elfw.elfLogFont.lfFaceName, -1, NULL, NULL, NULL );
687
 
    d->dc[d->level].style.text_transform.value = ((pEmr->elfw.elfLogFont.lfEscapement + 3600) % 3600) / 10;
 
698
    d->dc[d->level].style.baseline_shift.value = ((pEmr->elfw.elfLogFont.lfEscapement + 3600) % 3600) / 10;     // use baseline_shift instead of text_transform to avoid overflow
688
699
}
689
700
 
690
701
static void
766
777
        {
767
778
            dbg_str << "<!-- EMR_HEADER -->\n";
768
779
 
769
 
            *(d->outsvg) += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
 
780
            *(d->outdef) += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
770
781
 
771
782
            if (d->pDesc) {
772
 
                *(d->outsvg) += "<!-- ";
773
 
                *(d->outsvg) += d->pDesc;
774
 
                *(d->outsvg) += " -->\n";
 
783
                *(d->outdef) += "<!-- ";
 
784
                *(d->outdef) += d->pDesc;
 
785
                *(d->outdef) += " -->\n";
775
786
            }
776
787
 
777
788
            ENHMETAHEADER *pEmr = (ENHMETAHEADER *) lpEMFR;
778
 
            tmp_outsvg << "<svg\n";
779
 
            tmp_outsvg << "  xmlns:svg=\"http://www.w3.org/2000/svg\"\n";
780
 
            tmp_outsvg << "  xmlns=\"http://www.w3.org/2000/svg\"\n";
781
 
            tmp_outsvg << "  version=\"1.0\"\n";
 
789
            SVGOStringStream tmp_outdef;
 
790
            tmp_outdef << "<svg\n";
 
791
            tmp_outdef << "  xmlns:svg=\"http://www.w3.org/2000/svg\"\n";
 
792
            tmp_outdef << "  xmlns=\"http://www.w3.org/2000/svg\"\n";
 
793
            tmp_outdef << "  version=\"1.0\"\n";
782
794
 
783
795
            d->xDPI = 2540;
784
796
            d->yDPI = 2540;
785
797
 
786
 
            d->dc[d->level].PixelsInX = pEmr->rclFrame.right - pEmr->rclFrame.left;
787
 
            d->dc[d->level].PixelsInY = pEmr->rclFrame.bottom - pEmr->rclFrame.top;
 
798
            d->dc[d->level].PixelsInX = pEmr->rclFrame.right;  // - pEmr->rclFrame.left;
 
799
            d->dc[d->level].PixelsInY = pEmr->rclFrame.bottom; // - pEmr->rclFrame.top;
788
800
 
789
801
            d->MMX = d->dc[d->level].PixelsInX / 100.0;
790
802
            d->MMY = d->dc[d->level].PixelsInY / 100.0;
791
803
 
792
804
            d->dc[d->level].PixelsOutX = d->MMX * PX_PER_MM;
793
805
            d->dc[d->level].PixelsOutY = d->MMY * PX_PER_MM;
 
806
 
 
807
            // calculate ratio of Inkscape dpi/device dpi
 
808
            if (pEmr->szlMillimeters.cx && pEmr->szlDevice.cx)
 
809
                device_scale = PX_PER_MM*pEmr->szlMillimeters.cx/pEmr->szlDevice.cx;
794
810
            
795
 
            tmp_outsvg <<
 
811
            tmp_outdef <<
796
812
                "  width=\"" << d->MMX << "mm\"\n" <<
797
 
                "  height=\"" << d->MMY << "mm\"\n";
798
 
            tmp_outsvg <<
799
 
                "  id=\"" << (d->id++) << "\">\n";
 
813
                "  height=\"" << d->MMY << "mm\">\n";
 
814
            *(d->outdef) += tmp_outdef.str().c_str();
 
815
            *(d->outdef) += "<defs>";                           // temporary end of header
800
816
 
801
 
            tmp_outsvg <<
802
 
                "<g\n" <<
803
 
                "  id=\"" << (d->id++) << "\">\n";
 
817
            tmp_outsvg << "\n</defs>\n<g>\n";                   // start of main body
804
818
 
805
819
            if (pEmr->nHandles) {
806
820
                d->n_obj = pEmr->nHandles;
1069
1083
                d->dc[d->level].ScaleOutY = (double) d->dc[d->level].PixelsOutY / (double) d->dc[d->level].sizeView.cy;
1070
1084
            }
1071
1085
            else {
1072
 
                d->dc[d->level].ScaleOutX = DEVICESCALE;
1073
 
                d->dc[d->level].ScaleOutY = DEVICESCALE;
 
1086
                d->dc[d->level].ScaleOutX = device_scale;
 
1087
                d->dc[d->level].ScaleOutY = device_scale;
1074
1088
            }
1075
1089
 
1076
1090
            break;
1120
1134
                d->dc[d->level].ScaleOutY = (double) d->dc[d->level].PixelsOutY / (double) d->dc[d->level].sizeView.cy;
1121
1135
            }
1122
1136
            else {
1123
 
                d->dc[d->level].ScaleOutX = DEVICESCALE;
1124
 
                d->dc[d->level].ScaleOutY = DEVICESCALE;
 
1137
                d->dc[d->level].ScaleOutX = device_scale;
 
1138
                d->dc[d->level].ScaleOutY = device_scale;
1125
1139
            }
1126
1140
 
1127
1141
            break;
1144
1158
            assert_empty_path(d, "EMR_EOF");
1145
1159
            tmp_outsvg << "</g>\n";
1146
1160
            tmp_outsvg << "</svg>\n";
 
1161
            *(d->outsvg) = *(d->outdef) + *(d->outsvg);
1147
1162
            break;
1148
1163
        }
1149
1164
        case EMR_SETPIXELV:
1226
1241
            dbg_str << "<!-- EMR_EXCLUDECLIPRECT -->\n";
1227
1242
            break;
1228
1243
        case EMR_INTERSECTCLIPRECT:
 
1244
        {
1229
1245
            dbg_str << "<!-- EMR_INTERSECTCLIPRECT -->\n";
 
1246
 
 
1247
            PEMRINTERSECTCLIPRECT pEmr = (PEMRINTERSECTCLIPRECT) lpEMFR;
 
1248
            RECTL rc = pEmr->rclClip;
 
1249
            clipset = true;
 
1250
            if ((rc.left == rc_old.left) && (rc.top == rc_old.top) && (rc.right == rc_old.right) && (rc.bottom == rc_old.bottom))
 
1251
                break;
 
1252
            rc_old = rc;
 
1253
 
 
1254
            double l = pix_to_x_point( d, rc.left, rc.top );
 
1255
            double t = pix_to_y_point( d, rc.left, rc.top );
 
1256
            double r = pix_to_x_point( d, rc.right, rc.bottom );
 
1257
            double b = pix_to_y_point( d, rc.right, rc.bottom );
 
1258
 
 
1259
            SVGOStringStream tmp_rectangle;
 
1260
            tmp_rectangle << "\n<clipPath\n\tclipPathUnits=\"userSpaceOnUse\" ";
 
1261
            tmp_rectangle << "\n\tid=\"clipEmfPath" << ++(d->id) << "\" >";
 
1262
            tmp_rectangle << "\n<rect ";
 
1263
            tmp_rectangle << "\n\tx=\"" << l << "\" ";
 
1264
            tmp_rectangle << "\n\ty=\"" << t << "\" ";
 
1265
            tmp_rectangle << "\n\twidth=\"" << r-l << "\" ";
 
1266
            tmp_rectangle << "\n\theight=\"" << b-t << "\" />";
 
1267
            tmp_rectangle << "\n</clipPath>";
 
1268
 
 
1269
            assert_empty_path(d, "EMR_RECTANGLE");
 
1270
 
 
1271
            *(d->outdef) += tmp_rectangle.str().c_str();
 
1272
            *(d->path) = "";
1230
1273
            break;
 
1274
        }
1231
1275
        case EMR_SCALEVIEWPORTEXTEX:
1232
1276
            dbg_str << "<!-- EMR_SCALEVIEWPORTEXTEX -->\n";
1233
1277
            break;
1556
1600
            break;
1557
1601
        }
1558
1602
        case EMR_ROUNDRECT:
 
1603
        {
1559
1604
            dbg_str << "<!-- EMR_ROUNDRECT -->\n";
 
1605
 
 
1606
            PEMRROUNDRECT pEmr = (PEMRROUNDRECT) lpEMFR;
 
1607
            RECTL rc = pEmr->rclBox;
 
1608
            SIZEL corner = pEmr->szlCorner;
 
1609
            double f = 4.*(sqrt(2) - 1)/3;
 
1610
 
 
1611
            double l = pix_to_x_point(d, rc.left, rc.top);
 
1612
            double t = pix_to_y_point(d, rc.left, rc.top);
 
1613
            double r = pix_to_x_point(d, rc.right, rc.bottom);
 
1614
            double b = pix_to_y_point(d, rc.right, rc.bottom);
 
1615
            double cnx = pix_to_size_point(d, corner.cx/2);
 
1616
            double cny = pix_to_size_point(d, corner.cy/2);
 
1617
 
 
1618
            SVGOStringStream tmp_rectangle;
 
1619
            tmp_rectangle << "d=\"";
 
1620
            tmp_rectangle << "\n\tM " << l << ", " << t + cny << " ";
 
1621
            tmp_rectangle << "\n\tC " << l << ", " << t + (1-f)*cny << " " << l + (1-f)*cnx << ", " << t << " " << l + cnx << ", " << t << " ";
 
1622
            tmp_rectangle << "\n\tL " << r - cnx << ", " << t << " ";
 
1623
            tmp_rectangle << "\n\tC " << r - (1-f)*cnx << ", " << t << " " << r << ", " << t + (1-f)*cny << " " << r << ", " << t + cny << " ";
 
1624
            tmp_rectangle << "\n\tL " << r << ", " << b - cny << " ";
 
1625
            tmp_rectangle << "\n\tC " << r << ", " << b - (1-f)*cny << " " << r - (1-f)*cnx << ", " << b << " " << r - cnx << ", " << b << " ";
 
1626
            tmp_rectangle << "\n\tL " << l + cnx << ", " << b << " ";
 
1627
            tmp_rectangle << "\n\tC " << l + (1-f)*cnx << ", " << b << " " << l << ", " << b - (1-f)*cny << " " << l << ", " << b - cny << " ";
 
1628
            tmp_rectangle << "\n\tz";
 
1629
            assert_empty_path(d, "EMR_ROUNDRECT");
 
1630
 
 
1631
            *(d->outsvg) += "    <path ";
 
1632
            output_style(d, lpEMFR->iType);
 
1633
            *(d->outsvg) += "\n\t";
 
1634
            *(d->outsvg) += tmp_rectangle.str().c_str();
 
1635
            *(d->outsvg) += " \" /> \n";
 
1636
            *(d->path) = "";
1560
1637
            break;
 
1638
        }
1561
1639
        case EMR_ARC:
1562
1640
            dbg_str << "<!-- EMR_ARC -->\n";
1563
1641
            break;
1720
1798
            dbg_str << "<!-- EMR_EXTSELECTCLIPRGN -->\n";
1721
1799
            break;
1722
1800
        case EMR_BITBLT:
 
1801
        {
1723
1802
            dbg_str << "<!-- EMR_BITBLT -->\n";
 
1803
 
 
1804
            PEMRBITBLT pEmr = (PEMRBITBLT) lpEMFR;
 
1805
            if (pEmr->dwRop == DPA) {
 
1806
                // should be an application of a DIBPATTERNBRUSHPT, use a solid color instead
 
1807
                double l = pix_to_x_point( d, pEmr->xDest, pEmr->yDest);
 
1808
                double t = pix_to_y_point( d, pEmr->xDest, pEmr->yDest);
 
1809
                double r = pix_to_x_point( d, pEmr->xDest + pEmr->cxDest, pEmr->yDest + pEmr->cyDest);
 
1810
                double b = pix_to_y_point( d, pEmr->xDest + pEmr->cxDest, pEmr->yDest + pEmr->cyDest);
 
1811
 
 
1812
                SVGOStringStream tmp_rectangle;
 
1813
                tmp_rectangle << "d=\"";
 
1814
                tmp_rectangle << "\n\tM " << l << " " << t << " ";
 
1815
                tmp_rectangle << "\n\tL " << r << " " << t << " ";
 
1816
                tmp_rectangle << "\n\tL " << r << " " << b << " ";
 
1817
                tmp_rectangle << "\n\tL " << l << " " << b << " ";
 
1818
                tmp_rectangle << "\n\tz";
 
1819
 
 
1820
                assert_empty_path(d, "EMR_BITBLT");
 
1821
 
 
1822
                *(d->outsvg) += "    <path ";
 
1823
                output_style(d, lpEMFR->iType);
 
1824
                *(d->outsvg) += "\n\t";
 
1825
                *(d->outsvg) += tmp_rectangle.str().c_str();
 
1826
                *(d->outsvg) += " \" /> \n";
 
1827
                *(d->path) = "";
 
1828
            }
1724
1829
            break;
 
1830
        }
1725
1831
        case EMR_STRETCHBLT:
1726
1832
            dbg_str << "<!-- EMR_STRETCHBLT -->\n";
1727
1833
            break;
1770
1876
            }
1771
1877
 
1772
1878
            if (!(d->dc[d->level].textAlign & TA_BOTTOM))
1773
 
                y1 += fabs(d->dc[d->level].style.font_size.computed);
1774
 
            
 
1879
                if (d->dc[d->level].style.baseline_shift.value) {
 
1880
                    x1 += std::sin(d->dc[d->level].style.baseline_shift.value*M_PI/180.0)*fabs(d->dc[d->level].style.font_size.computed);
 
1881
                    y1 += std::cos(d->dc[d->level].style.baseline_shift.value*M_PI/180.0)*fabs(d->dc[d->level].style.font_size.computed);
 
1882
                }
 
1883
                else
 
1884
                    y1 += fabs(d->dc[d->level].style.font_size.computed);
 
1885
 
1775
1886
            double x = pix_to_x_point(d, x1, y1);
1776
1887
            double y = pix_to_y_point(d, x1, y1);
1777
1888
 
1781
1892
                (gchar *) g_utf16_to_utf8( (gunichar2 *) wide_text, pEmr->emrtext.nChars, NULL, NULL, NULL );
1782
1893
 
1783
1894
            if (ansi_text) {
1784
 
                gchar *p = ansi_text;
1785
 
                while (*p) {
1786
 
                    if (*p < 32 || *p >= 127) {
1787
 
                        g_free(ansi_text);
1788
 
                        ansi_text = g_strdup("");
1789
 
                        break;
1790
 
                    }
1791
 
                    p++;
1792
 
                }
 
1895
//                gchar *p = ansi_text;
 
1896
//                while (*p) {
 
1897
//                    if (*p < 32 || *p >= 127) {
 
1898
//                        g_free(ansi_text);
 
1899
//                        ansi_text = g_strdup("");
 
1900
//                        break;
 
1901
//                    }
 
1902
//                    p++;
 
1903
//                }
1793
1904
 
1794
1905
                SVGOStringStream ts;
1795
1906
 
1796
1907
                gchar *escaped_text = g_markup_escape_text(ansi_text, -1);
1797
1908
 
1798
 
                float text_rgb[3];
1799
 
                sp_color_get_rgb_floatv( &(d->dc[d->level].style.fill.value.color), text_rgb );
 
1909
//                float text_rgb[3];
 
1910
//                sp_color_get_rgb_floatv( &(d->dc[d->level].style.fill.value.color), text_rgb );
1800
1911
 
1801
 
                if (!d->dc[d->level].textColorSet) {
1802
 
                    d->dc[d->level].textColor = RGB(SP_COLOR_F_TO_U(text_rgb[0]),
1803
 
                                       SP_COLOR_F_TO_U(text_rgb[1]),
1804
 
                                       SP_COLOR_F_TO_U(text_rgb[2]));
1805
 
                }
 
1912
//                if (!d->dc[d->level].textColorSet) {
 
1913
//                    d->dc[d->level].textColor = RGB(SP_COLOR_F_TO_U(text_rgb[0]),
 
1914
//                                       SP_COLOR_F_TO_U(text_rgb[1]),
 
1915
//                                       SP_COLOR_F_TO_U(text_rgb[2]));
 
1916
//                }
1806
1917
 
1807
1918
                char tmp[128];
1808
1919
                snprintf(tmp, 127,
1820
1931
                assert_empty_path(d, "EMR_EXTTEXTOUTW");
1821
1932
 
1822
1933
                ts << "    <text\n";
1823
 
                ts << "        id=\"" << (d->id++) << "\"\n";
 
1934
//                ts << "        id=\"" << (d->id++) << "\"\n";
1824
1935
                ts << "        xml:space=\"preserve\"\n";
1825
1936
                ts << "        x=\"" << x << "\"\n";
1826
1937
                ts << "        y=\"" << y << "\"\n";
1827
 
                if (d->dc[d->level].style.text_transform.value) {
 
1938
                if (d->dc[d->level].style.baseline_shift.value) {
1828
1939
                    ts << "        transform=\""
1829
 
                       << "rotate(-" << d->dc[d->level].style.text_transform.value
 
1940
                       << "rotate(-" << d->dc[d->level].style.baseline_shift.value
1830
1941
                       << " " << x << " " << y << ")"
1831
1942
                       << "\"\n";
1832
1943
                }
2073
2184
            dbg_str << "<!-- EMR_CREATEMONOBRUSH -->\n";
2074
2185
            break;
2075
2186
        case EMR_CREATEDIBPATTERNBRUSHPT:
 
2187
        {
2076
2188
            dbg_str << "<!-- EMR_CREATEDIBPATTERNBRUSHPT -->\n";
 
2189
 
 
2190
            PEMRCREATEDIBPATTERNBRUSHPT pEmr = (PEMRCREATEDIBPATTERNBRUSHPT) lpEMFR;
 
2191
            int index = pEmr->ihBrush;
 
2192
 
 
2193
            EMRCREATEDIBPATTERNBRUSHPT *pBrush =
 
2194
                (EMRCREATEDIBPATTERNBRUSHPT *) malloc( sizeof(EMRCREATEDIBPATTERNBRUSHPT) );
 
2195
            insert_object(d, index, EMR_CREATEDIBPATTERNBRUSHPT, (ENHMETARECORD *) pBrush);
2077
2196
            break;
 
2197
        }
2078
2198
        case EMR_EXTCREATEPEN:
2079
2199
        {
2080
2200
            dbg_str << "<!-- EMR_EXTCREATEPEN -->\n";
2189
2309
 
2190
2310
    d.outsvg = new Glib::ustring("");
2191
2311
    d.path = new Glib::ustring("");
 
2312
    d.outdef = new Glib::ustring("");
2192
2313
 
2193
2314
    CHAR *ansi_uri = (CHAR *) local_fn;
2194
2315
    gunichar2 *unicode_fn = g_utf8_to_utf16( local_fn, -1, NULL, NULL, NULL );
2330
2451
            delete d.outsvg;
2331
2452
        if (d.path)
2332
2453
            delete d.path;
 
2454
        if (d.outdef)
 
2455
            delete d.outdef;
2333
2456
        if (local_fn)
2334
2457
            g_free(local_fn);
2335
2458
        if (unicode_fn)
2353
2476
                d.pDesc[lstrlen(d.pDesc)] = '#';
2354
2477
        }
2355
2478
 
2356
 
        EnumEnhMetaFile(NULL, hemf, myEnhMetaFileProc, (LPVOID) &d, NULL);
 
2479
        // This ugly reinterpret_cast is to prevent old versions of gcc from whining about a mismatch in the const-ness of the arguments
 
2480
        EnumEnhMetaFile(NULL, hemf, reinterpret_cast<ENHMFENUMPROC>(myEnhMetaFileProc), (LPVOID) &d, NULL);
2357
2481
        DeleteEnhMetaFile(hemf);
2358
2482
    }
2359
2483
    else {
2370
2494
 
2371
2495
    delete d.outsvg;
2372
2496
    delete d.path;
 
2497
    delete d.outdef;
2373
2498
 
2374
2499
    if (d.emf_obj) {
2375
2500
        int i;
2453
2578
  fill-column:99
2454
2579
  End:
2455
2580
*/
2456
 
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
 
2581
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :