summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/pixops
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-05-07 15:58:47 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-05-07 15:58:47 +0000
commitb4e4a0ed9d66132efad0539bc5901b35ea262d88 (patch)
tree7eea37afc0c2f32334112872547373758ac7d6b6 /gdk-pixbuf/pixops
parent607ac1e1b31dc21598830a22930bcc39a77cb5c3 (diff)
downloadgtk+-b4e4a0ed9d66132efad0539bc5901b35ea262d88.tar.gz
fix some shell typos
2001-05-04 Havoc Pennington <hp@redhat.com> * configure.in: fix some shell typos * gtk/gtkcolorsel.c (gtk_color_selection_destroy): warning fix * gtk/gtkimage.c: handle animations * gtk/gtkcheckbutton.c (gtk_check_button_size_request): request border_width * 2, not just border_width * gtk/gtkscale.c: add "format_value" signal to allow people to override the way values are drawn. (gtk_scale_get_value_size): fix width/height mistake, and compute size from actual displayed text, not from made-up text. * gtk/gtktexttag.c (gtk_text_tag_class_init): fix return type in signal registration * tests/testtext.c: Add "Remove all tags" menu item for testing * gtk/gtktextbuffer.c (gtk_text_buffer_remove_all_tags): implement * demos/gtk-demo/main.c (main): add hack so we can find modules without installing gtk * demos/gtk-demo/textview.c (insert_text): demo font scaling * gtk/gtkcellrenderertext.c: Add "scale" property (font scaling factor) (gtk_cell_renderer_text_set_property): remove some bogus g_object_notify * gtk/gtktexttag.c: add "scale" property which is a font scaling factor * gtk/gtktextlayout.c (add_text_attrs): add font scale attribute to layout * gtk/gtktextiter.c (gtk_text_iter_is_start): rename from gtk_text_iter_is_first 2001-05-04 Havoc Pennington <hp@redhat.com> * pixops/pixops.c (pixops_process): merge fix from stable: Patch from hoshem@mel.comcen.com.au to fix nonzero X offsets. Fixes bug #50371. * gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest): merge from stable: Patch from OKADA Mitsuru <m-okada@fjb.co.jp> to fix confusion of using "src" instead of "p". (pixops_composite_color_nearest): Use a more accurate (and correct, to begin with) compositing method. This cures checks showing through on images with no alpha. * gdk-pixbuf.c (gdk_pixbuf_fill): fix bug that left some trailing bytes unfilled. * gdk-pixbuf-io.h: fix UpdatedNotifyFunc to use signed ints * gdk-pixbuf-loader.h (struct _GdkPixbufLoaderClass): Change area_updated signal to use signed ints. Removed animation-related signals. * io-gif.c, io-gif-animation.h, io-gif-animation.c: Massive rewrite action * gdk-pixbuf-animation.c: Add GdkPixbufAnimationIter to abstract all the pesky details. Remove old frame-based API. Make GdkPixbufAnimation an abstract base class, derived by the loaders.
Diffstat (limited to 'gdk-pixbuf/pixops')
-rw-r--r--gdk-pixbuf/pixops/pixops.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
index ea19607153..7a13e043ba 100644
--- a/gdk-pixbuf/pixops/pixops.c
+++ b/gdk-pixbuf/pixops/pixops.c
@@ -1,4 +1,5 @@
#include <math.h>
+#include <glib.h>
#include "config.h"
#include "pixops.h"
@@ -93,6 +94,7 @@ pixops_scale_nearest (guchar *dest_buf,
for (i = 0; i < (render_y1 - render_y0); i++)
{
const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
+ /* FIXME Owen needs to look at this */
guchar *dest = dest_buf + i * dest_rowstride;
x = render_x0 * x_step + x_step / 2;
@@ -160,7 +162,6 @@ pixops_composite_nearest (guchar *dest_buf,
for (i = 0; i < (render_y1 - render_y0); i++)
{
const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
- /* FIXME Owen needs to look at this */
guchar *dest = dest_buf + i * dest_rowstride;
x = render_x0 * x_step + x_step / 2;
@@ -183,9 +184,9 @@ pixops_composite_nearest (guchar *dest_buf,
if (w != 0)
{
- dest[0] = (w0 * src[0] + w1 * dest[0]) / w;
- dest[1] = (w0 * src[1] + w1 * dest[1]) / w;
- dest[2] = (w0 * src[2] + w1 * dest[2]) / w;
+ dest[0] = (w0 * p[0] + w1 * dest[0]) / w;
+ dest[1] = (w0 * p[1] + w1 * dest[1]) / w;
+ dest[2] = (w0 * p[2] + w1 * dest[2]) / w;
dest[3] = w / 0xff;
}
else
@@ -274,25 +275,39 @@ pixops_composite_color_nearest (guchar *dest_buf,
for (j=0 ; j < (render_x1 - render_x0); j++)
{
const guchar *p = src + (x >> SCALE_SHIFT) * src_channels;
- unsigned int a0;
+ int a0;
+ int tmp;
if (src_has_alpha)
a0 = (p[3] * overall_alpha + 0xff) >> 8;
else
a0 = overall_alpha;
- if (((j + check_x) >> check_shift) & 1)
+ if (a0 == 255)
{
- dest[0] = r2 + ((a0 * ((int)p[0] - r2) + 0xff) >> 8);
- dest[1] = g2 + ((a0 * ((int)p[1] - g2) + 0xff) >> 8);
- dest[2] = b2 + ((a0 * ((int)p[2] - b2) + 0xff) >> 8);
+ dest[0] = p[0];
+ dest[1] = p[1];
+ dest[2] = p[2];
}
else
- {
- dest[0] = r1 + ((a0 * ((int)p[0] - r1) + 0xff) >> 8);
- dest[1] = g1 + ((a0 * ((int)p[1] - g1) + 0xff) >> 8);
- dest[2] = b1 + ((a0 * ((int)p[2] - b1) + 0xff) >> 8);
- }
+ if (((j + check_x) >> check_shift) & 1)
+ {
+ tmp = ((int) p[0] - r2) * a0;
+ dest[0] = r2 + ((tmp + (tmp >> 8) + 0x80) >> 8);
+ tmp = ((int) p[1] - g2) * a0;
+ dest[1] = g2 + ((tmp + (tmp >> 8) + 0x80) >> 8);
+ tmp = ((int) p[2] - b2) * a0;
+ dest[2] = b2 + ((tmp + (tmp >> 8) + 0x80) >> 8);
+ }
+ else
+ {
+ tmp = ((int) p[0] - r1) * a0;
+ dest[0] = r1 + ((tmp + (tmp >> 8) + 0x80) >> 8);
+ tmp = ((int) p[1] - g1) * a0;
+ dest[1] = g1 + ((tmp + (tmp >> 8) + 0x80) >> 8);
+ tmp = ((int) p[2] - b1) * a0;
+ dest[2] = b1 + ((tmp + (tmp >> 8) + 0x80) >> 8);
+ }
if (dest_channels == 4)
dest[3] = 0xff;
@@ -1003,7 +1018,7 @@ pixops_process (guchar *dest_buf,
dest_x += (new_outbuf - outbuf) / dest_channels;
- x = dest_x * x_step + scaled_x_offset;
+ x = (dest_x - check_x + render_x0) * x_step + scaled_x_offset;
outbuf = new_outbuf;
while (outbuf < outbuf_end)