annotate src/mediastreamer/affine.c @ 12116:e75ef7aa913e

[gaim-migrate @ 14416] " This patch implements a replacement for the queuing system from 1.x. It also obsoletes a previous patch [#1338873] I submitted to prioritize the unseen states in gtk conversations. The attached envelope.png is ripped from the msgunread.png already included in gaim. It should be dropped in the pixmaps directory (Makefile.am is updated accordingly in this patch). The two separate queuing preferences from 1.x, queuing messages while away and queuing all new messages (from docklet), are replaced with a single 3-way preference for conversations. The new preference is "Hide new IM conversations". This preference can be set to never, away and always. When a gtk conversation is created, it may be placed in a hidden conversation window instead of being placed normally. This decision is based upon the preference and possibly the away state of the account the conversation is being created for. This *will* effect conversations the user explicitly requests to be created, so in these cases the caller must be sure to present the conversation to the user, using gaim_gtkconv_present_conversation(). This is done already in gtkdialogs.c which handles creating conversations requested by the user from gaim proper (menus, double-clicking on budy in blist, etc.). The main advantage to not queuing messages is that the conversations exist, the message is written to the conversation (and logged if appropriate) and the unseen state is set on the conversation. This means no additional features are needed to track whether there are queued messages or not, just use the unseen state on conversations. Since conversations may not be visible (messages "queued"), gaim proper needs some notification that there are messages waiting. I opted for a menutray icon that shows up when an im conversation has an unseen message. Clicking this icon will focus (and show if hidden) the first conversation with an unseen message. This is essentially the same behavior of the docklet in cvs right now, except that the icon is only visible when there is a conversation with an unread message. The api that is added is flexible enough to allow either the docklet or the new blist menutray icon to be visible for conversations of any/all types and for unseen messages >= any state. Currently they are set to only IM conversations and only unseen states >= TEXT (system messages and no log messages will not trigger blinking the docklet or showing the blist tray icon), but these could be made preferences relatively easily in the future. Other plugins could probably benefit as well: gaim_gtk_conversations_get_first_unseen(). There is probably some limit to comment size, so I'll stop rambling now. If anyone has more questions/comments, catch me in #gaim, here or on gaim-devel." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 16 Nov 2005 18:17:01 +0000
parents e67993da8a22
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12024
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * affine.c -- Affine Transforms for 2d objects
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2002 Charles Yates <charles.yates@pandora.be>
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * Portions Copyright (C) 2003 Dan Dennedy <dan@dennedy.org>
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * ported from C++ to C
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * wrote affine_scale()
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software Foundation,
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "affine.h"
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 static inline void Multiply( affine_transform_t *this, affine_transform_t *that )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 double output[2][2];
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 register int i, j;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 for ( i = 0; i < 2; i ++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 for ( j = 0; j < 2; j ++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 output[ i ][ j ] = this->matrix[ i ][ 0 ] * that->matrix[ j ][ 0 ] +
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 this->matrix[ i ][ 1 ] * that->matrix[ j ][ 1 ];
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 this->matrix[ 0 ][ 0 ] = output[ 0 ][ 0 ];
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 this->matrix[ 0 ][ 1 ] = output[ 0 ][ 1 ];
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 this->matrix[ 1 ][ 0 ] = output[ 1 ][ 0 ];
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 this->matrix[ 1 ][ 1 ] = output[ 1 ][ 1 ];
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 void affine_transform_init( affine_transform_t *this )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 this->matrix[ 0 ][ 0 ] = 1;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 this->matrix[ 0 ][ 1 ] = 0;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 this->matrix[ 1 ][ 0 ] = 0;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 this->matrix[ 1 ][ 1 ] = 1;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 // Rotate by a given angle
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 void affine_transform_rotate( affine_transform_t *this, double angle )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 affine_transform_t affine;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 affine.matrix[ 0 ][ 0 ] = cos( angle * M_PI / 180 );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 affine.matrix[ 0 ][ 1 ] = 0 - sin( angle * M_PI / 180 );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 affine.matrix[ 1 ][ 0 ] = sin( angle * M_PI / 180 );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 affine.matrix[ 1 ][ 1 ] = cos( angle * M_PI / 180 );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 Multiply( this, &affine );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 // Shear by a given value
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 void affine_transform_shear( affine_transform_t *this, double shear )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 affine_transform_t affine;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 affine.matrix[ 0 ][ 0 ] = 1;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 affine.matrix[ 0 ][ 1 ] = shear;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 affine.matrix[ 1 ][ 0 ] = 0;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 affine.matrix[ 1 ][ 1 ] = 1;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 Multiply( this, &affine );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 void affine_transform_scale( affine_transform_t *this, double sx, double sy )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 affine_transform_t affine;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 affine.matrix[ 0 ][ 0 ] = sx;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 affine.matrix[ 0 ][ 1 ] = 0;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 affine.matrix[ 1 ][ 0 ] = 0;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 affine.matrix[ 1 ][ 1 ] = sy;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 Multiply( this, &affine );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 // Obtain the mapped x coordinate of the input
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 double affine_transform_mapx( affine_transform_t *this, int x, int y )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 return this->matrix[0][0] * x + this->matrix[0][1] * y;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 // Obtain the mapped y coordinate of the input
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 double affine_transform_mapy( affine_transform_t *this, int x, int y )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 return this->matrix[1][0] * x + this->matrix[1][1] * y;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 void affine_scale( const unsigned char *src, unsigned char *dest, int src_width, int src_height, int dest_width, int dest_height, int bpp )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 affine_transform_t affine;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 double scale_x = (double) dest_width / (double) src_width;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 double scale_y = (double) dest_height / (double) src_height;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 register unsigned char *d = dest;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 register const unsigned char *s = src;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 register int i, j, k, x, y;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 affine_transform_init( &affine );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 if ( scale_x <= 1.0 && scale_y <= 1.0 )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 affine_transform_scale( &affine, scale_x, scale_y );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 for( j = 0; j < src_height; j++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 for( i = 0; i < src_width; i++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 x = (int) ( affine_transform_mapx( &affine, i - src_width/2, j - src_height/2 ) );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 y = (int) ( affine_transform_mapy( &affine, i - src_width/2, j - src_height/2 ) );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 x += dest_width/2;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 x = CLAMP( x, 0, dest_width);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 y += dest_height/2;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 y = CLAMP( y, 0, dest_height);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 s = src + (j*src_width*bpp) + i*bpp; // + (bpp-1);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 d = dest + y*dest_width*bpp + x*bpp;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 for ( k = 0; k < bpp; k++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 *d++ = *s++;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 else if ( scale_x > 1.0 && scale_y > 1.0 )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 affine_transform_scale( &affine, 1.0/scale_x, 1.0/scale_y );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 for( y = 0; y < dest_height; y++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 for( x = 0; x < dest_width; x++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 i = (int) ( affine_transform_mapx( &affine, x - dest_width/2, y - dest_height/2 ) );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 j = (int) ( affine_transform_mapy( &affine, x - dest_width/2, y - dest_height/2 ) );
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 i += src_width/2;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 i = CLAMP( i, 0, dest_width);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 j += src_height/2;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 j = CLAMP( j, 0, dest_height);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 s = src + (j*src_width*bpp) + i*bpp; // + (bpp-1);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 d = dest + y*dest_width*bpp + x*bpp;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 for ( k = 0; k < bpp; k++ )
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 *d++ = *s++;
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 }