- /* scale it and cache it */
- if (rgba->cache != NULL)
- g_free(rgba->cache);
- rgba->cache = g_new(unsigned long, sfw * sfh);
- rgba->cwidth = sfw;
- rgba->cheight = sfh;
- for (i = 0, c = 0, e = sfw*sfh; i < e; ++i) {
- rgba->cache[i] = rgba->data[(int)px + iy];
- if (++c >= sfw) {
- c = 0;
- px = 0;
- py += dy;
- iy = (int)py * rgba->width;
- } else
- px += dx;
- }
+ /* scale it and cache it */
+ if (rgba->cache != NULL)
+ g_free(rgba->cache);
+ rgba->cache = g_new(RrPixel32, sfw * sfh);
+ rgba->cwidth = sfw;
+ rgba->cheight = sfh;
+ for (i = 0, c = 0, e = sfw*sfh; i < e; ++i) {
+ rgba->cache[i] = rgba->data[(int)px + iy];
+ if (++c >= sfw) {
+ c = 0;
+ px = 0;
+ py += dy;
+ iy = (int)py * rgba->width;
+ } else
+ px += dx;
+ }
+
+ /* do we use the cache we may have just created, or the original? */
+ if (rgba->width != sfw || rgba->height != sfh)
+ draw = rgba->cache;
+
+ /* apply the alpha channel */
+ for (i = 0, c = 0, t = area->x, e = sfw*sfh; i < e; ++i, ++t) {
+ guchar alpha, r, g, b, bgr, bgg, bgb;