ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtimg.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtimg.C (file contents):
Revision 1.17 by root, Mon Jun 4 18:17:25 2012 UTC vs.
Revision 1.18 by sf-exg, Tue Jun 5 12:30:37 2012 UTC

201} 201}
202 202
203bool 203bool
204rxvt_img::render_pixbuf (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y) 204rxvt_img::render_pixbuf (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y)
205{ 205{
206 bool argb = format->id == PictStandardARGB32;
207
208 Display *dpy = s->display->dpy; 206 Display *dpy = s->display->dpy;
209 207
210 if (s->visual->c_class != TrueColor) 208 if (s->visual->c_class != TrueColor)
211 return false; 209 return false;
212 210
213 uint32_t red_mask, green_mask, blue_mask, alpha_mask; 211 uint32_t red_mask, green_mask, blue_mask, alpha_mask;
214 212
215 if (argb) 213 red_mask = (uint32_t)format->direct.redMask << format->direct.red;
216 { 214 green_mask = (uint32_t)format->direct.greenMask << format->direct.green;
217 red_mask = 0xff << 16; 215 blue_mask = (uint32_t)format->direct.blueMask << format->direct.blue;
218 green_mask = 0xff << 8;
219 blue_mask = 0xff;
220 alpha_mask = 0xff << 24;
221 }
222 else
223 {
224 red_mask = s->visual->red_mask;
225 green_mask = s->visual->green_mask;
226 blue_mask = s->visual->blue_mask;
227 alpha_mask = (uint32_t)format->direct.alphaMask << format->direct.alpha; 216 alpha_mask = (uint32_t)format->direct.alphaMask << format->direct.alpha;
228 }
229 217
230 int width_r = ecb_popcount32 (red_mask); 218 int width_r = ecb_popcount32 (red_mask);
231 int width_g = ecb_popcount32 (green_mask); 219 int width_g = ecb_popcount32 (green_mask);
232 int width_b = ecb_popcount32 (blue_mask); 220 int width_b = ecb_popcount32 (blue_mask);
233 int width_a = ecb_popcount32 (alpha_mask); 221 int width_a = ecb_popcount32 (alpha_mask);
241 int sh_a = ecb_ctz32 (alpha_mask); 229 int sh_a = ecb_ctz32 (alpha_mask);
242 230
243 if (width > 32767 || height > 32767) 231 if (width > 32767 || height > 32767)
244 return false; 232 return false;
245 233
246 XImage *ximage = XCreateImage (dpy, s->visual, argb ? 32 : format->depth, ZPixmap, 0, 0, 234 XImage *ximage = XCreateImage (dpy, s->visual, format->depth, ZPixmap, 0, 0,
247 width, height, 32, 0); 235 width, height, 32, 0);
248 if (!ximage) 236 if (!ximage)
249 return false; 237 return false;
250 238
251 if (height > INT_MAX / ximage->bytes_per_line 239 if (height > INT_MAX / ximage->bytes_per_line

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines