if (bits->common.alpha_map)
{
image->common.get_scanline_64 =
- (scanFetchProc)READ_ACCESS(fbFetchExternalAlpha64);
+ (scanFetchProc)_pixman_image_get_scanline_64_generic;
image->common.get_scanline_32 =
(scanFetchProc)READ_ACCESS(fbFetchExternalAlpha);
}
else
{
image->common.get_scanline_64 =
- (scanFetchProc)READ_ACCESS(fbFetchTransformed64);
+ (scanFetchProc)_pixman_image_get_scanline_64_generic;
image->common.get_scanline_32 =
(scanFetchProc)READ_ACCESS(fbFetchTransformed);
}
const int Bpp = wide ? 8 : 4;
uint8_t *scanline_buffer = stack_scanline_buffer;
uint8_t *src_buffer, *mask_buffer, *dest_buffer;
-
+
if (data->width * Bpp > SCANLINE_BUFFER_LENGTH)
{
scanline_buffer = pixman_malloc_abc (data->width, 3, Bpp);
static void
conical_gradient_property_changed (pixman_image_t *image)
{
- image->common.get_scanline_64 = (scanFetchProc)pixmanFetchSourcePict64;
image->common.get_scanline_32 = (scanFetchProc)pixmanFetchSourcePict;
+ image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
}
PIXMAN_EXPORT pixman_image_t *
return TRUE;
}
+/*
+ * By default, just evaluate the image at 32bpp and expand. Individual image
+ * types can plug in a better scanline getter if they want to. For example
+ * we could produce smoother gradients by evaluating them at higher color depth, but
+ * that's a project for the future.
+ */
+void
+_pixman_image_get_scanline_64_generic (pixman_image_t * pict, int x, int y, int width,
+ uint64_t *buffer, uint64_t *mask, uint32_t maskBits)
+{
+ uint32_t *mask8 = NULL;
+
+ // Contract the mask image, if one exists, so that the 32-bit fetch function
+ // can use it.
+ if (mask) {
+ mask8 = pixman_malloc_ab(width, sizeof(uint32_t));
+ if (!mask8)
+ return;
+
+ pixman_contract(mask8, mask, width);
+ }
+
+ // Fetch the source image into the first half of buffer.
+ _pixman_image_get_scanline_32 (pict, x, y, width, (uint32_t*)buffer, mask8,
+ maskBits);
+
+ // Expand from 32bpp to 64bpp in place.
+ pixman_expand(buffer, (uint32_t*)buffer, PIXMAN_a8r8g8b8, width);
+
+ free(mask8);
+}
+
pixman_image_t *
_pixman_image_allocate (void)
{
static void
linear_gradient_property_changed (pixman_image_t *image)
{
- image->common.get_scanline_64 = (scanFetchProc)pixmanFetchSourcePict64;
image->common.get_scanline_32 = (scanFetchProc)pixmanFetchSourcePict;
+ image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
}
PIXMAN_EXPORT pixman_image_t *
void pixmanFetchSourcePict(source_image_t *, int x, int y, int width,
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
-void pixmanFetchSourcePict64(source_image_t *, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
-
+void _pixman_image_get_scanline_64_generic (pixman_image_t * pict, int x, int y, int width,
+ uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
void fbFetchTransformed(bits_image_t *, int x, int y, int width,
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
void fbStoreExternalAlpha(bits_image_t *, int x, int y, int width,
uint32_t *buffer, uint32_t *mask,
uint32_t maskBits);
-void fbFetchTransformed64(bits_image_t *, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
void fbStoreExternalAlpha64(bits_image_t *, int x, int y, int width,
uint64_t *buffer);
-void fbFetchExternalAlpha64(bits_image_t *, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
-void fbFetchTransformed64_accessors(bits_image_t *, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask,
- uint32_t maskBits);
void fbStoreExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
uint64_t *buffer);
-void fbFetchExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask,
- uint32_t maskBits);
/* end */
static void
radial_gradient_property_changed (pixman_image_t *image)
{
- image->common.get_scanline_64 = (scanFetchProc)pixmanFetchSourcePict64;
image->common.get_scanline_32 = (scanFetchProc)pixmanFetchSourcePict;
+ image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
}
PIXMAN_EXPORT pixman_image_t *
static void
solid_fill_property_changed (pixman_image_t *image)
{
- image->common.get_scanline_64 = (scanFetchProc)pixmanFetchSourcePict64;
image->common.get_scanline_32 = (scanFetchProc)pixmanFetchSourcePict;
+ image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
}
static uint32_t
}
}
}
-
-/*
- * For now, just evaluate the source picture at 32bpp and expand. We could
- * produce smoother gradients by evaluating them at higher color depth, but
- * that's a project for the future.
- */
-void pixmanFetchSourcePict64(source_image_t * pict, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask, uint32_t maskBits)
-{
- uint32_t *mask8 = NULL;
-
- // Contract the mask image, if one exists, so that the 32-bit fetch function
- // can use it.
- if (mask) {
- mask8 = pixman_malloc_ab(width, sizeof(uint32_t));
- pixman_contract(mask8, mask, width);
- }
-
- // Fetch the source image into the first half of buffer.
- pixmanFetchSourcePict(pict, x, y, width, (uint32_t*)buffer, mask8,
- maskBits);
-
- // Expand from 32bpp to 64bpp in place.
- pixman_expand(buffer, (uint32_t*)buffer, PIXMAN_a8r8g8b8, width);
-
- free(mask8);
-}
}
}
-void
-ACCESS(fbFetchTransformed64)(bits_image_t * pict, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask, uint32_t maskBits)
-{
- // TODO: Don't lose precision for wide pictures!
- uint32_t *mask8 = NULL;
-
- // Contract the mask image, if one exists, so that the 32-bit fetch function
- // can use it.
- if (mask) {
- mask8 = pixman_malloc_ab(width, sizeof(uint32_t));
- pixman_contract(mask8, mask, width);
- }
-
- // Fetch the image into the first half of buffer.
- ACCESS(fbFetchTransformed)(pict, x, y, width, (uint32_t*)buffer, mask8,
- maskBits);
-
- // Expand from 32bpp to 64bpp in place.
- pixman_expand(buffer, (uint32_t*)buffer, PIXMAN_a8r8g8b8, width);
-
- free(mask8);
-}
-
#define SCANLINE_BUFFER_LENGTH 2048
void
}
void
-ACCESS(fbFetchExternalAlpha64)(bits_image_t * pict, int x, int y, int width,
- uint64_t *buffer, uint64_t *mask,
- uint32_t maskBits)
-{
- int i;
- uint64_t _alpha_buffer[SCANLINE_BUFFER_LENGTH];
- uint64_t *alpha_buffer = _alpha_buffer;
- uint64_t maskBits64;
-
- if (!pict->common.alpha_map) {
- ACCESS(fbFetchTransformed64) (pict, x, y, width, buffer, mask, maskBits);
- return;
- }
- if (width > SCANLINE_BUFFER_LENGTH)
- alpha_buffer = (uint64_t *) pixman_malloc_ab (width, sizeof(uint64_t));
-
- ACCESS(fbFetchTransformed64)(pict, x, y, width, buffer, mask, maskBits);
- ACCESS(fbFetchTransformed64)((bits_image_t *)pict->common.alpha_map, x - pict->common.alpha_origin.x,
- y - pict->common.alpha_origin.y, width,
- alpha_buffer, mask, maskBits);
-
- pixman_expand(&maskBits64, &maskBits, PIXMAN_a8r8g8b8, 1);
-
- for (i = 0; i < width; ++i) {
- if (!mask || mask[i] & maskBits64)
- {
- int64_t a = alpha_buffer[i]>>48;
- *(buffer + i) = (a << 48)
- | (div_65535(Red64(*(buffer + i)) * a) << 32)
- | (div_65535(Green64(*(buffer + i)) * a) << 16)
- | (div_65535(Blue64(*(buffer + i)) * a));
- }
- }
-
- if (alpha_buffer != _alpha_buffer)
- free(alpha_buffer);
-}
-
-void
ACCESS(fbStoreExternalAlpha)(bits_image_t * pict, int x, int y, int width,
uint32_t *buffer)
{