mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 09:21:50 +00:00
app/composite/gimp-composite-generic.c app/composite/gimp-composite-mmx.c
2003-09-16 Sven Neumann <sven@gimp.org> * app/composite/gimp-composite-generic.c * app/composite/gimp-composite-mmx.c * app/composite/gimp-composite-sse.c * app/composite/gimp-composite-sse2.c * app/config/gimpconfig-deserialize.c * app/config/gimpconfig-path.c * app/config/gimpconfig-serialize.c * app/core/cpercep.c * app/core/gimpunit.c * app/gui/palette-import-dialog.c * app/gui/plug-in-menus.c * app/paint-funcs/paint-funcs-generic.h * app/paint-funcs/paint-funcs.c * app/pdb/procedural_db.c * app/text/gimptextlayout-render.c * app/tools/gimpfuzzyselecttool.c * app/widgets/gimpcursor.c: some trivial code cleanups: avoid casts that discard const qualifiers and avoid useless comparisons on unsigned variables. Also reordered qualifiers in function declarations (static comes before const).
This commit is contained in:
parent
ba69b4bd96
commit
555038debf
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
2003-09-16 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/composite/gimp-composite-generic.c
|
||||
* app/composite/gimp-composite-mmx.c
|
||||
* app/composite/gimp-composite-sse.c
|
||||
* app/composite/gimp-composite-sse2.c
|
||||
* app/config/gimpconfig-deserialize.c
|
||||
* app/config/gimpconfig-path.c
|
||||
* app/config/gimpconfig-serialize.c
|
||||
* app/core/cpercep.c
|
||||
* app/core/gimpunit.c
|
||||
* app/gui/palette-import-dialog.c
|
||||
* app/gui/plug-in-menus.c
|
||||
* app/paint-funcs/paint-funcs-generic.h
|
||||
* app/paint-funcs/paint-funcs.c
|
||||
* app/pdb/procedural_db.c
|
||||
* app/text/gimptextlayout-render.c
|
||||
* app/tools/gimpfuzzyselecttool.c
|
||||
* app/widgets/gimpcursor.c: some trivial code cleanups: avoid
|
||||
casts that discard const qualifiers and avoid useless comparisons
|
||||
on unsigned variables. Also reordered qualifiers in function
|
||||
declarations (static comes before const).
|
||||
|
||||
2003-09-16 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/vectors/gimpvectors.[ch]: Fixed stupid bug (for getting
|
||||
|
|
|
@ -314,7 +314,7 @@ cpercep_init_conversions(void)
|
|||
|
||||
|
||||
|
||||
const static inline double
|
||||
static inline double
|
||||
ffunc(const double t)
|
||||
{
|
||||
if (t > 0.008856F)
|
||||
|
@ -328,7 +328,7 @@ ffunc(const double t)
|
|||
}
|
||||
|
||||
|
||||
const static inline double
|
||||
static inline double
|
||||
ffunc_inv(const double t)
|
||||
{
|
||||
if (t > 0.206893F)
|
||||
|
|
|
@ -673,11 +673,11 @@ gimp_composite_dodge_any_any_any_generic (GimpCompositeContext * ctx)
|
|||
{
|
||||
tmp = src1[b] << 8;
|
||||
tmp /= 256 - src2[b];
|
||||
dest[b] = (guchar) CLAMP(tmp, 0, 255);
|
||||
dest[b] = (guchar) MIN (tmp, 255);
|
||||
}
|
||||
|
||||
if (has_alpha1 && has_alpha2)
|
||||
dest[alpha] = MIN(src1[alpha], src2[alpha]);
|
||||
dest[alpha] = MIN (src1[alpha], src2[alpha]);
|
||||
else if (has_alpha2)
|
||||
dest[alpha] = src2[alpha];
|
||||
|
||||
|
@ -747,12 +747,12 @@ gimp_composite_hardlight_any_any_any_generic (GimpCompositeContext * ctx)
|
|||
if (src2[b] > 128)
|
||||
{
|
||||
tmp = ((gint) 255 - src1[b]) * ((gint) 255 - ((src2[b] - 128) << 1));
|
||||
dest[b] = (guchar) CLAMP(255 - (tmp >> 8), 0, 255);
|
||||
dest[b] = (guchar) MIN (255 - (tmp >> 8), 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (gint) src1[b] * ((gint) src2[b] << 1);
|
||||
dest[b] = (guchar) CLAMP(tmp >> 8, 0, 255);
|
||||
dest[b] = (guchar) MIN (tmp >> 8, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#define pmaxub(a,b,tmp) "\tmovq %%" #a ", %%" #tmp ";" "psubusb %%" #b ", %%" #tmp ";" "paddb %%" #tmp ", %%" #b "\n"
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
debug_display_mmx(void)
|
||||
{
|
||||
|
@ -63,19 +63,19 @@ debug_display_mmx(void)
|
|||
printf("--------------------------------------------\n");
|
||||
}
|
||||
|
||||
const static guint32 rgba8_alpha_mask[2] = { 0xFF000000, 0xFF000000 };
|
||||
const static guint32 rgba8_b1[2] = { 0x01010101, 0x01010101 };
|
||||
const static guint32 rgba8_b255[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
const static guint32 rgba8_w1[2] = { 0x00010001, 0x00010001 };
|
||||
const static guint32 rgba8_w2[2] = { 0x00020002, 0x00020002 };
|
||||
const static guint32 rgba8_w128[2] = { 0x00800080, 0x00800080 };
|
||||
const static guint32 rgba8_w256[2] = { 0x01000100, 0x01000100 };
|
||||
const static guint32 rgba8_w255[2] = { 0X00FF00FF, 0X00FF00FF };
|
||||
static const guint32 rgba8_alpha_mask[2] = { 0xFF000000, 0xFF000000 };
|
||||
static const guint32 rgba8_b1[2] = { 0x01010101, 0x01010101 };
|
||||
static const guint32 rgba8_b255[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
static const guint32 rgba8_w1[2] = { 0x00010001, 0x00010001 };
|
||||
static const guint32 rgba8_w2[2] = { 0x00020002, 0x00020002 };
|
||||
static const guint32 rgba8_w128[2] = { 0x00800080, 0x00800080 };
|
||||
static const guint32 rgba8_w256[2] = { 0x01000100, 0x01000100 };
|
||||
static const guint32 rgba8_w255[2] = { 0X00FF00FF, 0X00FF00FF };
|
||||
|
||||
const static guint32 va8_alpha_mask[2] = { 0xFF00FF00, 0xFF00FF00 };
|
||||
const static guint32 va8_b255[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
const static guint32 va8_w1[2] = { 0x00010001, 0x00010001 };
|
||||
const static guint32 va8_w255[2] = { 0x00FF00FF, 0x00FF00FF };
|
||||
static const guint32 va8_alpha_mask[2] = { 0xFF00FF00, 0xFF00FF00 };
|
||||
static const guint32 va8_b255[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
static const guint32 va8_w1[2] = { 0x00010001, 0x00010001 };
|
||||
static const guint32 va8_w255[2] = { 0x00FF00FF, 0x00FF00FF };
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -85,7 +85,7 @@ gimp_composite_addition_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
asm volatile ("movq %0,%%mm0"
|
||||
asm volatile ("movq %0,%%mm0"
|
||||
: /* empty */
|
||||
: "m" (*rgba8_alpha_mask)
|
||||
: "%mm0");
|
||||
|
@ -139,7 +139,7 @@ gimp_composite_burn_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
{
|
||||
asm (" movq %0,%%mm0\n"
|
||||
"\tmovq %1,%%mm1\n"
|
||||
|
||||
|
||||
"\tmovq %3,%%mm2\n"
|
||||
"\tpsubb %%mm0,%%mm2\n" /* mm2 = 255 - A */
|
||||
"\tpxor %%mm4,%%mm4\n"
|
||||
|
@ -169,7 +169,7 @@ gimp_composite_burn_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tmovq %%mm4,%%mm5\n"
|
||||
"\tpsubusw %%mm6,%%mm4\n"
|
||||
"\tpsubusw %%mm7,%%mm5\n"
|
||||
|
||||
|
||||
"\tpackuswb %%mm4,%%mm5\n"
|
||||
|
||||
"\t" pminub(mm0,mm1,mm3) "\n" /* mm1 = min(mm0,mm1) clobber mm3 */
|
||||
|
@ -223,7 +223,7 @@ gimp_composite_burn_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tmovq %%mm4,%%mm5\n"
|
||||
"\tpsubusw %%mm6,%%mm4\n"
|
||||
"\tpsubusw %%mm7,%%mm5\n"
|
||||
|
||||
|
||||
"\tpackuswb %%mm4,%%mm5\n"
|
||||
|
||||
"\t" pminub(mm0,mm1,mm3) "\n" /* mm1 = min(mm0,mm1) clobber mm3 */
|
||||
|
@ -273,7 +273,7 @@ gimp_composite_darken_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
: "m" (*op.A), "m" (*op.B), "m" (*op.D)
|
||||
: "0", "1", "2", "%mm2", "%mm3", "%mm4");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ gimp_composite_difference_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %0, %%mm2\n"
|
||||
|
@ -340,7 +340,7 @@ gimp_composite_divide_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
:
|
||||
: "m" (*rgba8_alpha_mask), "m" (*rgba8_w1)
|
||||
: "%mm0", "%mm7");
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %0,%%mm0\n"
|
||||
|
@ -364,7 +364,7 @@ gimp_composite_divide_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tpaddw %%mm7,%%mm3\n" /* mm3 = B+1 */
|
||||
|
||||
"\t" pdivwuqX(mm2,mm3,mm4) "\n" /* mm4 = (A*256)/(B+1) */
|
||||
|
||||
|
||||
"\tpackuswb %%mm4,%%mm5\n" /* expects mm4 and mm5 to be signed values */
|
||||
|
||||
"\t" pminub(mm0,mm1,mm3) "\n"
|
||||
|
@ -408,7 +408,7 @@ gimp_composite_divide_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tpaddw %%mm7,%%mm3\n" /* mm3 = B+1 */
|
||||
|
||||
"\t" pdivwuqX(mm2,mm3,mm4) "\n" /* mm4 = (A*256)/(B+1) */
|
||||
|
||||
|
||||
"\tpackuswb %%mm4,%%mm5\n" /* expects mm4 and mm5 to be signed values */
|
||||
|
||||
"\t" pminub(mm0,mm1,mm3) "\n"
|
||||
|
@ -550,7 +550,7 @@ gimp_composite_grain_extract_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
|
||||
"\tmovq %%mm0,%%mm1\n"
|
||||
"\tpandn %%mm4,%%mm1\n"
|
||||
|
||||
|
||||
"\t" pminub(mm3,mm2,mm4) "\n"
|
||||
"\tpand %%mm0,%%mm2\n"
|
||||
|
||||
|
@ -623,7 +623,7 @@ gimp_composite_grain_merge_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tpsubw %%mm7, %%mm1\n"
|
||||
|
||||
"\tpackuswb %%mm1, %%mm4\n"
|
||||
|
||||
|
||||
"\t" pminub(mm3,mm2,mm5) "\n"
|
||||
"\tpand %%mm0, %%mm2\n"
|
||||
|
||||
|
@ -646,19 +646,19 @@ gimp_composite_grain_merge_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
|
||||
mmx_low_bytes_to_words(mm2,mm4,mm6)
|
||||
mmx_low_bytes_to_words(mm3,mm5,mm6)
|
||||
|
||||
|
||||
"\tpaddw %%mm5, %%mm4\n"
|
||||
"\tpsubw %%mm7, %%mm4\n"
|
||||
"\tmovq %%mm4, %%mm1\n"
|
||||
"\tpackuswb %%mm6, %%mm1\n"
|
||||
|
||||
|
||||
"\tmovq %%mm1, %%mm4\n"
|
||||
|
||||
|
||||
"\tmovq %%mm0, %%mm1; pandn %%mm4, %%mm1\n"
|
||||
|
||||
|
||||
"\t" pminub(mm3,mm2,mm4) "\n"
|
||||
"\tpand %%mm0, %%mm2\n"
|
||||
|
||||
|
||||
"\tpor %%mm2, %%mm1\n"
|
||||
"\tmovd %%mm1, %2\n"
|
||||
: /* empty */
|
||||
|
@ -736,20 +736,20 @@ gimp_composite_multiply_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
mmx_low_bytes_to_words(mm2,mm1,mm6)
|
||||
mmx_low_bytes_to_words(mm3,mm5,mm6)
|
||||
mmx_int_mult(mm5,mm1,mm7)
|
||||
|
||||
|
||||
mmx_high_bytes_to_words(mm2,mm4,mm6)
|
||||
mmx_high_bytes_to_words(mm3,mm5,mm6)
|
||||
mmx_int_mult(mm5,mm4,mm7)
|
||||
|
||||
|
||||
"\tpackuswb %%mm4, %%mm1\n"
|
||||
|
||||
|
||||
"\tmovq %%mm0, %%mm4\n"
|
||||
"\tpandn %%mm1, %%mm4\n"
|
||||
"\tmovq %%mm4, %%mm1\n"
|
||||
"\t" pminub(mm3,mm2,mm4) "\n"
|
||||
"\tpand %%mm0, %%mm2\n"
|
||||
"\tpor %%mm2, %%mm1\n"
|
||||
|
||||
|
||||
"\tmovq %%mm1, %2\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.B), "m" (*op.D)
|
||||
|
@ -776,7 +776,7 @@ gimp_composite_multiply_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\t" pminub(mm3,mm2,mm4) "\n"
|
||||
"\tpand %%mm0, %%mm2\n"
|
||||
"\tpor %%mm2, %%mm1\n"
|
||||
|
||||
|
||||
"\tmovd %%mm1, %2\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.B), "m" (*op.D)
|
||||
|
@ -850,7 +850,7 @@ xxxgimp_composite_overlay_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
{
|
||||
asm volatile (" movq %0,%%mm2\n"
|
||||
"\tmovq %1,%%mm3\n"
|
||||
|
||||
|
||||
/* low bytes */
|
||||
mmx_low_bytes_to_words(mm3,mm5,mm0)
|
||||
"\tpcmpeqb %%mm4,%%mm4\n"
|
||||
|
@ -859,7 +859,7 @@ xxxgimp_composite_overlay_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tmovq %3,%%mm6\n" /* mm6 = words of value 2 */
|
||||
"\tpmullw %%mm5,%%mm6\n" /* mm6 = 2 * low bytes of B */
|
||||
mmx_int_mult(mm6,mm4,mm7) /* mm4 = INT_MULT(mm6, mm4) */
|
||||
|
||||
|
||||
/* high bytes */
|
||||
mmx_high_bytes_to_words(mm3,mm5,mm0)
|
||||
"\tpcmpeqb %%mm1,%%mm1\n"
|
||||
|
@ -868,30 +868,30 @@ xxxgimp_composite_overlay_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tmovq %3,%%mm6\n" /* mm6 = words of value 2 */
|
||||
"\tpmullw %%mm5,%%mm6\n" /* mm6 = 2 * high bytes of B */
|
||||
mmx_int_mult(mm6,mm1,mm7) /* mm1 = INT_MULT(mm6, mm1) */
|
||||
|
||||
|
||||
"\tpackuswb %%mm1,%%mm4\n" /* mm4 = intermediate value */
|
||||
|
||||
|
||||
mmx_low_bytes_to_words(mm4,mm5,mm0)
|
||||
mmx_low_bytes_to_words(mm2,mm6,mm0)
|
||||
"\tpaddw %%mm6,%%mm5\n"
|
||||
mmx_int_mult(mm6,mm5,mm7) /* mm5 = INT_MULT(mm6, mm5) low bytes */
|
||||
|
||||
|
||||
mmx_high_bytes_to_words(mm4,mm1,mm0)
|
||||
mmx_high_bytes_to_words(mm2,mm6,mm0)
|
||||
"\tpaddw %%mm6,%%mm1\n"
|
||||
mmx_int_mult(mm6,mm1,mm7) /* mm1 = INT_MULT(mm6, mm1) high bytes */
|
||||
|
||||
|
||||
"\tpackuswb %%mm1,%%mm5\n"
|
||||
|
||||
|
||||
"\tmovq %4,%%mm0\n"
|
||||
"\tmovq %%mm0,%%mm1\n"
|
||||
"\tpandn %%mm5,%%mm1\n"
|
||||
|
||||
|
||||
"\t" pminub(mm2,mm3,mm4) "\n"
|
||||
"\tpand %%mm0,%%mm3\n"
|
||||
|
||||
|
||||
"\tpor %%mm3,%%mm1\n"
|
||||
|
||||
|
||||
"\tmovq %%mm1,%2\n"
|
||||
: "+m" (*op.A), "+m" (*op.B), "+m" (*op.D)
|
||||
: "m" (*rgba8_w2), "m" (*rgba8_alpha_mask)
|
||||
|
@ -992,7 +992,7 @@ gimp_composite_scale_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\t" pmulwX(mm5,mm4,mm7) "\n"
|
||||
|
||||
"\tpackuswb %%mm4,%%mm1\n"
|
||||
|
||||
|
||||
"\tmovq %%mm1,%1\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.D)
|
||||
|
@ -1052,7 +1052,7 @@ gimp_composite_screen_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
"\tpsubb %%mm2,%%mm4\n"
|
||||
"\tpcmpeqb %%mm5,%%mm5\n"
|
||||
"\tpsubb %%mm3,%%mm5\n"
|
||||
|
||||
|
||||
"\tpunpckhbw %%mm6,%%mm4\n"
|
||||
"\tpunpckhbw %%mm6,%%mm5\n"
|
||||
"\tpmullw %%mm4,%%mm5\n"
|
||||
|
@ -1069,12 +1069,12 @@ gimp_composite_screen_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
|
||||
"\tmovq %%mm0,%%mm1\n"
|
||||
"\tpandn %%mm4,%%mm1\n"
|
||||
|
||||
|
||||
"\t" pminub(mm2,mm3,mm4) "\n"
|
||||
"\tpand %%mm0,%%mm3\n"
|
||||
|
||||
"\tpor %%mm3,%%mm1\n"
|
||||
|
||||
|
||||
"\tmovq %%mm1,%2\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.B), "m" (*op.D)
|
||||
|
@ -1154,12 +1154,12 @@ gimp_composite_subtract_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
|
||||
"\tmovq %%mm2,%%mm4\n"
|
||||
"\tpsubusb %%mm3,%%mm4\n"
|
||||
|
||||
|
||||
"\tmovq %%mm0,%%mm1\n"
|
||||
"\tpandn %%mm4,%%mm1\n"
|
||||
|
||||
|
||||
"\t" pminub(mm3,mm2,mm4) "\n"
|
||||
|
||||
|
||||
"\tpand %%mm0,%%mm2\n"
|
||||
"\tpor %%mm2,%%mm1\n"
|
||||
"\tmovq %%mm1,%2\n"
|
||||
|
@ -1178,10 +1178,10 @@ gimp_composite_subtract_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
|
||||
"\tmovq %%mm2,%%mm4\n"
|
||||
"\tpsubusb %%mm3,%%mm4\n"
|
||||
|
||||
|
||||
"\tmovq %%mm0,%%mm1\n"
|
||||
"\tpandn %%mm4,%%mm1\n"
|
||||
|
||||
|
||||
"\t" pminub(mm3,mm2,mm4) "\n"
|
||||
|
||||
"\tpand %%mm0,%%mm2\n"
|
||||
|
@ -1218,20 +1218,20 @@ gimp_composite_swap_rgba8_rgba8_rgba8_mmx (GimpCompositeContext *_op)
|
|||
asm volatile (" movd %0,%%mm2\n"
|
||||
"\tmovd %1,%%mm3\n"
|
||||
"\tmovd %%mm3,%0\n"
|
||||
"\tmovd %%mm2,%1\n"
|
||||
"\tmovd %%mm2,%1\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.B)
|
||||
: "0", "1", "%mm1", "%mm2", "%mm3", "%mm4");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
const static guint32 v8_alpha_mask[2] = { 0xFF00FF00, 0xFF00FF00};
|
||||
const static guint32 v8_mul_shift[2] = { 0x00800080, 0x00800080 };
|
||||
static const guint32 v8_alpha_mask[2] = { 0xFF00FF00, 0xFF00FF00};
|
||||
static const guint32 v8_mul_shift[2] = { 0x00800080, 0x00800080 };
|
||||
|
||||
void
|
||||
gimp_composite_addition_va8_va8_va8_mmx (GimpCompositeContext *_op)
|
||||
|
@ -1358,7 +1358,7 @@ gimp_composite_burn_va8_va8_va8_mmx (GimpCompositeContext *_op)
|
|||
"\tmovq %%mm4,%%mm5\n"
|
||||
"\tpsubusw %%mm6,%%mm4\n"
|
||||
"\tpsubusw %%mm7,%%mm5\n"
|
||||
|
||||
|
||||
"\tpackuswb %%mm4,%%mm5\n"
|
||||
|
||||
"\t" pminub(mm0,mm1,mm3) "\n" /* mm1 = min(mm0,mm1) clobber mm3 */
|
||||
|
@ -1411,7 +1411,7 @@ gimp_composite_burn_va8_va8_va8_mmx (GimpCompositeContext *_op)
|
|||
"\tmovq %%mm4,%%mm5\n"
|
||||
"\tpsubusw %%mm6,%%mm4\n"
|
||||
"\tpsubusw %%mm7,%%mm5\n"
|
||||
|
||||
|
||||
"\tpackuswb %%mm4,%%mm5\n"
|
||||
|
||||
"\t" pminub(mm0,mm1,mm3) "\n" /* mm1 = min(mm0,mm1) clobber mm3 */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -40,33 +40,33 @@
|
|||
|
||||
#if __GNUC__ >= 3
|
||||
|
||||
const static guint32 rgba8_alpha_mask_128[4] = { 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000 };
|
||||
const static guint32 rgba8_b1_128[4] = { 0x01010101, 0x01010101, 0x01010101, 0x01010101 };
|
||||
const static guint32 rgba8_b255_128[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
const static guint32 rgba8_w1_128[4] = { 0x00010001, 0x00010001, 0x00010001, 0x00010001 };
|
||||
const static guint32 rgba8_w2_128[4] = { 0x00020002, 0x00020002, 0x00020002, 0x00020002 };
|
||||
const static guint32 rgba8_w128_128[4] = { 0x00800080, 0x00800080, 0x00800080, 0x00800080 };
|
||||
const static guint32 rgba8_w256_128[4] = { 0x01000100, 0x01000100, 0x01000100, 0x01000100 };
|
||||
const static guint32 rgba8_w255_128[4] = { 0X00FF00FF, 0X00FF00FF, 0X00FF00FF, 0X00FF00FF };
|
||||
static const guint32 rgba8_alpha_mask_128[4] = { 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000 };
|
||||
static const guint32 rgba8_b1_128[4] = { 0x01010101, 0x01010101, 0x01010101, 0x01010101 };
|
||||
static const guint32 rgba8_b255_128[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
static const guint32 rgba8_w1_128[4] = { 0x00010001, 0x00010001, 0x00010001, 0x00010001 };
|
||||
static const guint32 rgba8_w2_128[4] = { 0x00020002, 0x00020002, 0x00020002, 0x00020002 };
|
||||
static const guint32 rgba8_w128_128[4] = { 0x00800080, 0x00800080, 0x00800080, 0x00800080 };
|
||||
static const guint32 rgba8_w256_128[4] = { 0x01000100, 0x01000100, 0x01000100, 0x01000100 };
|
||||
static const guint32 rgba8_w255_128[4] = { 0X00FF00FF, 0X00FF00FF, 0X00FF00FF, 0X00FF00FF };
|
||||
|
||||
const static guint32 va8_alpha_mask_128[4] = { 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00 };
|
||||
const static guint32 va8_b255_128[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
const static guint32 va8_w1_128[4] = { 0x00010001, 0x00010001, 0x00010001, 0x00010001 };
|
||||
const static guint32 va8_w255_128[4] = { 0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF };
|
||||
static const guint32 va8_alpha_mask_128[4] = { 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00 };
|
||||
static const guint32 va8_b255_128[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
static const guint32 va8_w1_128[4] = { 0x00010001, 0x00010001, 0x00010001, 0x00010001 };
|
||||
static const guint32 va8_w255_128[4] = { 0x00FF00FF, 0x00FF00FF, 0x00FF00FF, 0x00FF00FF };
|
||||
|
||||
const static guint32 rgba8_alpha_mask_64[2] = { 0xFF000000, 0xFF000000 };
|
||||
const static guint32 rgba8_b1_64[2] = { 0x01010101, 0x01010101 };
|
||||
const static guint32 rgba8_b255_64[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
const static guint32 rgba8_w1_64[2] = { 0x00010001, 0x00010001 };
|
||||
const static guint32 rgba8_w2_64[2] = { 0x00020002, 0x00020002 };
|
||||
const static guint32 rgba8_w128_64[2] = { 0x00800080, 0x00800080 };
|
||||
const static guint32 rgba8_w256_64[2] = { 0x01000100, 0x01000100 };
|
||||
const static guint32 rgba8_w255_64[2] = { 0X00FF00FF, 0X00FF00FF };
|
||||
static const guint32 rgba8_alpha_mask_64[2] = { 0xFF000000, 0xFF000000 };
|
||||
static const guint32 rgba8_b1_64[2] = { 0x01010101, 0x01010101 };
|
||||
static const guint32 rgba8_b255_64[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
static const guint32 rgba8_w1_64[2] = { 0x00010001, 0x00010001 };
|
||||
static const guint32 rgba8_w2_64[2] = { 0x00020002, 0x00020002 };
|
||||
static const guint32 rgba8_w128_64[2] = { 0x00800080, 0x00800080 };
|
||||
static const guint32 rgba8_w256_64[2] = { 0x01000100, 0x01000100 };
|
||||
static const guint32 rgba8_w255_64[2] = { 0X00FF00FF, 0X00FF00FF };
|
||||
|
||||
const static guint32 va8_alpha_mask_64[2] = { 0xFF00FF00, 0xFF00FF00 };
|
||||
const static guint32 va8_b255_64[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
const static guint32 va8_w1_64[2] = { 0x00010001, 0x00010001 };
|
||||
const static guint32 va8_w255_64[2] = { 0x00FF00FF, 0x00FF00FF };
|
||||
static const guint32 va8_alpha_mask_64[2] = { 0xFF00FF00, 0xFF00FF00 };
|
||||
static const guint32 va8_b255_64[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
|
||||
static const guint32 va8_w1_64[2] = { 0x00010001, 0x00010001 };
|
||||
static const guint32 va8_w255_64[2] = { 0x00FF00FF, 0x00FF00FF };
|
||||
|
||||
void
|
||||
debug_display_sse (void)
|
||||
|
@ -90,20 +90,20 @@ void
|
|||
gimp_composite_addition_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
|
||||
asm volatile (" movdqu %0,%%xmm0\n"
|
||||
"\tmovq %1,%%mm0"
|
||||
"\tmovq %1,%%mm0"
|
||||
: /* empty */
|
||||
: "m" (*rgba8_alpha_mask_128), "m" (*rgba8_alpha_mask_64)
|
||||
: "%xmm0", "%mm0");
|
||||
|
||||
|
||||
for (; op.n_pixels >= 4; op.n_pixels -= 4)
|
||||
{
|
||||
asm (" movdqu %1,%%xmm2\n"
|
||||
"\tmovdqu %2,%%xmm3\n"
|
||||
"\tmovdqu %%xmm2,%%xmm4\n"
|
||||
"\tpaddusb %%xmm3,%%xmm4\n"
|
||||
|
||||
|
||||
"\tmovdqu %%xmm0,%%xmm1\n"
|
||||
"\tpandn %%xmm4,%%xmm1\n"
|
||||
"\tpminub %%xmm3,%%xmm2\n"
|
||||
|
@ -117,7 +117,7 @@ gimp_composite_addition_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 16;
|
||||
op.D += 16;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm (" movq %1,%%mm2\n"
|
||||
|
@ -137,7 +137,7 @@ gimp_composite_addition_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 1; op.n_pixels -= 1)
|
||||
{
|
||||
asm volatile (" movd %1,%%mm2\n"
|
||||
|
@ -157,7 +157,7 @@ gimp_composite_addition_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 4;
|
||||
op.D += 4;
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -165,14 +165,14 @@ gimp_composite_addition_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
void
|
||||
xxxgimp_composite_burn_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gimp_composite_darken_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
|
||||
for (; op.n_pixels >= 4; op.n_pixels -= 4)
|
||||
{
|
||||
asm volatile (" movdqu %1,%%xmm2\n"
|
||||
|
@ -186,7 +186,7 @@ gimp_composite_darken_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 16;
|
||||
op.D += 16;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %1, %%mm2\n"
|
||||
|
@ -199,7 +199,7 @@ gimp_composite_darken_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %1, %%mm2\n"
|
||||
|
@ -210,7 +210,7 @@ gimp_composite_darken_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
: "m" (*op.A), "m" (*op.B)
|
||||
: "%mm2", "%mm3", "%mm4");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -218,13 +218,13 @@ void
|
|||
gimp_composite_difference_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
|
||||
asm volatile (" movq %0,%%mm0\n"
|
||||
"\tmovdqu %1,%%xmm0"
|
||||
:
|
||||
: "m" (*rgba8_alpha_mask_64), "m" (*rgba8_alpha_mask_128)
|
||||
: "%mm0", "%xmm0");
|
||||
|
||||
|
||||
for (; op.n_pixels >= 4; op.n_pixels -= 4)
|
||||
{
|
||||
asm volatile (" movdqu %1,%%xmm2\n"
|
||||
|
@ -247,7 +247,7 @@ gimp_composite_difference_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 16;
|
||||
op.D += 16;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %1, %%mm2\n"
|
||||
|
@ -270,7 +270,7 @@ gimp_composite_difference_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %1, %%mm2\n"
|
||||
|
@ -290,7 +290,7 @@ gimp_composite_difference_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
: "m" (*op.A), "m" (*op.B)
|
||||
: "%mm1", "%mm2", "%mm3", "%mm4", "%mm5");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ gimp_composite_dodge_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
for (; op.n_pixels >= 4; op.n_pixels -= 4)
|
||||
{
|
||||
asm volatile (" movdqu %0,%%xmm0\n"
|
||||
|
@ -309,32 +309,32 @@ gimp_composite_dodge_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
"\tpxor %%xmm2,%%xmm2\n"
|
||||
"\tpunpcklbw %%xmm2,%%xmm3\n"
|
||||
"\tpunpcklbw %%xmm0,%%xmm2\n"
|
||||
|
||||
|
||||
"\tmovdqu %3,%%xmm4\n"
|
||||
"\tpsubw %%xmm3,%%xmm4\n"
|
||||
|
||||
|
||||
"\t" xmm_pdivwuqX(xmm2,xmm4,xmm5,xmm6) "\n"
|
||||
|
||||
|
||||
"\tmovdqu %%xmm1,%%xmm3\n"
|
||||
"\tpxor %%xmm2,%%xmm2\n"
|
||||
"\tpunpckhbw %%xmm2,%%xmm3\n"
|
||||
"\tpunpckhbw %%xmm0,%%xmm2\n"
|
||||
|
||||
|
||||
"\tmovdqu %3,%%xmm4\n"
|
||||
"\tpsubw %%xmm3,%%xmm4\n"
|
||||
|
||||
|
||||
"\t" xmm_pdivwuqX(xmm2,xmm4,xmm6,xmm7) "\n"
|
||||
|
||||
|
||||
"\tpackuswb %%xmm6,%%xmm5\n"
|
||||
|
||||
|
||||
"\tmovdqu %4,%%xmm6\n"
|
||||
"\tmovdqu %%xmm1,%%xmm7\n"
|
||||
"\tpminub %%xmm0,%%xmm7\n"
|
||||
"\tpand %%xmm6,%%xmm7\n"
|
||||
"\tpandn %%xmm5,%%xmm6\n"
|
||||
|
||||
|
||||
"\tpor %%xmm6,%%xmm7\n"
|
||||
|
||||
|
||||
"\tmovdqu %%xmm7,%2\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.B), "m" (*op.D), "m" (*rgba8_w256_128), "m" (*rgba8_alpha_mask_128)
|
||||
|
@ -344,7 +344,7 @@ gimp_composite_dodge_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.D += 16;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %0,%%mm0\n"
|
||||
|
@ -353,32 +353,32 @@ gimp_composite_dodge_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
"\tpxor %%mm2,%%mm2\n"
|
||||
"\tpunpcklbw %%mm2,%%mm3\n"
|
||||
"\tpunpcklbw %%mm0,%%mm2\n"
|
||||
|
||||
|
||||
"\tmovq %3,%%mm4\n"
|
||||
"\tpsubw %%mm3,%%mm4\n"
|
||||
|
||||
|
||||
"\t" pdivwuqX(mm2,mm4,mm5) "\n"
|
||||
|
||||
|
||||
"\tmovq %%mm1,%%mm3\n"
|
||||
"\tpxor %%mm2,%%mm2\n"
|
||||
"\tpunpckhbw %%mm2,%%mm3\n"
|
||||
"\tpunpckhbw %%mm0,%%mm2\n"
|
||||
|
||||
|
||||
"\tmovq %3,%%mm4\n"
|
||||
"\tpsubw %%mm3,%%mm4\n"
|
||||
|
||||
|
||||
"\t" pdivwuqX(mm2,mm4,mm6) "\n"
|
||||
|
||||
|
||||
"\tpackuswb %%mm6,%%mm5\n"
|
||||
|
||||
|
||||
"\tmovq %4,%%mm6\n"
|
||||
"\tmovq %%mm1,%%mm7\n"
|
||||
"\tpminub %%mm0,%%mm7\n"
|
||||
"\tpand %%mm6,%%mm7\n"
|
||||
"\tpandn %%mm5,%%mm6\n"
|
||||
|
||||
|
||||
"\tpor %%mm6,%%mm7\n"
|
||||
|
||||
|
||||
"\tmovq %%mm7,%2\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.B), "m" (*op.D), "m" (*rgba8_w256_64), "m" (*rgba8_alpha_mask_64)
|
||||
|
@ -387,7 +387,7 @@ gimp_composite_dodge_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %0,%%mm0\n"
|
||||
|
@ -396,38 +396,38 @@ gimp_composite_dodge_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
"\tpxor %%mm2,%%mm2\n"
|
||||
"\tpunpcklbw %%mm2,%%mm3\n"
|
||||
"\tpunpcklbw %%mm0,%%mm2\n"
|
||||
|
||||
|
||||
"\tmovq %3,%%mm4\n"
|
||||
"\tpsubw %%mm3,%%mm4\n"
|
||||
|
||||
|
||||
"\t" pdivwuqX(mm2,mm4,mm5) "\n"
|
||||
|
||||
|
||||
"\tmovq %%mm1,%%mm3\n"
|
||||
"\tpxor %%mm2,%%mm2\n"
|
||||
"\tpunpckhbw %%mm2,%%mm3\n"
|
||||
"\tpunpckhbw %%mm0,%%mm2\n"
|
||||
|
||||
|
||||
"\tmovq %3,%%mm4\n"
|
||||
"\tpsubw %%mm3,%%mm4\n"
|
||||
|
||||
|
||||
"\t" pdivwuqX(mm2,mm4,mm6) "\n"
|
||||
|
||||
|
||||
"\tpackuswb %%mm6,%%mm5\n"
|
||||
|
||||
|
||||
"\tmovq %4,%%mm6\n"
|
||||
"\tmovq %%mm1,%%mm7\n"
|
||||
"\tpminub %%mm0,%%mm7\n"
|
||||
"\tpand %%mm6,%%mm7\n"
|
||||
"\tpandn %%mm5,%%mm6\n"
|
||||
|
||||
|
||||
"\tpor %%mm6,%%mm7\n"
|
||||
|
||||
|
||||
"\tmovd %%mm7,%2\n"
|
||||
: /* empty */
|
||||
: "m" (*op.A), "m" (*op.B), "m" (*op.D), "m" (*rgba8_w256_64), "m" (*rgba8_alpha_mask_64)
|
||||
: "0", "1", "2", "%eax", "%ecx", "%edx", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ void
|
|||
gimp_composite_grain_extract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
|
||||
asm volatile (" movq %0,%%mm0\n"
|
||||
"\tpxor %%mm6,%%mm6\n"
|
||||
"\tmovq %1,%%mm7\n"
|
||||
|
@ -455,22 +455,22 @@ gimp_composite_grain_extract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
"\tpsubw %%xmm5,%%xmm4\n"
|
||||
"\tpaddw %%xmm7,%%xmm4\n"
|
||||
"\tmovdqu %%xmm4,%%xmm1\n"
|
||||
|
||||
|
||||
xmm_high_bytes_to_words(xmm2,xmm4,xmm6)
|
||||
xmm_high_bytes_to_words(xmm3,xmm5,xmm6)
|
||||
|
||||
|
||||
"\tpsubw %%xmm5,%%xmm4\n"
|
||||
"\tpaddw %%xmm7,%%xmm4\n"
|
||||
|
||||
|
||||
"\tpackuswb %%xmm4,%%xmm1\n"
|
||||
"\tmovdqu %%xmm1,%%xmm4\n"
|
||||
|
||||
|
||||
"\tmovdqu %%xmm0,%%xmm1\n"
|
||||
"\tpandn %%xmm4,%%xmm1\n"
|
||||
|
||||
|
||||
"\tpminub %%xmm3,%%xmm2\n"
|
||||
"\tpand %%xmm0,%%xmm2\n"
|
||||
|
||||
|
||||
"\tpor %%xmm2,%%xmm1\n"
|
||||
"\tmovdqu %%xmm1,%0\n"
|
||||
: "+m" (*op.D)
|
||||
|
@ -480,7 +480,7 @@ gimp_composite_grain_extract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 16;
|
||||
op.D += 16;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %1,%%mm2\n"
|
||||
|
@ -490,22 +490,22 @@ gimp_composite_grain_extract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
"\tpsubw %%mm5,%%mm4\n"
|
||||
"\tpaddw %%mm7,%%mm4\n"
|
||||
"\tmovq %%mm4,%%mm1\n"
|
||||
|
||||
|
||||
mmx_high_bytes_to_words(mm2,mm4,mm6)
|
||||
mmx_high_bytes_to_words(mm3,mm5,mm6)
|
||||
|
||||
|
||||
"\tpsubw %%mm5,%%mm4\n"
|
||||
"\tpaddw %%mm7,%%mm4\n"
|
||||
|
||||
|
||||
"\tpackuswb %%mm4,%%mm1\n"
|
||||
"\tmovq %%mm1,%%mm4\n"
|
||||
|
||||
|
||||
"\tmovq %%mm0,%%mm1\n"
|
||||
"\tpandn %%mm4,%%mm1\n"
|
||||
|
||||
|
||||
"\tpminub %%mm3,%%mm2\n"
|
||||
"\tpand %%mm0,%%mm2\n"
|
||||
|
||||
|
||||
"\tpor %%mm2,%%mm1\n"
|
||||
"\tmovq %%mm1,%0\n"
|
||||
: "+m" (*op.D)
|
||||
|
@ -515,7 +515,7 @@ gimp_composite_grain_extract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %1, %%mm2\n"
|
||||
|
@ -537,7 +537,7 @@ gimp_composite_grain_extract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
: "m" (*op.A), "m" (*op.B)
|
||||
: "%mm1", "%mm2", "%mm3", "%mm4");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -545,9 +545,9 @@ void
|
|||
gimp_composite_lighten_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
|
||||
asm volatile ("movq %0,%%mm0" : : "m" (*rgba8_alpha_mask_64) : "%mm0");
|
||||
|
||||
|
||||
for (; op.n_pixels >= 4; op.n_pixels -= 4)
|
||||
{
|
||||
asm volatile (" movdqu %1, %%xmm2\n"
|
||||
|
@ -567,7 +567,7 @@ gimp_composite_lighten_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 16;
|
||||
op.D += 16;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %1, %%mm2\n"
|
||||
|
@ -587,7 +587,7 @@ gimp_composite_lighten_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %1, %%mm2\n"
|
||||
|
@ -604,7 +604,7 @@ gimp_composite_lighten_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
: "m" (*op.A), "m" (*op.B)
|
||||
: "%mm1", "%mm2", "%mm3", "%mm4");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -612,20 +612,20 @@ void
|
|||
gimp_composite_subtract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
|
||||
asm volatile (" movq %0,%%mm0\n"
|
||||
"\tmovdqu %1,%%xmm0\n"
|
||||
: /* empty */
|
||||
: "m" (*rgba8_alpha_mask_64), "m" (*rgba8_alpha_mask_128)
|
||||
: "%mm0", "%xmm0");
|
||||
|
||||
|
||||
for (; op.n_pixels >= 4; op.n_pixels -= 4)
|
||||
{
|
||||
asm volatile (" movdqu %1,%%xmm2\n"
|
||||
"\tmovdqu %2,%%xmm3\n"
|
||||
"\tmovdqu %%xmm2,%%xmm4\n"
|
||||
"\tpsubusb %%xmm3,%%xmm4\n"
|
||||
|
||||
|
||||
"\tmovdqu %%xmm0,%%xmm1\n"
|
||||
"\tpandn %%xmm4,%%xmm1\n"
|
||||
"\tpminub %%xmm3,%%xmm2\n"
|
||||
|
@ -639,7 +639,7 @@ gimp_composite_subtract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 16;
|
||||
op.D += 16;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %1,%%mm2\n"
|
||||
|
@ -659,7 +659,7 @@ gimp_composite_subtract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.B += 8;
|
||||
op.D += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %1,%%mm2\n"
|
||||
|
@ -676,7 +676,7 @@ gimp_composite_subtract_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
: "m" (*op.A), "m" (*op.B)
|
||||
: "%mm1", "%mm2", "%mm3", "%mm4");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ void
|
|||
gimp_composite_swap_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
||||
{
|
||||
GimpCompositeContext op = *_op;
|
||||
|
||||
|
||||
/*
|
||||
* Inhale one whole i686 cache line at once. 64 bytes, 16 rgba8 pixels, 4 128 bit xmm registers.
|
||||
*/
|
||||
|
@ -698,7 +698,7 @@ gimp_composite_swap_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
"\tmovdqu %5,%%xmm5\n"
|
||||
"\tmovdqu %6,%%xmm6\n"
|
||||
"\tmovdqu %7,%%xmm7\n"
|
||||
|
||||
|
||||
"\tmovdqu %%xmm0,%1\n"
|
||||
"\tmovdqu %%xmm1,%0\n"
|
||||
"\tmovdqu %%xmm2,%3\n"
|
||||
|
@ -717,7 +717,7 @@ gimp_composite_swap_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.A += 64;
|
||||
op.B += 64;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 4; op.n_pixels -= 4)
|
||||
{
|
||||
asm volatile (" movdqu %0,%%xmm2\n"
|
||||
|
@ -730,7 +730,7 @@ gimp_composite_swap_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.A += 16;
|
||||
op.B += 16;
|
||||
}
|
||||
|
||||
|
||||
for (; op.n_pixels >= 2; op.n_pixels -= 2)
|
||||
{
|
||||
asm volatile (" movq %0,%%mm2\n"
|
||||
|
@ -743,18 +743,18 @@ gimp_composite_swap_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
|
|||
op.A += 8;
|
||||
op.B += 8;
|
||||
}
|
||||
|
||||
|
||||
if (op.n_pixels)
|
||||
{
|
||||
asm volatile (" movd %0,%%mm2\n"
|
||||
"\tmovd %1,%%mm3\n"
|
||||
"\tmovd %%mm3,%0\n"
|
||||
"\tmovd %%mm2,%1\n"
|
||||
"\tmovd %%mm2,%1\n"
|
||||
: "+m" (*op.A), "+m" (*op.B)
|
||||
: /* empty */
|
||||
: "%mm1", "%mm2", "%mm3", "%mm4");
|
||||
}
|
||||
|
||||
|
||||
asm("emms");
|
||||
}
|
||||
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* All functions return G_TOKEN_RIGHT_PAREN on success,
|
||||
* the GTokenType they would have expected but didn't get
|
||||
* or G_TOKEN_NONE if they got the expected token but
|
||||
* couldn't parse it.
|
||||
*/
|
||||
|
||||
|
||||
static GTokenType gimp_config_deserialize_unknown (GObject *object,
|
||||
GScanner *scanner);
|
||||
static GTokenType gimp_config_deserialize_property (GObject *object,
|
||||
|
@ -94,7 +94,7 @@ static GTokenType gimp_config_deserialize_any (GValue *value,
|
|||
GParamSpec *prop_spec,
|
||||
GScanner *scanner);
|
||||
|
||||
static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
||||
static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
||||
const gchar *token_name);
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
|||
* @scanner: a #GScanner.
|
||||
* @nest_level:
|
||||
* @store_unknown_tokens: %TRUE if you want to store unknown tokens.
|
||||
*
|
||||
*
|
||||
* This function uses the @scanner to configure the properties of @object.
|
||||
*
|
||||
* The store_unknown_tokens parameter is a special feature for #GimpRc.
|
||||
|
@ -112,8 +112,8 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
|||
* a property of @object) with string values are attached to @object as
|
||||
* unknown tokens. GimpConfig has a couple of functions to handle the
|
||||
* attached key/value pairs.
|
||||
*
|
||||
* Return value:
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
gboolean
|
||||
gimp_config_deserialize_properties (GObject *object,
|
||||
|
@ -147,7 +147,7 @@ gimp_config_deserialize_properties (GObject *object,
|
|||
|
||||
if (prop_spec->flags & GIMP_PARAM_SERIALIZE)
|
||||
{
|
||||
g_scanner_scope_add_symbol (scanner, scope_id,
|
||||
g_scanner_scope_add_symbol (scanner, scope_id,
|
||||
prop_spec->name, prop_spec);
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ gimp_config_deserialize_properties (GObject *object,
|
|||
}
|
||||
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
|
||||
|
||||
switch (token)
|
||||
{
|
||||
case G_TOKEN_LEFT_PAREN:
|
||||
|
@ -209,7 +209,7 @@ gimp_config_deserialize_properties (GObject *object,
|
|||
_("fatal parse error"), TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return gimp_config_deserialize_return (scanner, token, nest_level);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ gimp_config_deserialize_unknown (GObject *object,
|
|||
key = g_strdup (scanner->value.v_identifier);
|
||||
|
||||
g_scanner_get_next_token (scanner);
|
||||
|
||||
|
||||
if (!scanner_string_utf8_valid (scanner, key))
|
||||
{
|
||||
g_free (key);
|
||||
|
@ -309,18 +309,18 @@ gimp_config_deserialize_property (GObject *object,
|
|||
(prop_spec->flags & GIMP_PARAM_AGGREGATE)))
|
||||
g_object_set_property (object, prop_spec->name, &value);
|
||||
}
|
||||
#if CONFIG_DEBUG
|
||||
#ifdef CONFIG_DEBUG
|
||||
else
|
||||
{
|
||||
g_warning ("couldn't deserialize property %s::%s of type %s",
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (object)),
|
||||
prop_spec->name,
|
||||
prop_spec->name,
|
||||
g_type_name (prop_spec->value_type));
|
||||
}
|
||||
#endif
|
||||
|
||||
g_value_unset (&value);
|
||||
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
|
@ -382,11 +382,11 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
case G_TYPE_STRING:
|
||||
token = G_TOKEN_STRING;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_BOOLEAN:
|
||||
token = G_TOKEN_IDENTIFIER;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_INT:
|
||||
case G_TYPE_LONG:
|
||||
if (g_scanner_peek_next_token (scanner) == '-')
|
||||
|
@ -399,12 +399,12 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
case G_TYPE_ULONG:
|
||||
token = G_TOKEN_INT;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_FLOAT:
|
||||
case G_TYPE_DOUBLE:
|
||||
token = G_TOKEN_FLOAT;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
token = G_TOKEN_NONE;
|
||||
g_assert_not_reached ();
|
||||
|
@ -426,7 +426,7 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
else
|
||||
return G_TOKEN_NONE;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_BOOLEAN:
|
||||
if (! g_ascii_strcasecmp (scanner->value.v_identifier, "yes") ||
|
||||
! g_ascii_strcasecmp (scanner->value.v_identifier, "true"))
|
||||
|
@ -436,10 +436,10 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
g_value_set_boolean (value, FALSE);
|
||||
else
|
||||
{
|
||||
g_scanner_error
|
||||
(scanner,
|
||||
g_scanner_error
|
||||
(scanner,
|
||||
/* please don't translate 'yes' and 'no' */
|
||||
_("expected 'yes' or 'no' for boolean token %s, got '%s'"),
|
||||
_("expected 'yes' or 'no' for boolean token %s, got '%s'"),
|
||||
prop_spec->name, scanner->value.v_identifier);
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
@ -489,21 +489,21 @@ gimp_config_deserialize_enum (GValue *value,
|
|||
case G_TOKEN_IDENTIFIER:
|
||||
g_scanner_get_next_token (scanner);
|
||||
|
||||
enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (enum_class),
|
||||
enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (enum_class),
|
||||
scanner->value.v_identifier);
|
||||
if (!enum_value)
|
||||
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
|
||||
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
|
||||
scanner->value.v_identifier);
|
||||
|
||||
if (!enum_value)
|
||||
{
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%s' for token %s"),
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%s' for token %s"),
|
||||
scanner->value.v_identifier, prop_spec->name);
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case G_TOKEN_INT:
|
||||
g_scanner_get_next_token (scanner);
|
||||
|
||||
|
@ -511,17 +511,17 @@ gimp_config_deserialize_enum (GValue *value,
|
|||
|
||||
if (!enum_value)
|
||||
{
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%ld' for token %s"),
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%ld' for token %s"),
|
||||
scanner->value.v_int, prop_spec->name);
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return G_TOKEN_IDENTIFIER;
|
||||
}
|
||||
|
||||
|
||||
g_value_set_enum (value, enum_value->value);
|
||||
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
|
@ -537,7 +537,7 @@ gimp_config_deserialize_memsize (GValue *value,
|
|||
|
||||
scanner->config->cset_identifier_first = G_CSET_DIGITS;
|
||||
scanner->config->cset_identifier_nth = G_CSET_DIGITS "gGmMkKbB";
|
||||
|
||||
|
||||
if (g_scanner_peek_next_token (scanner) != G_TOKEN_IDENTIFIER)
|
||||
return G_TOKEN_IDENTIFIER;
|
||||
|
||||
|
@ -545,7 +545,7 @@ gimp_config_deserialize_memsize (GValue *value,
|
|||
|
||||
scanner->config->cset_identifier_first = orig_cset_first;
|
||||
scanner->config->cset_identifier_nth = orig_cset_nth;
|
||||
|
||||
|
||||
if (gimp_memsize_set_from_string (value, scanner->value.v_identifier))
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
else
|
||||
|
@ -581,10 +581,10 @@ gimp_config_deserialize_path (GValue *value,
|
|||
_("while parsing token %s: %s"),
|
||||
prop_spec->name, error->message);
|
||||
g_error_free (error);
|
||||
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
|
||||
g_free (expand);
|
||||
|
||||
g_value_set_static_string (value, scanner->value.v_string);
|
||||
|
@ -644,7 +644,7 @@ gimp_config_deserialize_object (GValue *value,
|
|||
|
||||
if (! gimp_config_iface)
|
||||
return gimp_config_deserialize_any (value, prop_spec, scanner);
|
||||
|
||||
|
||||
if (! gimp_config_iface->deserialize (prop_object,
|
||||
scanner, nest_level + 1, NULL))
|
||||
return G_TOKEN_NONE;
|
||||
|
@ -723,14 +723,14 @@ gimp_config_deserialize_any (GValue *value,
|
|||
}
|
||||
|
||||
static inline gboolean
|
||||
scanner_string_utf8_valid (GScanner *scanner,
|
||||
scanner_string_utf8_valid (GScanner *scanner,
|
||||
const gchar *token_name)
|
||||
{
|
||||
if (g_utf8_validate (scanner->value.v_string, -1, NULL))
|
||||
return TRUE;
|
||||
|
||||
g_scanner_error (scanner,
|
||||
_("value for token %s is not a valid UTF-8 string"),
|
||||
g_scanner_error (scanner,
|
||||
_("value for token %s is not a valid UTF-8 string"),
|
||||
token_name);
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
static inline gchar * extract_token (const gchar **str);
|
||||
|
||||
|
||||
gchar *
|
||||
gchar *
|
||||
gimp_config_path_expand (const gchar *path,
|
||||
gboolean recode,
|
||||
GError **error)
|
||||
|
@ -47,7 +47,7 @@ gimp_config_path_expand (const gchar *path,
|
|||
const gchar *s;
|
||||
gchar *n;
|
||||
gchar *token;
|
||||
gchar *filename;
|
||||
gchar *filename = NULL;
|
||||
gchar *expanded = NULL;
|
||||
gchar **substs = NULL;
|
||||
guint n_substs = 0;
|
||||
|
@ -61,13 +61,15 @@ gimp_config_path_expand (const gchar *path,
|
|||
{
|
||||
if (!(filename = g_filename_from_utf8 (path, -1, NULL, NULL, error)))
|
||||
return NULL;
|
||||
|
||||
p = filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (gchar *) path;
|
||||
p = path;
|
||||
}
|
||||
|
||||
for (p = filename; *p; )
|
||||
while (*p)
|
||||
{
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
|
@ -84,7 +86,7 @@ gimp_config_path_expand (const gchar *path,
|
|||
for (i = 0; i < n_substs; i++)
|
||||
if (strcmp (substs[2*i], token) == 0)
|
||||
break;
|
||||
|
||||
|
||||
if (i < n_substs)
|
||||
{
|
||||
s = substs[2*i+1];
|
||||
|
@ -95,21 +97,21 @@ gimp_config_path_expand (const gchar *path,
|
|||
|
||||
if (!s && strcmp (token, "gimp_dir") == 0)
|
||||
s = gimp_directory ();
|
||||
|
||||
|
||||
if (!s && strcmp (token, "gimp_data_dir") == 0)
|
||||
s = gimp_data_directory ();
|
||||
|
||||
if (!s &&
|
||||
((strcmp (token, "gimp_plug_in_dir")) == 0 ||
|
||||
|
||||
if (!s &&
|
||||
((strcmp (token, "gimp_plug_in_dir")) == 0 ||
|
||||
(strcmp (token, "gimp_plugin_dir")) == 0))
|
||||
s = gimp_plug_in_directory ();
|
||||
|
||||
|
||||
if (!s && strcmp (token, "gimp_sysconf_dir") == 0)
|
||||
s = gimp_sysconf_directory ();
|
||||
|
||||
|
||||
if (!s)
|
||||
s = g_getenv (token);
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* The default user gimprc on Windows references
|
||||
* ${TEMP}, but not all Windows installations have that
|
||||
|
@ -120,32 +122,32 @@ gimp_config_path_expand (const gchar *path,
|
|||
s = g_get_tmp_dir ();
|
||||
#endif /* G_OS_WIN32 */
|
||||
}
|
||||
|
||||
|
||||
if (!s)
|
||||
{
|
||||
g_set_error (error, 0, 0, _("can not expand ${%s}"), token);
|
||||
g_free (token);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
if (n_substs % SUBSTS_ALLOC == 0)
|
||||
substs = g_renew (gchar *, substs, 2 * (n_substs + SUBSTS_ALLOC));
|
||||
|
||||
|
||||
substs[2*n_substs] = token;
|
||||
substs[2*n_substs + 1] = (gchar *) s;
|
||||
n_substs++;
|
||||
|
||||
|
||||
length += strlen (s);
|
||||
}
|
||||
else
|
||||
{
|
||||
length += g_utf8_skip[(guchar) *p];
|
||||
length += g_utf8_skip[(const guchar) *p];
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
}
|
||||
|
||||
if (n_substs == 0)
|
||||
return recode ? filename : g_strdup (filename);
|
||||
return recode ? filename : g_strdup (path);
|
||||
|
||||
expanded = g_new (gchar, length + 1);
|
||||
|
||||
|
@ -197,11 +199,9 @@ gimp_config_path_expand (const gchar *path,
|
|||
g_free (substs[2*i]);
|
||||
|
||||
g_free (substs);
|
||||
g_free (filename);
|
||||
|
||||
if (recode)
|
||||
g_free (filename);
|
||||
|
||||
return expanded;
|
||||
return expanded;
|
||||
}
|
||||
|
||||
static inline gchar *
|
||||
|
@ -223,7 +223,7 @@ extract_token (const gchar **str)
|
|||
|
||||
token = g_strndup (*str + 2, g_utf8_pointer_to_offset (*str + 2, p));
|
||||
|
||||
*str = p + 1; /* after the closing bracket */
|
||||
*str = p + 1; /* after the closing bracket */
|
||||
|
||||
return token;
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ static void serialize_unknown_token (const gchar *key,
|
|||
|
||||
/**
|
||||
* gimp_config_serialize_properties:
|
||||
* @object: a #GObject.
|
||||
* @object: a #GObject.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* This function writes all object properties to the @writer.
|
||||
*
|
||||
* Returns: %TRUE if serialization succeeded, %FALSE otherwise
|
||||
|
@ -71,7 +71,7 @@ gimp_config_serialize_properties (GObject *object,
|
|||
guint i;
|
||||
|
||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (object);
|
||||
|
||||
property_specs = g_object_class_list_properties (klass, &n_property_specs);
|
||||
|
@ -97,9 +97,9 @@ gimp_config_serialize_properties (GObject *object,
|
|||
|
||||
/**
|
||||
* gimp_config_serialize_changed_properties:
|
||||
* @object: a #GObject.
|
||||
* @object: a #GObject.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* This function writes all object properties that have been changed from
|
||||
* their default values to the @writer.
|
||||
*
|
||||
|
@ -150,10 +150,10 @@ gimp_config_serialize_changed_properties (GObject *object,
|
|||
|
||||
/**
|
||||
* gimp_config_serialize_properties_diff:
|
||||
* @object: a #GObject.
|
||||
* @compare: a #GObject of the same type as @object.
|
||||
* @object: a #GObject.
|
||||
* @compare: a #GObject of the same type as @object.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* This function compares @object and @compare and writes all
|
||||
* properties of @object that have different values than @compare to
|
||||
* the @writer.
|
||||
|
@ -171,7 +171,7 @@ gimp_config_serialize_properties_diff (GObject *object,
|
|||
|
||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||
g_return_val_if_fail (G_IS_OBJECT (compare), FALSE);
|
||||
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (object) ==
|
||||
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (object) ==
|
||||
G_TYPE_FROM_INSTANCE (compare), FALSE);
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (object);
|
||||
|
@ -311,7 +311,7 @@ gimp_config_serialize_property (GObject *object,
|
|||
{
|
||||
g_warning ("couldn't serialize property %s::%s of type %s",
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (object)),
|
||||
param_spec->name,
|
||||
param_spec->name,
|
||||
g_type_name (param_spec->value_type));
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ gimp_config_serialize_property (GObject *object,
|
|||
* @escaped: whether to escape string values.
|
||||
*
|
||||
* This utility function appends a string representation of #GValue to @str.
|
||||
*
|
||||
*
|
||||
* Return value: %TRUE if serialization succeeded, %FALSE otherwise.
|
||||
**/
|
||||
gboolean
|
||||
|
@ -340,17 +340,17 @@ gimp_config_serialize_value (const GValue *value,
|
|||
if (G_VALUE_HOLDS_BOOLEAN (value))
|
||||
{
|
||||
gboolean bool;
|
||||
|
||||
|
||||
bool = g_value_get_boolean (value);
|
||||
g_string_append (str, bool ? "yes" : "no");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (G_VALUE_HOLDS_ENUM (value))
|
||||
{
|
||||
GEnumClass *enum_class;
|
||||
GEnumValue *enum_value;
|
||||
|
||||
|
||||
enum_class = g_type_class_peek (G_VALUE_TYPE (value));
|
||||
enum_value = g_enum_get_value (G_ENUM_CLASS (enum_class),
|
||||
g_value_get_enum (value));
|
||||
|
@ -362,12 +362,12 @@ gimp_config_serialize_value (const GValue *value,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Couldn't get nick for enum_value of %s",
|
||||
g_warning ("Couldn't get nick for enum_value of %s",
|
||||
G_ENUM_CLASS_TYPE_NAME (enum_class));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (G_VALUE_HOLDS_STRING (value))
|
||||
{
|
||||
const gchar *cstr = g_value_get_string (value);
|
||||
|
@ -466,7 +466,7 @@ gimp_config_serialize_value (const GValue *value,
|
|||
if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
|
||||
{
|
||||
GValue tmp_value = { 0, };
|
||||
|
||||
|
||||
g_value_init (&tmp_value, G_TYPE_STRING);
|
||||
g_value_transform (value, &tmp_value);
|
||||
|
||||
|
@ -475,7 +475,7 @@ gimp_config_serialize_value (const GValue *value,
|
|||
g_value_unset (&tmp_value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ gimp_config_serialize_value (const GValue *value,
|
|||
* gimp_config_serialize_unknown_tokens:
|
||||
* @object: a #GObject.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* Writes all unknown tokens attached to #object to the @writer. See
|
||||
* gimp_config_add_unknown_token().
|
||||
*
|
||||
|
@ -509,7 +509,7 @@ gimp_config_serialize_unknown_tokens (GObject *object,
|
|||
* gimp_config_serialize_comment:
|
||||
* @str: a #GString.
|
||||
* @comment: the comment to serialize (ASCII only)
|
||||
*
|
||||
*
|
||||
* Appends the @comment to @str and inserts linebreaks and hash-marks to
|
||||
* format it as a comment. Note that this function does not handle non-ASCII
|
||||
* characters.
|
||||
|
|
|
@ -314,7 +314,7 @@ cpercep_init_conversions(void)
|
|||
|
||||
|
||||
|
||||
const static inline double
|
||||
static inline double
|
||||
ffunc(const double t)
|
||||
{
|
||||
if (t > 0.008856F)
|
||||
|
@ -328,7 +328,7 @@ ffunc(const double t)
|
|||
}
|
||||
|
||||
|
||||
const static inline double
|
||||
static inline double
|
||||
ffunc_inv(const double t)
|
||||
{
|
||||
if (t > 0.206893F)
|
||||
|
|
|
@ -128,8 +128,7 @@ gboolean
|
|||
_gimp_unit_get_deletion_flag (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units)), FALSE);
|
||||
g_return_val_if_fail (unit < (GIMP_UNIT_END + gimp->n_user_units), FALSE);
|
||||
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return FALSE;
|
||||
|
@ -142,10 +141,10 @@ _gimp_unit_set_deletion_flag (Gimp *gimp,
|
|||
GimpUnit unit,
|
||||
gboolean deletion_flag)
|
||||
{
|
||||
g_return_if_fail ((unit >= GIMP_UNIT_END) &&
|
||||
g_return_if_fail ((unit >= GIMP_UNIT_END) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units)));
|
||||
|
||||
_gimp_unit_get_user_unit (gimp, unit)->delete_on_exit =
|
||||
_gimp_unit_get_user_unit (gimp, unit)->delete_on_exit =
|
||||
deletion_flag ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
@ -153,8 +152,7 @@ gdouble
|
|||
_gimp_unit_get_factor (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units)),
|
||||
g_return_val_if_fail (unit < (GIMP_UNIT_END + gimp->n_user_units),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].factor);
|
||||
|
||||
if (unit < GIMP_UNIT_END)
|
||||
|
@ -167,8 +165,7 @@ gint
|
|||
_gimp_unit_get_digits (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units)),
|
||||
g_return_val_if_fail (unit < (GIMP_UNIT_END + gimp->n_user_units),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].digits);
|
||||
|
||||
if (unit < GIMP_UNIT_END)
|
||||
|
@ -177,12 +174,11 @@ _gimp_unit_get_digits (Gimp *gimp,
|
|||
return _gimp_unit_get_user_unit (gimp, unit)->digits;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
const gchar *
|
||||
_gimp_unit_get_identifier (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail (((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units))) ||
|
||||
g_return_val_if_fail ((unit < (GIMP_UNIT_END + gimp->n_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].identifier);
|
||||
|
||||
|
@ -199,8 +195,7 @@ const gchar *
|
|||
_gimp_unit_get_symbol (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail (((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units))) ||
|
||||
g_return_val_if_fail ((unit < (GIMP_UNIT_END + gimp->n_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].symbol);
|
||||
|
||||
|
@ -217,8 +212,7 @@ const gchar *
|
|||
_gimp_unit_get_abbreviation (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail (((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units))) ||
|
||||
g_return_val_if_fail ((unit < (GIMP_UNIT_END + gimp->n_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].abbreviation);
|
||||
|
||||
|
@ -235,8 +229,7 @@ const gchar *
|
|||
_gimp_unit_get_singular (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail (((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units))) ||
|
||||
g_return_val_if_fail ((unit < (GIMP_UNIT_END + gimp->n_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gettext (gimp_unit_defs[GIMP_UNIT_INCH].singular));
|
||||
|
||||
|
@ -253,8 +246,7 @@ const gchar *
|
|||
_gimp_unit_get_plural (Gimp *gimp,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail (((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + gimp->n_user_units))) ||
|
||||
g_return_val_if_fail ((unit < (GIMP_UNIT_END + gimp->n_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gettext (gimp_unit_defs[GIMP_UNIT_INCH].plural));
|
||||
|
||||
|
|
|
@ -575,6 +575,7 @@ static void
|
|||
palette_import_make_palette (ImportDialog *import_dialog)
|
||||
{
|
||||
GimpPalette *palette = NULL;
|
||||
const gchar *entry;
|
||||
gchar *palette_name;
|
||||
GimpGradient *gradient;
|
||||
GimpImage *gimage;
|
||||
|
@ -582,10 +583,10 @@ palette_import_make_palette (ImportDialog *import_dialog)
|
|||
gint n_columns;
|
||||
gint threshold;
|
||||
|
||||
palette_name = (gchar *) gtk_entry_get_text (GTK_ENTRY (import_dialog->entry));
|
||||
entry = gtk_entry_get_text (GTK_ENTRY (import_dialog->entry));
|
||||
|
||||
if (palette_name && strlen (palette_name))
|
||||
palette_name = g_strdup (palette_name);
|
||||
if (entry && strlen (entry))
|
||||
palette_name = g_strdup (entry);
|
||||
else
|
||||
palette_name = g_strdup (_("Untitled"));
|
||||
|
||||
|
|
|
@ -575,6 +575,7 @@ static void
|
|||
palette_import_make_palette (ImportDialog *import_dialog)
|
||||
{
|
||||
GimpPalette *palette = NULL;
|
||||
const gchar *entry;
|
||||
gchar *palette_name;
|
||||
GimpGradient *gradient;
|
||||
GimpImage *gimage;
|
||||
|
@ -582,10 +583,10 @@ palette_import_make_palette (ImportDialog *import_dialog)
|
|||
gint n_columns;
|
||||
gint threshold;
|
||||
|
||||
palette_name = (gchar *) gtk_entry_get_text (GTK_ENTRY (import_dialog->entry));
|
||||
entry = gtk_entry_get_text (GTK_ENTRY (import_dialog->entry));
|
||||
|
||||
if (palette_name && strlen (palette_name))
|
||||
palette_name = g_strdup (palette_name);
|
||||
if (entry && strlen (entry))
|
||||
palette_name = g_strdup (entry);
|
||||
else
|
||||
palette_name = g_strdup (_("Untitled"));
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ plug_in_menus_init (Gimp *gimp,
|
|||
&locale_path);
|
||||
|
||||
for (list = domains; list; list = list->next)
|
||||
if (! strcmp (locale_domain, (gchar *) list->data))
|
||||
if (! strcmp (locale_domain, (const gchar *) list->data))
|
||||
break;
|
||||
|
||||
if (! list)
|
||||
|
|
|
@ -93,7 +93,7 @@ plug_in_menus_init (Gimp *gimp,
|
|||
&locale_path);
|
||||
|
||||
for (list = domains; list; list = list->next)
|
||||
if (! strcmp (locale_domain, (gchar *) list->data))
|
||||
if (! strcmp (locale_domain, (const gchar *) list->data))
|
||||
break;
|
||||
|
||||
if (! list)
|
||||
|
|
|
@ -84,8 +84,10 @@ color_pixels (guchar *dest,
|
|||
guchar c0, c1, c2, c3;
|
||||
#else
|
||||
guchar c0, c1, c2;
|
||||
guint32 *longd, longc;
|
||||
guint16 *shortd, shortc;
|
||||
guint32 *longd;
|
||||
guint32 longc;
|
||||
guint16 *shortd;
|
||||
guint16 shortc;
|
||||
#endif
|
||||
|
||||
switch (bytes)
|
||||
|
@ -105,7 +107,7 @@ color_pixels (guchar *dest,
|
|||
dest += 2;
|
||||
}
|
||||
#else
|
||||
shortc = ((guint16 *) color)[0];
|
||||
shortc = ((const guint16 *) color)[0];
|
||||
shortd = (guint16 *) dest;
|
||||
while (w--)
|
||||
{
|
||||
|
@ -143,7 +145,7 @@ color_pixels (guchar *dest,
|
|||
dest += 4;
|
||||
}
|
||||
#else
|
||||
longc = ((guint32 *) color)[0];
|
||||
longc = ((const guint32 *) color)[0];
|
||||
longd = (guint32 *) dest;
|
||||
while (w--)
|
||||
{
|
||||
|
@ -681,7 +683,7 @@ dodge_pixels (const guchar *src1,
|
|||
{
|
||||
tmp = src1[b] << 8;
|
||||
tmp /= 256 - src2[b];
|
||||
dest[b] = (guchar) CLAMP (tmp, 0, 255);
|
||||
dest[b] = (guchar) MIN (tmp, 255);
|
||||
}
|
||||
|
||||
if (has_alpha1 && has_alpha2)
|
||||
|
@ -753,10 +755,10 @@ hardlight_pixels (const guchar *src1,
|
|||
{
|
||||
if (src2[b] > 128) {
|
||||
tmp = ((gint)255 - src1[b]) * ((gint)255 - ((src2[b] - 128) << 1));
|
||||
dest[b] = (guchar)CLAMP(255 - (tmp >> 8), 0, 255);
|
||||
dest[b] = (guchar) MIN (255 - (tmp >> 8), 255);
|
||||
} else {
|
||||
tmp = (gint)src1[b] * ((gint)src2[b] << 1);
|
||||
dest[b] = (guchar)CLAMP(tmp >> 8, 0, 255);
|
||||
dest[b] = (guchar) MIN (tmp >> 8, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -995,7 +995,7 @@ combine_inten_a_and_inten_a_pixels (const guchar *src1,
|
|||
|
||||
if (mask)
|
||||
{
|
||||
const guchar * m = mask;
|
||||
const guchar *m = mask;
|
||||
|
||||
if (opacity == OPAQUE_OPACITY) /* HAS MASK, FULL OPACITY */
|
||||
{
|
||||
|
@ -1038,7 +1038,7 @@ combine_inten_a_and_inten_a_pixels (const guchar *src1,
|
|||
}
|
||||
|
||||
/* BODY */
|
||||
mask_ip = (int*)m;
|
||||
mask_ip = (const gint *)m;
|
||||
i = length / sizeof(int);
|
||||
length %= sizeof(int);
|
||||
while (i--)
|
||||
|
@ -1156,7 +1156,7 @@ combine_inten_a_and_inten_a_pixels (const guchar *src1,
|
|||
}
|
||||
|
||||
/* BODY */
|
||||
mask_ip = (int*)m;
|
||||
mask_ip = (const gint *)m;
|
||||
i = length / sizeof(int);
|
||||
length %= sizeof(int);
|
||||
while (i--)
|
||||
|
|
|
@ -72,10 +72,10 @@ procedural_db_free (Gimp *gimp)
|
|||
|
||||
if (gimp->procedural_ht)
|
||||
{
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
procedural_db_free_entry, NULL);
|
||||
g_hash_table_destroy (gimp->procedural_ht);
|
||||
|
||||
|
||||
gimp->procedural_ht = NULL;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ procedural_db_register (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (procedure != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) procedure->name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
|
||||
list = g_list_prepend (list, (gpointer) procedure);
|
||||
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
|
@ -126,19 +126,16 @@ procedural_db_unregister (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
{
|
||||
list = g_list_remove (list, list->data);
|
||||
|
||||
if (list)
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
(gpointer) name,
|
||||
(gpointer) list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht,
|
||||
(gpointer) name);
|
||||
g_hash_table_insert (gimp->procedural_ht, (gpointer) name, list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +148,7 @@ procedural_db_lookup (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
return (ProcRecord *) list->data;
|
||||
|
@ -170,7 +167,7 @@ procedural_db_execute (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
|
@ -308,7 +305,7 @@ procedural_db_run_proc (Gimp *gimp,
|
|||
|
||||
for (i = 0; i < proc->num_args; i++)
|
||||
{
|
||||
if (proc->args[i].arg_type !=
|
||||
if (proc->args[i].arg_type !=
|
||||
(params[i].arg_type = va_arg (args, GimpPDBArgType)))
|
||||
{
|
||||
g_message (_("PDB calling error for procedure '%s':\n"
|
||||
|
|
|
@ -72,10 +72,10 @@ procedural_db_free (Gimp *gimp)
|
|||
|
||||
if (gimp->procedural_ht)
|
||||
{
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
procedural_db_free_entry, NULL);
|
||||
g_hash_table_destroy (gimp->procedural_ht);
|
||||
|
||||
|
||||
gimp->procedural_ht = NULL;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ procedural_db_register (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (procedure != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) procedure->name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
|
||||
list = g_list_prepend (list, (gpointer) procedure);
|
||||
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
|
@ -126,19 +126,16 @@ procedural_db_unregister (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
{
|
||||
list = g_list_remove (list, list->data);
|
||||
|
||||
if (list)
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
(gpointer) name,
|
||||
(gpointer) list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht,
|
||||
(gpointer) name);
|
||||
g_hash_table_insert (gimp->procedural_ht, (gpointer) name, list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +148,7 @@ procedural_db_lookup (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
return (ProcRecord *) list->data;
|
||||
|
@ -170,7 +167,7 @@ procedural_db_execute (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
|
@ -308,7 +305,7 @@ procedural_db_run_proc (Gimp *gimp,
|
|||
|
||||
for (i = 0; i < proc->num_args; i++)
|
||||
{
|
||||
if (proc->args[i].arg_type !=
|
||||
if (proc->args[i].arg_type !=
|
||||
(params[i].arg_type = va_arg (args, GimpPDBArgType)))
|
||||
{
|
||||
g_message (_("PDB calling error for procedure '%s':\n"
|
||||
|
|
|
@ -72,10 +72,10 @@ procedural_db_free (Gimp *gimp)
|
|||
|
||||
if (gimp->procedural_ht)
|
||||
{
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
procedural_db_free_entry, NULL);
|
||||
g_hash_table_destroy (gimp->procedural_ht);
|
||||
|
||||
|
||||
gimp->procedural_ht = NULL;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ procedural_db_register (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (procedure != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) procedure->name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
|
||||
list = g_list_prepend (list, (gpointer) procedure);
|
||||
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
|
@ -126,19 +126,16 @@ procedural_db_unregister (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
{
|
||||
list = g_list_remove (list, list->data);
|
||||
|
||||
if (list)
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
(gpointer) name,
|
||||
(gpointer) list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht,
|
||||
(gpointer) name);
|
||||
g_hash_table_insert (gimp->procedural_ht, (gpointer) name, list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +148,7 @@ procedural_db_lookup (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
return (ProcRecord *) list->data;
|
||||
|
@ -170,7 +167,7 @@ procedural_db_execute (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
|
@ -308,7 +305,7 @@ procedural_db_run_proc (Gimp *gimp,
|
|||
|
||||
for (i = 0; i < proc->num_args; i++)
|
||||
{
|
||||
if (proc->args[i].arg_type !=
|
||||
if (proc->args[i].arg_type !=
|
||||
(params[i].arg_type = va_arg (args, GimpPDBArgType)))
|
||||
{
|
||||
g_message (_("PDB calling error for procedure '%s':\n"
|
||||
|
|
|
@ -72,10 +72,10 @@ procedural_db_free (Gimp *gimp)
|
|||
|
||||
if (gimp->procedural_ht)
|
||||
{
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
g_hash_table_foreach (gimp->procedural_ht,
|
||||
procedural_db_free_entry, NULL);
|
||||
g_hash_table_destroy (gimp->procedural_ht);
|
||||
|
||||
|
||||
gimp->procedural_ht = NULL;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ procedural_db_register (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (procedure != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) procedure->name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, procedure->name);
|
||||
list = g_list_prepend (list, (gpointer) procedure);
|
||||
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
|
@ -126,19 +126,16 @@ procedural_db_unregister (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
{
|
||||
list = g_list_remove (list, list->data);
|
||||
|
||||
if (list)
|
||||
g_hash_table_insert (gimp->procedural_ht,
|
||||
(gpointer) name,
|
||||
(gpointer) list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht,
|
||||
(gpointer) name);
|
||||
g_hash_table_insert (gimp->procedural_ht, (gpointer) name, list);
|
||||
else
|
||||
g_hash_table_remove (gimp->procedural_ht, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +148,7 @@ procedural_db_lookup (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list)
|
||||
return (ProcRecord *) list->data;
|
||||
|
@ -170,7 +167,7 @@ procedural_db_execute (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, (gpointer) name);
|
||||
list = g_hash_table_lookup (gimp->procedural_ht, name);
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
|
@ -308,7 +305,7 @@ procedural_db_run_proc (Gimp *gimp,
|
|||
|
||||
for (i = 0; i < proc->num_args; i++)
|
||||
{
|
||||
if (proc->args[i].arg_type !=
|
||||
if (proc->args[i].arg_type !=
|
||||
(params[i].arg_type = va_arg (args, GimpPDBArgType)))
|
||||
{
|
||||
g_message (_("PDB calling error for procedure '%s':\n"
|
||||
|
|
|
@ -61,7 +61,8 @@ static void gimp_text_layout_render_glyphs (GimpTextLayout *layout,
|
|||
gint y,
|
||||
gpointer render_data);
|
||||
static FT_Int32 gimp_text_layout_render_flags (GimpTextLayout *layout);
|
||||
static FT_Matrix gimp_text_layout_render_trafo (GimpTextLayout *layout);
|
||||
static void gimp_text_layout_render_trafo (GimpTextLayout *layout,
|
||||
FT_Matrix *trafo);
|
||||
|
||||
|
||||
|
||||
|
@ -150,7 +151,7 @@ gimp_text_layout_render_glyphs (GimpTextLayout *layout,
|
|||
gint x_position = 0;
|
||||
|
||||
flags = gimp_text_layout_render_flags (layout);
|
||||
trafo = gimp_text_layout_render_trafo (layout);
|
||||
gimp_text_layout_render_trafo (layout, &trafo);
|
||||
|
||||
for (i = 0, gi = glyphs->glyphs; i < glyphs->num_glyphs; i++, gi++)
|
||||
{
|
||||
|
@ -190,16 +191,14 @@ gimp_text_layout_render_flags (GimpTextLayout *layout)
|
|||
return flags;
|
||||
}
|
||||
|
||||
static FT_Matrix
|
||||
gimp_text_layout_render_trafo (GimpTextLayout *layout)
|
||||
static void
|
||||
gimp_text_layout_render_trafo (GimpTextLayout *layout,
|
||||
FT_Matrix *trafo)
|
||||
{
|
||||
GimpText *text = layout->text;
|
||||
FT_Matrix trafo;
|
||||
GimpText *text = layout->text;
|
||||
|
||||
trafo.xx = text->transformation.coeff[0][0] * 65536.0;
|
||||
trafo.xy = text->transformation.coeff[0][1] * 65536.0;
|
||||
trafo.yx = text->transformation.coeff[1][0] * 65536.0;
|
||||
trafo.yy = text->transformation.coeff[1][1] * 65536.0;
|
||||
|
||||
return trafo;
|
||||
trafo->xx = text->transformation.coeff[0][0] * 65536.0;
|
||||
trafo->xy = text->transformation.coeff[0][1] * 65536.0;
|
||||
trafo->yx = text->transformation.coeff[1][0] * 65536.0;
|
||||
trafo->yy = text->transformation.coeff[1][1] * 65536.0;
|
||||
}
|
||||
|
|
|
@ -343,7 +343,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
/* don't let the events come in too fast, ignore below a delay of 100 ms */
|
||||
if (ABS (time - last_time) < 100)
|
||||
if (time - last_time < 100)
|
||||
return;
|
||||
|
||||
last_time = time;
|
||||
|
|
|
@ -343,7 +343,7 @@ gimp_fuzzy_select_tool_motion (GimpTool *tool,
|
|||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
/* don't let the events come in too fast, ignore below a delay of 100 ms */
|
||||
if (ABS (time - last_time) < 100)
|
||||
if (time - last_time < 100)
|
||||
return;
|
||||
|
||||
last_time = time;
|
||||
|
|
|
@ -464,10 +464,9 @@ gimp_cursor_new (GimpCursorType cursor_type,
|
|||
|
||||
/* prepare the tool cursor */
|
||||
|
||||
if (tool_cursor < GIMP_TOOL_CURSOR_NONE ||
|
||||
tool_cursor >= GIMP_LAST_STOCK_TOOL_CURSOR_ENTRY)
|
||||
if (tool_cursor >= GIMP_LAST_STOCK_TOOL_CURSOR_ENTRY)
|
||||
{
|
||||
tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
||||
tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
||||
}
|
||||
|
||||
if (tool_cursor != GIMP_TOOL_CURSOR_NONE)
|
||||
|
@ -480,8 +479,7 @@ gimp_cursor_new (GimpCursorType cursor_type,
|
|||
|
||||
/* prepare the cursor modifier */
|
||||
|
||||
if (modifier < GIMP_CURSOR_MODIFIER_NONE ||
|
||||
modifier >= GIMP_LAST_CURSOR_MODIFIER_ENTRY)
|
||||
if (modifier >= GIMP_LAST_CURSOR_MODIFIER_ENTRY)
|
||||
{
|
||||
modifier = GIMP_CURSOR_MODIFIER_NONE;
|
||||
}
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* All functions return G_TOKEN_RIGHT_PAREN on success,
|
||||
* the GTokenType they would have expected but didn't get
|
||||
* or G_TOKEN_NONE if they got the expected token but
|
||||
* couldn't parse it.
|
||||
*/
|
||||
|
||||
|
||||
static GTokenType gimp_config_deserialize_unknown (GObject *object,
|
||||
GScanner *scanner);
|
||||
static GTokenType gimp_config_deserialize_property (GObject *object,
|
||||
|
@ -94,7 +94,7 @@ static GTokenType gimp_config_deserialize_any (GValue *value,
|
|||
GParamSpec *prop_spec,
|
||||
GScanner *scanner);
|
||||
|
||||
static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
||||
static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
||||
const gchar *token_name);
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
|||
* @scanner: a #GScanner.
|
||||
* @nest_level:
|
||||
* @store_unknown_tokens: %TRUE if you want to store unknown tokens.
|
||||
*
|
||||
*
|
||||
* This function uses the @scanner to configure the properties of @object.
|
||||
*
|
||||
* The store_unknown_tokens parameter is a special feature for #GimpRc.
|
||||
|
@ -112,8 +112,8 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
|
|||
* a property of @object) with string values are attached to @object as
|
||||
* unknown tokens. GimpConfig has a couple of functions to handle the
|
||||
* attached key/value pairs.
|
||||
*
|
||||
* Return value:
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
gboolean
|
||||
gimp_config_deserialize_properties (GObject *object,
|
||||
|
@ -147,7 +147,7 @@ gimp_config_deserialize_properties (GObject *object,
|
|||
|
||||
if (prop_spec->flags & GIMP_PARAM_SERIALIZE)
|
||||
{
|
||||
g_scanner_scope_add_symbol (scanner, scope_id,
|
||||
g_scanner_scope_add_symbol (scanner, scope_id,
|
||||
prop_spec->name, prop_spec);
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ gimp_config_deserialize_properties (GObject *object,
|
|||
}
|
||||
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
|
||||
|
||||
switch (token)
|
||||
{
|
||||
case G_TOKEN_LEFT_PAREN:
|
||||
|
@ -209,7 +209,7 @@ gimp_config_deserialize_properties (GObject *object,
|
|||
_("fatal parse error"), TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return gimp_config_deserialize_return (scanner, token, nest_level);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ gimp_config_deserialize_unknown (GObject *object,
|
|||
key = g_strdup (scanner->value.v_identifier);
|
||||
|
||||
g_scanner_get_next_token (scanner);
|
||||
|
||||
|
||||
if (!scanner_string_utf8_valid (scanner, key))
|
||||
{
|
||||
g_free (key);
|
||||
|
@ -309,18 +309,18 @@ gimp_config_deserialize_property (GObject *object,
|
|||
(prop_spec->flags & GIMP_PARAM_AGGREGATE)))
|
||||
g_object_set_property (object, prop_spec->name, &value);
|
||||
}
|
||||
#if CONFIG_DEBUG
|
||||
#ifdef CONFIG_DEBUG
|
||||
else
|
||||
{
|
||||
g_warning ("couldn't deserialize property %s::%s of type %s",
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (object)),
|
||||
prop_spec->name,
|
||||
prop_spec->name,
|
||||
g_type_name (prop_spec->value_type));
|
||||
}
|
||||
#endif
|
||||
|
||||
g_value_unset (&value);
|
||||
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
|
@ -382,11 +382,11 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
case G_TYPE_STRING:
|
||||
token = G_TOKEN_STRING;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_BOOLEAN:
|
||||
token = G_TOKEN_IDENTIFIER;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_INT:
|
||||
case G_TYPE_LONG:
|
||||
if (g_scanner_peek_next_token (scanner) == '-')
|
||||
|
@ -399,12 +399,12 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
case G_TYPE_ULONG:
|
||||
token = G_TOKEN_INT;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_FLOAT:
|
||||
case G_TYPE_DOUBLE:
|
||||
token = G_TOKEN_FLOAT;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
token = G_TOKEN_NONE;
|
||||
g_assert_not_reached ();
|
||||
|
@ -426,7 +426,7 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
else
|
||||
return G_TOKEN_NONE;
|
||||
break;
|
||||
|
||||
|
||||
case G_TYPE_BOOLEAN:
|
||||
if (! g_ascii_strcasecmp (scanner->value.v_identifier, "yes") ||
|
||||
! g_ascii_strcasecmp (scanner->value.v_identifier, "true"))
|
||||
|
@ -436,10 +436,10 @@ gimp_config_deserialize_fundamental (GValue *value,
|
|||
g_value_set_boolean (value, FALSE);
|
||||
else
|
||||
{
|
||||
g_scanner_error
|
||||
(scanner,
|
||||
g_scanner_error
|
||||
(scanner,
|
||||
/* please don't translate 'yes' and 'no' */
|
||||
_("expected 'yes' or 'no' for boolean token %s, got '%s'"),
|
||||
_("expected 'yes' or 'no' for boolean token %s, got '%s'"),
|
||||
prop_spec->name, scanner->value.v_identifier);
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
@ -489,21 +489,21 @@ gimp_config_deserialize_enum (GValue *value,
|
|||
case G_TOKEN_IDENTIFIER:
|
||||
g_scanner_get_next_token (scanner);
|
||||
|
||||
enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (enum_class),
|
||||
enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (enum_class),
|
||||
scanner->value.v_identifier);
|
||||
if (!enum_value)
|
||||
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
|
||||
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
|
||||
scanner->value.v_identifier);
|
||||
|
||||
if (!enum_value)
|
||||
{
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%s' for token %s"),
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%s' for token %s"),
|
||||
scanner->value.v_identifier, prop_spec->name);
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case G_TOKEN_INT:
|
||||
g_scanner_get_next_token (scanner);
|
||||
|
||||
|
@ -511,17 +511,17 @@ gimp_config_deserialize_enum (GValue *value,
|
|||
|
||||
if (!enum_value)
|
||||
{
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%ld' for token %s"),
|
||||
g_scanner_error (scanner,
|
||||
_("invalid value '%ld' for token %s"),
|
||||
scanner->value.v_int, prop_spec->name);
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return G_TOKEN_IDENTIFIER;
|
||||
}
|
||||
|
||||
|
||||
g_value_set_enum (value, enum_value->value);
|
||||
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
|
@ -537,7 +537,7 @@ gimp_config_deserialize_memsize (GValue *value,
|
|||
|
||||
scanner->config->cset_identifier_first = G_CSET_DIGITS;
|
||||
scanner->config->cset_identifier_nth = G_CSET_DIGITS "gGmMkKbB";
|
||||
|
||||
|
||||
if (g_scanner_peek_next_token (scanner) != G_TOKEN_IDENTIFIER)
|
||||
return G_TOKEN_IDENTIFIER;
|
||||
|
||||
|
@ -545,7 +545,7 @@ gimp_config_deserialize_memsize (GValue *value,
|
|||
|
||||
scanner->config->cset_identifier_first = orig_cset_first;
|
||||
scanner->config->cset_identifier_nth = orig_cset_nth;
|
||||
|
||||
|
||||
if (gimp_memsize_set_from_string (value, scanner->value.v_identifier))
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
else
|
||||
|
@ -581,10 +581,10 @@ gimp_config_deserialize_path (GValue *value,
|
|||
_("while parsing token %s: %s"),
|
||||
prop_spec->name, error->message);
|
||||
g_error_free (error);
|
||||
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
|
||||
g_free (expand);
|
||||
|
||||
g_value_set_static_string (value, scanner->value.v_string);
|
||||
|
@ -644,7 +644,7 @@ gimp_config_deserialize_object (GValue *value,
|
|||
|
||||
if (! gimp_config_iface)
|
||||
return gimp_config_deserialize_any (value, prop_spec, scanner);
|
||||
|
||||
|
||||
if (! gimp_config_iface->deserialize (prop_object,
|
||||
scanner, nest_level + 1, NULL))
|
||||
return G_TOKEN_NONE;
|
||||
|
@ -723,14 +723,14 @@ gimp_config_deserialize_any (GValue *value,
|
|||
}
|
||||
|
||||
static inline gboolean
|
||||
scanner_string_utf8_valid (GScanner *scanner,
|
||||
scanner_string_utf8_valid (GScanner *scanner,
|
||||
const gchar *token_name)
|
||||
{
|
||||
if (g_utf8_validate (scanner->value.v_string, -1, NULL))
|
||||
return TRUE;
|
||||
|
||||
g_scanner_error (scanner,
|
||||
_("value for token %s is not a valid UTF-8 string"),
|
||||
g_scanner_error (scanner,
|
||||
_("value for token %s is not a valid UTF-8 string"),
|
||||
token_name);
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
static inline gchar * extract_token (const gchar **str);
|
||||
|
||||
|
||||
gchar *
|
||||
gchar *
|
||||
gimp_config_path_expand (const gchar *path,
|
||||
gboolean recode,
|
||||
GError **error)
|
||||
|
@ -47,7 +47,7 @@ gimp_config_path_expand (const gchar *path,
|
|||
const gchar *s;
|
||||
gchar *n;
|
||||
gchar *token;
|
||||
gchar *filename;
|
||||
gchar *filename = NULL;
|
||||
gchar *expanded = NULL;
|
||||
gchar **substs = NULL;
|
||||
guint n_substs = 0;
|
||||
|
@ -61,13 +61,15 @@ gimp_config_path_expand (const gchar *path,
|
|||
{
|
||||
if (!(filename = g_filename_from_utf8 (path, -1, NULL, NULL, error)))
|
||||
return NULL;
|
||||
|
||||
p = filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (gchar *) path;
|
||||
p = path;
|
||||
}
|
||||
|
||||
for (p = filename; *p; )
|
||||
while (*p)
|
||||
{
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
|
@ -84,7 +86,7 @@ gimp_config_path_expand (const gchar *path,
|
|||
for (i = 0; i < n_substs; i++)
|
||||
if (strcmp (substs[2*i], token) == 0)
|
||||
break;
|
||||
|
||||
|
||||
if (i < n_substs)
|
||||
{
|
||||
s = substs[2*i+1];
|
||||
|
@ -95,21 +97,21 @@ gimp_config_path_expand (const gchar *path,
|
|||
|
||||
if (!s && strcmp (token, "gimp_dir") == 0)
|
||||
s = gimp_directory ();
|
||||
|
||||
|
||||
if (!s && strcmp (token, "gimp_data_dir") == 0)
|
||||
s = gimp_data_directory ();
|
||||
|
||||
if (!s &&
|
||||
((strcmp (token, "gimp_plug_in_dir")) == 0 ||
|
||||
|
||||
if (!s &&
|
||||
((strcmp (token, "gimp_plug_in_dir")) == 0 ||
|
||||
(strcmp (token, "gimp_plugin_dir")) == 0))
|
||||
s = gimp_plug_in_directory ();
|
||||
|
||||
|
||||
if (!s && strcmp (token, "gimp_sysconf_dir") == 0)
|
||||
s = gimp_sysconf_directory ();
|
||||
|
||||
|
||||
if (!s)
|
||||
s = g_getenv (token);
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* The default user gimprc on Windows references
|
||||
* ${TEMP}, but not all Windows installations have that
|
||||
|
@ -120,32 +122,32 @@ gimp_config_path_expand (const gchar *path,
|
|||
s = g_get_tmp_dir ();
|
||||
#endif /* G_OS_WIN32 */
|
||||
}
|
||||
|
||||
|
||||
if (!s)
|
||||
{
|
||||
g_set_error (error, 0, 0, _("can not expand ${%s}"), token);
|
||||
g_free (token);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
if (n_substs % SUBSTS_ALLOC == 0)
|
||||
substs = g_renew (gchar *, substs, 2 * (n_substs + SUBSTS_ALLOC));
|
||||
|
||||
|
||||
substs[2*n_substs] = token;
|
||||
substs[2*n_substs + 1] = (gchar *) s;
|
||||
n_substs++;
|
||||
|
||||
|
||||
length += strlen (s);
|
||||
}
|
||||
else
|
||||
{
|
||||
length += g_utf8_skip[(guchar) *p];
|
||||
length += g_utf8_skip[(const guchar) *p];
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
}
|
||||
|
||||
if (n_substs == 0)
|
||||
return recode ? filename : g_strdup (filename);
|
||||
return recode ? filename : g_strdup (path);
|
||||
|
||||
expanded = g_new (gchar, length + 1);
|
||||
|
||||
|
@ -197,11 +199,9 @@ gimp_config_path_expand (const gchar *path,
|
|||
g_free (substs[2*i]);
|
||||
|
||||
g_free (substs);
|
||||
g_free (filename);
|
||||
|
||||
if (recode)
|
||||
g_free (filename);
|
||||
|
||||
return expanded;
|
||||
return expanded;
|
||||
}
|
||||
|
||||
static inline gchar *
|
||||
|
@ -223,7 +223,7 @@ extract_token (const gchar **str)
|
|||
|
||||
token = g_strndup (*str + 2, g_utf8_pointer_to_offset (*str + 2, p));
|
||||
|
||||
*str = p + 1; /* after the closing bracket */
|
||||
*str = p + 1; /* after the closing bracket */
|
||||
|
||||
return token;
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ static void serialize_unknown_token (const gchar *key,
|
|||
|
||||
/**
|
||||
* gimp_config_serialize_properties:
|
||||
* @object: a #GObject.
|
||||
* @object: a #GObject.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* This function writes all object properties to the @writer.
|
||||
*
|
||||
* Returns: %TRUE if serialization succeeded, %FALSE otherwise
|
||||
|
@ -71,7 +71,7 @@ gimp_config_serialize_properties (GObject *object,
|
|||
guint i;
|
||||
|
||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (object);
|
||||
|
||||
property_specs = g_object_class_list_properties (klass, &n_property_specs);
|
||||
|
@ -97,9 +97,9 @@ gimp_config_serialize_properties (GObject *object,
|
|||
|
||||
/**
|
||||
* gimp_config_serialize_changed_properties:
|
||||
* @object: a #GObject.
|
||||
* @object: a #GObject.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* This function writes all object properties that have been changed from
|
||||
* their default values to the @writer.
|
||||
*
|
||||
|
@ -150,10 +150,10 @@ gimp_config_serialize_changed_properties (GObject *object,
|
|||
|
||||
/**
|
||||
* gimp_config_serialize_properties_diff:
|
||||
* @object: a #GObject.
|
||||
* @compare: a #GObject of the same type as @object.
|
||||
* @object: a #GObject.
|
||||
* @compare: a #GObject of the same type as @object.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* This function compares @object and @compare and writes all
|
||||
* properties of @object that have different values than @compare to
|
||||
* the @writer.
|
||||
|
@ -171,7 +171,7 @@ gimp_config_serialize_properties_diff (GObject *object,
|
|||
|
||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||
g_return_val_if_fail (G_IS_OBJECT (compare), FALSE);
|
||||
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (object) ==
|
||||
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (object) ==
|
||||
G_TYPE_FROM_INSTANCE (compare), FALSE);
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (object);
|
||||
|
@ -311,7 +311,7 @@ gimp_config_serialize_property (GObject *object,
|
|||
{
|
||||
g_warning ("couldn't serialize property %s::%s of type %s",
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (object)),
|
||||
param_spec->name,
|
||||
param_spec->name,
|
||||
g_type_name (param_spec->value_type));
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ gimp_config_serialize_property (GObject *object,
|
|||
* @escaped: whether to escape string values.
|
||||
*
|
||||
* This utility function appends a string representation of #GValue to @str.
|
||||
*
|
||||
*
|
||||
* Return value: %TRUE if serialization succeeded, %FALSE otherwise.
|
||||
**/
|
||||
gboolean
|
||||
|
@ -340,17 +340,17 @@ gimp_config_serialize_value (const GValue *value,
|
|||
if (G_VALUE_HOLDS_BOOLEAN (value))
|
||||
{
|
||||
gboolean bool;
|
||||
|
||||
|
||||
bool = g_value_get_boolean (value);
|
||||
g_string_append (str, bool ? "yes" : "no");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (G_VALUE_HOLDS_ENUM (value))
|
||||
{
|
||||
GEnumClass *enum_class;
|
||||
GEnumValue *enum_value;
|
||||
|
||||
|
||||
enum_class = g_type_class_peek (G_VALUE_TYPE (value));
|
||||
enum_value = g_enum_get_value (G_ENUM_CLASS (enum_class),
|
||||
g_value_get_enum (value));
|
||||
|
@ -362,12 +362,12 @@ gimp_config_serialize_value (const GValue *value,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Couldn't get nick for enum_value of %s",
|
||||
g_warning ("Couldn't get nick for enum_value of %s",
|
||||
G_ENUM_CLASS_TYPE_NAME (enum_class));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (G_VALUE_HOLDS_STRING (value))
|
||||
{
|
||||
const gchar *cstr = g_value_get_string (value);
|
||||
|
@ -466,7 +466,7 @@ gimp_config_serialize_value (const GValue *value,
|
|||
if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
|
||||
{
|
||||
GValue tmp_value = { 0, };
|
||||
|
||||
|
||||
g_value_init (&tmp_value, G_TYPE_STRING);
|
||||
g_value_transform (value, &tmp_value);
|
||||
|
||||
|
@ -475,7 +475,7 @@ gimp_config_serialize_value (const GValue *value,
|
|||
g_value_unset (&tmp_value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ gimp_config_serialize_value (const GValue *value,
|
|||
* gimp_config_serialize_unknown_tokens:
|
||||
* @object: a #GObject.
|
||||
* @writer: a #GimpConfigWriter.
|
||||
*
|
||||
*
|
||||
* Writes all unknown tokens attached to #object to the @writer. See
|
||||
* gimp_config_add_unknown_token().
|
||||
*
|
||||
|
@ -509,7 +509,7 @@ gimp_config_serialize_unknown_tokens (GObject *object,
|
|||
* gimp_config_serialize_comment:
|
||||
* @str: a #GString.
|
||||
* @comment: the comment to serialize (ASCII only)
|
||||
*
|
||||
*
|
||||
* Appends the @comment to @str and inserts linebreaks and hash-marks to
|
||||
* format it as a comment. Note that this function does not handle non-ASCII
|
||||
* characters.
|
||||
|
|
Loading…
Reference in a new issue