[gimp] Bug 647235 - app/widgets/gimpcairo-wilber.c parses path data every time
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 647235 - app/widgets/gimpcairo-wilber.c parses path data every time
- Date: Sat, 9 Apr 2011 06:31:29 +0000 (UTC)
commit d52157b565527c3a024f16cdfbe09a3fcaa1063b
Author: Michael Natterer <mitch gimp org>
Date: Sat Apr 9 08:30:23 2011 +0200
Bug 647235 - app/widgets/gimpcairo-wilber.c parses path data every time
Applied patch from Juan Pablo Ugarte which keeps Wilber's cairo_path_t
around instead of parsing the SVG data each time.
app/widgets/gimpcairo-wilber.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimpcairo-wilber.c b/app/widgets/gimpcairo-wilber.c
index 69517a2..372aace 100644
--- a/app/widgets/gimpcairo-wilber.c
+++ b/app/widgets/gimpcairo-wilber.c
@@ -40,9 +40,9 @@
static const gchar wilber_path[] =
"M 509.72445,438.68864 C 501.47706,469.77945 464.95038,491.54566 431.85915,497.74874 C 438.5216,503.01688 442.87782,511.227 442.87782,520.37375 C 442.87783,536.24746 429.95607,549.0223 414.08235,549.0223 C 398.20863,549.0223 385.28688,536.24746 385.28688,520.37375 C 385.28688,511.52403 389.27666,503.61286 395.57098,498.3364 C 359.36952,495.90384 343.70976,463.95812 343.70975,463.95814 L 342.68134,509.64891 C 342.68134,514.35021 342.08391,519.96098 340.18378,528.3072 C 339.84664,527.80364 339.51399,527.33515 339.15537,526.83804 C 330.25511,514.5011 317.25269,507.81431 306.39317,508.76741 C 302.77334,509.08511 299.47017,510.33348 296.54982,512.4403 C 284.86847,520.86757 284.97665,540.94721 296.84366,557.3965 C 306.96274,571.42287 322.32232,578.25612 333.8664,574.73254 C 391.94635,615.17624 532.16931,642.41915 509.72445,438.68864 z M 363.24953,501.1278 C 373.83202,501.12778 382.49549,509.79127 382.49549,520.37375 C 382.49549,530.95624 373.83201,539.47279 363.24953,539.47279 C
352.66706,539.47279 344.1505,530.95624 344.1505,520.37375 C 344.15049,509.79129 352.66706,501.1278 363.24953,501.1278 z M 305.80551,516.1132 C 311.68466,516.11318 316.38344,521.83985 316.38344,528.89486 C 316.38345,535.94982 311.68467,541.67652 305.80551,541.67652 C 299.92636,541.67652 295.08067,535.94987 295.08067,528.89486 C 295.08065,521.83985 299.92636,516.1132 305.80551,516.1132 z M 440.821,552.54828 C 440.821,552.54828 448.7504,554.02388 453.8965,559.45332 C 457.41881,563.16951 457.75208,569.15506 456.98172,577.37703 C 456.21143,573.8833 454.89571,571.76659 453.8965,569.29666 C 443.01388,582.47662 413.42981,583.08929 376.0312,569.88433 C 416.63248,578.00493 437.38806,570.56014 449.48903,561.2163 C 446.29383,557.08917 440.821,552.54828 440.821,552.54828 z M 434.64723,524.59684 C 434.64723,532.23974 428.44429,538.44268 420.80139,538.44268 C 413.15849,538.44268 406.95555,532.23974 406.95555,524.59684 C 406.95555,516.95394 413.15849,510.751 420.80139,510.751 C 428.44429,5
10.751 434.64723,516.95394 434.64723,524.59684 z M 378.00043,522.99931 C 378.00043,527.70264 374.18324,531.51984 369.47991,531.51984 C 364.77658,531.51984 360.95939,527.70264 360.95939,522.99931 C 360.95939,518.29599 364.77658,514.47879 369.47991,514.47879 C 374.18324,514.47879 378.00043,518.29599 378.00043,522.99931 z ";
-static gboolean wilber_extents_known = FALSE;
-static gdouble wilber_x1, wilber_y1;
-static gdouble wilber_x2, wilber_y2;
+static cairo_path_t *wilber_cairo_path = NULL;
+static gdouble wilber_x1, wilber_y1;
+static gdouble wilber_x2, wilber_y2;
static void wilber_parse_path_data (cairo_t *cr,
@@ -68,7 +68,7 @@ gimp_cairo_wilber (cairo_t *cr,
cairo_save (cr);
cairo_translate (cr, x - wilber_x1, y - wilber_y1);
- wilber_parse_path_data (cr, wilber_path);
+ cairo_append_path (cr, wilber_cairo_path);
cairo_restore (cr);
}
@@ -88,7 +88,7 @@ gimp_cairo_wilber_get_size (cairo_t *cr,
static void
wilber_get_extents (cairo_t *cr)
{
- if (! wilber_extents_known)
+ if (! wilber_cairo_path)
{
cairo_save (cr);
@@ -97,9 +97,9 @@ wilber_get_extents (cairo_t *cr)
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_fill_extents (cr, &wilber_x1, &wilber_y1, &wilber_x2, &wilber_y2);
- cairo_restore (cr);
+ wilber_cairo_path = cairo_copy_path (cr);
- wilber_extents_known = TRUE;
+ cairo_restore (cr);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]