r22136 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Tue Aug 15 04:35:46 UTC 2017
Author: jghali
Date: Tue Aug 15 04:35:46 2017
New Revision: 22136
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22136
Log:
cleanup ScPainter based on the fact we now require cairo 1.14.x
Modified:
trunk/Scribus/scribus/scpainter.cpp
Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22136&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp (original)
+++ trunk/Scribus/scribus/scpainter.cpp Tue Aug 15 04:35:46 2017
@@ -725,12 +725,9 @@
cairo_pattern_t *pat = NULL;
cairo_surface_t *img = NULL;
cairo_t *cr = NULL;
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2))
cairo_pattern_t *mpat = NULL;
-#endif
if (fill_gradient.type() == VGradient::fourcolor)
{
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2))
double p1x = gradPatchP1.x();
double p1y = gradPatchP1.y();
double p2x = gradPatchP2.x();
@@ -746,7 +743,6 @@
cairo_set_tolerance(cr, 0.5 );
double r, g, b, a;
mpat = cairo_pattern_create_mesh();
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_begin_patch(mpat);
cairo_mesh_pattern_move_to(mpat, p1x, p1y);
cairo_mesh_pattern_line_to(mpat, p2x, p2y);
@@ -766,65 +762,15 @@
gradPatchColor4.getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 3, r, g, b, a);
cairo_mesh_pattern_end_patch(mpat);
-#else
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, p1x, p1y);
- cairo_pattern_mesh_line_to(mpat, p2x, p2y);
- cairo_pattern_mesh_line_to(mpat, p3x, p3y);
- cairo_pattern_mesh_line_to(mpat, p4x, p4y);
- cairo_pattern_mesh_line_to(mpat, p1x, p1y);
- cairo_pattern_mesh_set_control_point(mpat, 0, gradControlP1.x(), gradControlP1.y());
- cairo_pattern_mesh_set_control_point(mpat, 1, gradControlP2.x(), gradControlP2.y());
- cairo_pattern_mesh_set_control_point(mpat, 2, gradControlP3.x(), gradControlP3.y());
- cairo_pattern_mesh_set_control_point(mpat, 3, gradControlP4.x(), gradControlP4.y());
- gradPatchColor1.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- gradPatchColor2.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- gradPatchColor3.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- gradPatchColor4.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
-#endif
cairo_pattern_set_filter(mpat, CAIRO_FILTER_GOOD);
cairo_set_source(cr, mpat);
cairo_paint_with_alpha(cr, 1.0);
pat = cairo_pattern_create_for_surface(img);
cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
-#else
- double r, g, b, a;
- double acr = 0.0;
- double acg = 0.0;
- double acb = 0.0;
- double aca = 0.0;
- gradPatchColor1.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- gradPatchColor2.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- gradPatchColor3.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- gradPatchColor4.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- pat = cairo_pattern_create_rgba(acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
-#endif
}
else if (fill_gradient.type() == VGradient::diamond)
{
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2))
double p1x = gradControlP1.x();
double p1y = gradControlP1.y();
double p2x = gradControlP2.x();
@@ -901,22 +847,11 @@
e4s.setLength(edge4.length() * qStopRampPoints[ offset - 1 ]);
if (offset == 1)
{
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_begin_patch(mpat);
cairo_mesh_pattern_move_to(mpat, centerP.x(), centerP.y());
cairo_mesh_pattern_line_to(mpat, e1.x2(), e1.y2());
cairo_mesh_pattern_line_to(mpat, e2.x2(), e2.y2());
-#else
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
- cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
- cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
-#endif
-#ifdef HAVE_PRIVATE_CAIRO
- cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
qStopColors[0].getRgbF(&r, &g, &b, &a);
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_set_corner_color_rgba(mpat, 0, r, g, b, a);
qStopColors[1].getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 1, r, g, b, a);
@@ -926,22 +861,7 @@
cairo_mesh_pattern_move_to(mpat, centerP.x(), centerP.y());
cairo_mesh_pattern_line_to(mpat, e2.x2(), e2.y2());
cairo_mesh_pattern_line_to(mpat, e3.x2(), e3.y2());
-#else
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
- cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
- cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
-#endif
-#ifdef HAVE_PRIVATE_CAIRO
- cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
qStopColors[0].getRgbF(&r, &g, &b, &a);
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_set_corner_color_rgba(mpat, 0, r, g, b, a);
qStopColors[1].getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 1, r, g, b, a);
@@ -951,22 +871,7 @@
cairo_mesh_pattern_move_to(mpat, centerP.x(), centerP.y());
cairo_mesh_pattern_line_to(mpat, e3.x2(), e3.y2());
cairo_mesh_pattern_line_to(mpat, e4.x2(), e4.y2());
-#else
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
- cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
- cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
-#endif
-#ifdef HAVE_PRIVATE_CAIRO
- cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
qStopColors[0].getRgbF(&r, &g, &b, &a);
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_set_corner_color_rgba(mpat, 0, r, g, b, a);
qStopColors[1].getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 1, r, g, b, a);
@@ -976,38 +881,15 @@
cairo_mesh_pattern_move_to(mpat, centerP.x(), centerP.y());
cairo_mesh_pattern_line_to(mpat, e4.x2(), e4.y2());
cairo_mesh_pattern_line_to(mpat, e1.x2(), e1.y2());
-#else
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
- cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
- cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
-#endif
-#ifdef HAVE_PRIVATE_CAIRO
- cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
qStopColors[0].getRgbF(&r, &g, &b, &a);
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_set_corner_color_rgba(mpat, 0, r, g, b, a);
qStopColors[1].getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 1, r, g, b, a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 2, r, g, b, a);
cairo_mesh_pattern_end_patch(mpat);
-#else
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
-#endif
}
else
{
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_begin_patch(mpat);
cairo_mesh_pattern_move_to(mpat, e1s.x2(), e1s.y2());
cairo_mesh_pattern_line_to(mpat, e1.x2(), e1.y2());
@@ -1060,60 +942,6 @@
qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 3, r, g, b, a);
cairo_mesh_pattern_end_patch(mpat);
-#else
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, e1s.x2(), e1s.y2());
- cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
- cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
- cairo_pattern_mesh_line_to(mpat, e2s.x2(), e2s.y2());
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[offset].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, e2s.x2(), e2s.y2());
- cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
- cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
- cairo_pattern_mesh_line_to(mpat, e3s.x2(), e3s.y2());
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[offset].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, e3s.x2(), e3s.y2());
- cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
- cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
- cairo_pattern_mesh_line_to(mpat, e4s.x2(), e4s.y2());
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[offset].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, e4s.x2(), e4s.y2());
- cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
- cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
- cairo_pattern_mesh_line_to(mpat, e1s.x2(), e1s.y2());
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- qStopColors[offset].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
-#endif
}
}
cairo_pattern_set_filter(mpat, CAIRO_FILTER_GOOD);
@@ -1122,15 +950,9 @@
pat = cairo_pattern_create_for_surface(img);
cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
-#else
- double r, g, b;
- m_fill.getRgbF(&r, &g, &b);
- pat = cairo_pattern_create_rgba(r, g, b, 1.0);
-#endif
}
else if (fill_gradient.type() == VGradient::mesh)
{
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2))
double p3x = gradPatchP3.x();
double p3y = gradPatchP3.y();
img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
@@ -1148,7 +970,6 @@
meshPoint mp2 = meshGradientArray[grow][gcol+1];
meshPoint mp3 = meshGradientArray[grow+1][gcol+1];
meshPoint mp4 = meshGradientArray[grow+1][gcol];
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_begin_patch(mpat);
cairo_mesh_pattern_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
cairo_mesh_pattern_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
@@ -1168,27 +989,6 @@
mp4.color.getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 3, r, g, b, a);
cairo_mesh_pattern_end_patch(mpat);
-#else
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_pattern_mesh_set_control_point(mpat, 0, mp1.controlColor.x(), mp1.controlColor.y());
- cairo_pattern_mesh_set_control_point(mpat, 1, mp2.controlColor.x(), mp2.controlColor.y());
- cairo_pattern_mesh_set_control_point(mpat, 2, mp3.controlColor.x(), mp3.controlColor.y());
- cairo_pattern_mesh_set_control_point(mpat, 3, mp4.controlColor.x(), mp4.controlColor.y());
- mp1.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- mp2.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- mp3.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- mp4.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
-#endif
}
}
cairo_pattern_set_filter(mpat, CAIRO_FILTER_BEST);
@@ -1197,66 +997,9 @@
pat = cairo_pattern_create_for_surface(img);
cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
-#else
- double p3x = gradPatchP3.x();
- double p3y = gradPatchP3.y();
- img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
- cr = cairo_create(img);
- cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_tolerance(cr, 0.5 );
- double r, g, b, a;
- for (int grow = 0; grow < meshGradientArray.count()-1; grow++)
- {
- for (int gcol = 0; gcol < meshGradientArray[grow].count()-1; gcol++)
- {
- meshPoint mp1 = meshGradientArray[grow][gcol];
- meshPoint mp2 = meshGradientArray[grow][gcol+1];
- meshPoint mp3 = meshGradientArray[grow+1][gcol+1];
- meshPoint mp4 = meshGradientArray[grow+1][gcol];
- cairo_new_path( cr );
- cairo_move_to(cr, mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_curve_to(cr, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
- cairo_curve_to(cr, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
- cairo_curve_to(cr, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
- cairo_curve_to(cr, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_close_path( cr );
- double acr = 0.0;
- double acg = 0.0;
- double acb = 0.0;
- double aca = 0.0;
- mp1.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- mp2.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- mp3.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- mp4.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- cairo_set_source_rgba(cr, acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
- cairo_fill(cr);
- }
- }
- pat = cairo_pattern_create_for_surface(img);
- cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
- cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
-#endif
}
else if (fill_gradient.type() == VGradient::freemesh)
{
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2))
double p3x = gradPatchP3.x();
double p3y = gradPatchP3.y();
img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
@@ -1273,7 +1016,6 @@
meshPoint mp2 = patch.TR;
meshPoint mp3 = patch.BR;
meshPoint mp4 = patch.BL;
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
cairo_mesh_pattern_begin_patch(mpat);
cairo_mesh_pattern_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
cairo_mesh_pattern_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
@@ -1293,27 +1035,6 @@
mp4.color.getRgbF(&r, &g, &b, &a);
cairo_mesh_pattern_set_corner_color_rgba(mpat, 3, r, g, b, a);
cairo_mesh_pattern_end_patch(mpat);
-#else
- cairo_pattern_mesh_begin_patch(mpat);
- cairo_pattern_mesh_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
- cairo_pattern_mesh_curve_to(mpat, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_pattern_mesh_set_control_point(mpat, 0, mp1.controlColor.x(), mp1.controlColor.y());
- cairo_pattern_mesh_set_control_point(mpat, 1, mp2.controlColor.x(), mp2.controlColor.y());
- cairo_pattern_mesh_set_control_point(mpat, 2, mp3.controlColor.x(), mp3.controlColor.y());
- cairo_pattern_mesh_set_control_point(mpat, 3, mp4.controlColor.x(), mp4.controlColor.y());
- mp1.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
- mp2.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
- mp3.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
- mp4.color.getRgbF(&r, &g, &b, &a);
- cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
- cairo_pattern_mesh_end_patch(mpat);
-#endif
}
cairo_pattern_set_filter(mpat, CAIRO_FILTER_BEST);
cairo_set_source(cr, mpat);
@@ -1321,60 +1042,6 @@
pat = cairo_pattern_create_for_surface(img);
cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
-#else
- double p3x = gradPatchP3.x();
- double p3y = gradPatchP3.y();
- img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
- cr = cairo_create(img);
- cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_tolerance(cr, 0.5 );
- double r, g, b, a;
- for (int col = 0; col < meshGradientPatches.count(); col++)
- {
- meshGradientPatch patch = meshGradientPatches[col];
- meshPoint mp1 = patch.TL;
- meshPoint mp2 = patch.TR;
- meshPoint mp3 = patch.BR;
- meshPoint mp4 = patch.BL;
- cairo_new_path( cr );
- cairo_move_to(cr, mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_curve_to(cr, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
- cairo_curve_to(cr, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
- cairo_curve_to(cr, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
- cairo_curve_to(cr, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
- cairo_close_path( cr );
- double acr = 0.0;
- double acg = 0.0;
- double acb = 0.0;
- double aca = 0.0;
- mp1.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- mp2.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- mp3.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- mp4.color.getRgbF(&r, &g, &b, &a);
- acr += r;
- acg += g;
- acb += b;
- aca += a;
- cairo_set_source_rgba(cr, acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
- cairo_fill(cr);
- }
- pat = cairo_pattern_create_for_surface(img);
- cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
- cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
-#endif
}
else
{
@@ -1447,20 +1114,12 @@
cairo_paint_with_alpha (m_cr, m_fill_trans);
}
cairo_pattern_destroy (pat);
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2))
if ((fill_gradient.type() == VGradient::fourcolor) || (fill_gradient.type() == VGradient::diamond) || (fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
{
cairo_surface_destroy(img);
cairo_pattern_destroy(mpat);
cairo_destroy( cr );
}
-#else
- if ((fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
- {
- cairo_surface_destroy(img);
- cairo_destroy( cr );
- }
-#endif
}
else if (m_fillMode == 3)
{
More information about the scribus-commit
mailing list