#include "pixman-private.h"
#include "pixman-accessor.h"
-#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
+#define CONVERT_RGB24_TO_Y15(s) (((((s) >> 16) & 0xff) * 153 + \
(((s) >> 8) & 0xff) * 301 + \
(((s) ) & 0xff) * 58) >> 2)
-#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
+#define CONVERT_RGB24_TO_RGB15(s) ((((s) >> 3) & 0x001f) | \
(((s) >> 6) & 0x03e0) | \
(((s) >> 9) & 0x7c00))
-#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
-#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
+#define RGB16_TO_ENTRY(mif,rgb15) ((mif)->ent[rgb15])
+#define RGB24_TO_ENTRY(mif,rgb24) RGB16_TO_ENTRY(mif,CONVERT_RGB24_TO_RGB15(rgb24))
-#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
+#define RGB24_TO_ENTRY_Y(mif,rgb24) ((mif)->ent[CONVERT_RGB24_TO_Y15(rgb24)])
/*
* YV12 setup and access macros
}
}
-#define Fetch8(img,l,o) (READ(img, (uint8_t *)(l) + ((o) >> 2)))
+#define FETCH_8(img,l,o) (READ(img, (uint8_t *)(l) + ((o) >> 2)))
#ifdef WORDS_BIGENDIAN
-#define Fetch4(img,l,o) ((o) & 2 ? Fetch8(img,l,o) & 0xf : Fetch8(img,l,o) >> 4)
+#define FETCH_4(img,l,o) ((o) & 2 ? FETCH_8(img,l,o) & 0xf : FETCH_8(img,l,o) >> 4)
#else
-#define Fetch4(img,l,o) ((o) & 2 ? Fetch8(img,l,o) >> 4 : Fetch8(img,l,o) & 0xf)
+#define FETCH_4(img,l,o) ((o) & 2 ? FETCH_8(img,l,o) >> 4 : FETCH_8(img,l,o) & 0xf)
#endif
static void
const uint32_t *bits = image->bits.bits + y*image->bits.rowstride;
int i;
for (i = 0; i < width; ++i) {
- uint32_t p = Fetch4(image, bits, i + x);
+ uint32_t p = FETCH_4(image, bits, i + x);
p |= p << 4;
*buffer++ = p << 24;
const uint32_t *bits = image->bits.bits + y*image->bits.rowstride;
int i;
for (i = 0; i < width; ++i) {
- uint32_t p = Fetch4(image, bits, i + x);
+ uint32_t p = FETCH_4(image, bits, i + x);
r = ((p & 0x8) * 0xff) << 13;
g = ((p & 0x6) * 0x55) << 7;
const uint32_t *bits = image->bits.bits + y*image->bits.rowstride;
int i;
for (i = 0; i < width; ++i) {
- uint32_t p = Fetch4(image, bits, i + x);
+ uint32_t p = FETCH_4(image, bits, i + x);
b = ((p & 0x8) * 0xff) >> 3;
g = ((p & 0x6) * 0x55) << 7;
const uint32_t *bits = image->bits.bits + y*image->bits.rowstride;
int i;
for (i = 0; i < width; ++i) {
- uint32_t p = Fetch4(image, bits, i + x);
+ uint32_t p = FETCH_4(image, bits, i + x);
a = ((p & 0x8) * 0xff) << 21;
r = ((p & 0x4) * 0xff) << 14;
const uint32_t *bits = image->bits.bits + y*image->bits.rowstride;
int i;
for (i = 0; i < width; ++i) {
- uint32_t p = Fetch4(image, bits, i + x);
+ uint32_t p = FETCH_4(image, bits, i + x);
a = ((p & 0x8) * 0xff) << 21;
r = ((p & 0x4) * 0xff) >> 3;
const pixman_indexed_t * indexed = image->bits.indexed;
int i;
for (i = 0; i < width; ++i) {
- uint32_t p = Fetch4 (image, bits, i + x);
+ uint32_t p = FETCH_4 (image, bits, i + x);
*buffer++ = indexed->rgba[p];
}
else
{
uint32_t *bits = pict->bits + line*pict->rowstride;
- uint32_t pixel = Fetch4 (pict, bits, offset);
+ uint32_t pixel = FETCH_4 (pict, bits, offset);
pixel |= pixel << 4;
buffer[i] = pixel << 24;
{
uint32_t r,g,b;
uint32_t *bits = pict->bits + line*pict->rowstride;
- uint32_t pixel = Fetch4 (pict, bits, offset);
+ uint32_t pixel = FETCH_4 (pict, bits, offset);
r = ((pixel & 0x8) * 0xff) << 13;
g = ((pixel & 0x6) * 0x55) << 7;
{
uint32_t r,g,b;
uint32_t *bits = pict->bits + line*pict->rowstride;
- uint32_t pixel = Fetch4 (pict, bits, offset);
+ uint32_t pixel = FETCH_4 (pict, bits, offset);
b = ((pixel & 0x8) * 0xff) >> 3;
g = ((pixel & 0x6) * 0x55) << 7;
{
uint32_t a,r,g,b;
uint32_t *bits = pict->bits + line*pict->rowstride;
- uint32_t pixel = Fetch4 (pict, bits, offset);
+ uint32_t pixel = FETCH_4 (pict, bits, offset);
a = ((pixel & 0x8) * 0xff) << 21;
r = ((pixel & 0x4) * 0xff) << 14;
{
uint32_t a,r,g,b;
uint32_t *bits = pict->bits + line*pict->rowstride;
- uint32_t pixel = Fetch4 (pict, bits, offset);
+ uint32_t pixel = FETCH_4 (pict, bits, offset);
a = ((pixel & 0x8) * 0xff) << 21;
r = ((pixel & 0x4) * 0xff) >> 3;
else
{
uint32_t *bits = pict->bits + line*pict->rowstride;
- uint32_t pixel = Fetch4 (pict, bits, offset);
+ uint32_t pixel = FETCH_4 (pict, bits, offset);
const pixman_indexed_t * indexed = pict->indexed;
buffer[i] = indexed->rgba[pixel];
/*********************************** Store ************************************/
-#define Splita(v) uint32_t a = ((v) >> 24), r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff
-#define Split(v) uint32_t r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff
+#define SPLIT_A(v) uint32_t a = ((v) >> 24), r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff
+#define SPLIT(v) uint32_t r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff
static void
store_scanline_a2r10g10b10 (bits_image_t *image, int x, int y, int width, const uint32_t *v)
int i;
for (i = 0; i < width; ++i) {
- Split(values[i]);
+ SPLIT(values[i]);
WRITE(image, pixel++, ((b << 8) & 0xf800) |
((g << 3) & 0x07e0) |
((r >> 3) ));
int i;
for (i = 0; i < width; ++i) {
- Splita(values[i]);
+ SPLIT_A(values[i]);
WRITE(image, pixel++, ((a << 8) & 0x8000) |
((r << 7) & 0x7c00) |
((g << 2) & 0x03e0) |
int i;
for (i = 0; i < width; ++i) {
- Split(values[i]);
+ SPLIT(values[i]);
WRITE(image, pixel++, ((r << 7) & 0x7c00) |
((g << 2) & 0x03e0) |
((b >> 3) ));
int i;
for (i = 0; i < width; ++i) {
- Splita(values[i]);
+ SPLIT_A(values[i]);
WRITE(image, pixel++, ((a << 8) & 0x8000) |
((b << 7) & 0x7c00) |
((g << 2) & 0x03e0) |
int i;
for (i = 0; i < width; ++i) {
- Split(values[i]);
+ SPLIT(values[i]);
WRITE(image, pixel++, ((b << 7) & 0x7c00) |
((g << 2) & 0x03e0) |
((r >> 3) ));
int i;
for (i = 0; i < width; ++i) {
- Splita(values[i]);
+ SPLIT_A(values[i]);
WRITE(image, pixel++, ((a << 8) & 0xf000) |
((r << 4) & 0x0f00) |
((g ) & 0x00f0) |
int i;
for (i = 0; i < width; ++i) {
- Split(values[i]);
+ SPLIT(values[i]);
WRITE(image, pixel++, ((r << 4) & 0x0f00) |
((g ) & 0x00f0) |
((b >> 4) ));
int i;
for (i = 0; i < width; ++i) {
- Splita(values[i]);
+ SPLIT_A(values[i]);
WRITE(image, pixel++, ((a << 8) & 0xf000) |
((b << 4) & 0x0f00) |
((g ) & 0x00f0) |
int i;
for (i = 0; i < width; ++i) {
- Split(values[i]);
+ SPLIT(values[i]);
WRITE(image, pixel++, ((b << 4) & 0x0f00) |
((g ) & 0x00f0) |
((r >> 4) ));
int i;
for (i = 0; i < width; ++i) {
- Split(values[i]);
+ SPLIT(values[i]);
WRITE(image, pixel++,
((r ) & 0xe0) |
((g >> 3) & 0x1c) |
int i;
for (i = 0; i < width; ++i) {
- Split(values[i]);
+ SPLIT(values[i]);
WRITE(image, pixel++,
((b ) & 0xc0) |
((g >> 2) & 0x38) |
int i;
for (i = 0; i < width; ++i) {
- Splita(values[i]);
+ SPLIT_A(values[i]);
WRITE(image, pixel++, ((a ) & 0xc0) |
((r >> 2) & 0x30) |
((g >> 4) & 0x0c) |
int i;
for (i = 0; i < width; ++i) {
- Splita(values[i]);
+ SPLIT_A(values[i]);
*(pixel++) = ((a ) & 0xc0) |
((b >> 2) & 0x30) |
((g >> 4) & 0x0c) |
int i;
for (i = 0; i < width; ++i) {
- WRITE(image, pixel++, miIndexToEnt24(indexed,values[i]));
+ WRITE(image, pixel++, RGB24_TO_ENTRY(indexed,values[i]));
}
}
}
}
-#define Store8(img,l,o,v) (WRITE(img, (uint8_t *)(l) + ((o) >> 3), (v)))
+#define STORE_8(img,l,o,v) (WRITE(img, (uint8_t *)(l) + ((o) >> 3), (v)))
#ifdef WORDS_BIGENDIAN
-#define Store4(img,l,o,v) Store8(img,l,o,((o) & 4 ? \
- (Fetch8(img,l,o) & 0xf0) | (v) : \
- (Fetch8(img,l,o) & 0x0f) | ((v) << 4)))
+#define STORE_4(img,l,o,v) STORE_8(img,l,o,((o) & 4 ? \
+ (FETCH_8(img,l,o) & 0xf0) | (v) : \
+ (FETCH_8(img,l,o) & 0x0f) | ((v) << 4)))
#else
-#define Store4(img,l,o,v) Store8(img,l,o,((o) & 4 ? \
- (Fetch8(img,l,o) & 0x0f) | ((v) << 4) : \
- (Fetch8(img,l,o) & 0xf0) | (v)))
+#define STORE_4(img,l,o,v) STORE_8(img,l,o,((o) & 4 ? \
+ (FETCH_8(img,l,o) & 0x0f) | ((v) << 4) : \
+ (FETCH_8(img,l,o) & 0xf0) | (v)))
#endif
static void
int i;
for (i = 0; i < width; ++i) {
- Store4(image, bits, i + x, values[i]>>28);
+ STORE_4(image, bits, i + x, values[i]>>28);
}
}
for (i = 0; i < width; ++i) {
uint32_t pixel;
- Split(values[i]);
+ SPLIT(values[i]);
pixel = (((r >> 4) & 0x8) |
((g >> 5) & 0x6) |
((b >> 7) ));
- Store4(image, bits, i + x, pixel);
+ STORE_4(image, bits, i + x, pixel);
}
}
for (i = 0; i < width; ++i) {
uint32_t pixel;
- Split(values[i]);
+ SPLIT(values[i]);
pixel = (((b >> 4) & 0x8) |
((g >> 5) & 0x6) |
((r >> 7) ));
- Store4(image, bits, i + x, pixel);
+ STORE_4(image, bits, i + x, pixel);
}
}
for (i = 0; i < width; ++i) {
uint32_t pixel;
- Splita(values[i]);
+ SPLIT_A(values[i]);
pixel = (((a >> 4) & 0x8) |
((r >> 5) & 0x4) |
((g >> 6) & 0x2) |
((b >> 7) ));
- Store4(image, bits, i + x, pixel);
+ STORE_4(image, bits, i + x, pixel);
}
}
for (i = 0; i < width; ++i) {
uint32_t pixel;
- Splita(values[i]);
+ SPLIT_A(values[i]);
pixel = (((a >> 4) & 0x8) |
((b >> 5) & 0x4) |
((g >> 6) & 0x2) |
((r >> 7) ));
- Store4(image, bits, i + x, pixel);
+ STORE_4(image, bits, i + x, pixel);
}
}
for (i = 0; i < width; ++i) {
uint32_t pixel;
- pixel = miIndexToEnt24(indexed, values[i]);
- Store4(image, bits, i + x, pixel);
+ pixel = RGB24_TO_ENTRY(indexed, values[i]);
+ STORE_4(image, bits, i + x, pixel);
}
}
#else
mask = 1 << ((i + x) & 0x1f);
#endif
- v = miIndexToEntY24 (indexed, values[i]) ? mask : 0;
+ v = RGB24_TO_ENTRY_Y (indexed, values[i]) ? mask : 0;
WRITE(image, pixel, (READ(image, pixel) & ~mask) | v);
}
}
* store proc. Despite the type, this function expects a uint64_t buffer.
*/
static void
-store_scanline64_generic (bits_image_t *image, int x, int y, int width, const uint32_t *values)
+store_scanline_generic_64 (bits_image_t *image, int x, int y, int width, const uint32_t *values)
{
uint32_t *argb8Pixels;
/* Despite the type, this function expects both buffer and mask to be uint64_t */
static void
-fetch_scanline64_generic (pixman_image_t *image, int x, int y, int width, uint32_t *buffer,
+fetch_scanline_generic_64 (pixman_image_t *image, int x, int y, int width, uint32_t *buffer,
const uint32_t *mask, uint32_t mask_bits)
{
/* Fetch the pixels into the first half of buffer and then expand them in
/* Despite the type, this function expects a uint64_t *buffer */
static void
-fetch_pixels64_generic (bits_image_t *pict, uint32_t *buffer, int n_pixels)
+fetch_pixels_generic_64 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
{
pict->fetch_pixels_raw_32 (pict, buffer, n_pixels);
* WARNING: This function loses precision!
*/
static void
-fetch_pixels32_generic_lossy (bits_image_t *pict, uint32_t *buffer, int n_pixels)
+fetch_pixels_generic_lossy_32 (bits_image_t *pict, uint32_t *buffer, int n_pixels)
{
/* Since buffer contains n_pixels coordinate pairs, it also has enough room for
* n_pixels 64 bit pixels.
#define FORMAT_INFO(format) \
{ \
PIXMAN_##format, \
- fetch_scanline_##format, fetch_scanline64_generic, \
- fetch_pixels_##format, fetch_pixels64_generic, \
- store_scanline_##format, store_scanline64_generic \
+ fetch_scanline_##format, fetch_scanline_generic_64, \
+ fetch_pixels_##format, fetch_pixels_generic_64, \
+ store_scanline_##format, store_scanline_generic_64 \
}
static const format_info_t accessors[] =
{ PIXMAN_a2r10g10b10,
NULL, fetch_scanline_a2r10g10b10,
- fetch_pixels32_generic_lossy, fetch_pixels_a2r10g10b10_64,
+ fetch_pixels_generic_lossy_32, fetch_pixels_a2r10g10b10_64,
NULL, store_scanline_a2r10g10b10 },
{ PIXMAN_x2r10g10b10,
NULL, fetch_scanline_x2r10g10b10,
- fetch_pixels32_generic_lossy, fetch_pixels_x2r10g10b10_64,
+ fetch_pixels_generic_lossy_32, fetch_pixels_x2r10g10b10_64,
NULL, store_scanline_x2r10g10b10 },
{ PIXMAN_a2b10g10r10,
NULL, fetch_scanline_a2b10g10r10,
- fetch_pixels32_generic_lossy, fetch_pixels_a2b10g10r10_64,
+ fetch_pixels_generic_lossy_32, fetch_pixels_a2b10g10r10_64,
NULL, store_scanline_a2b10g10r10 },
{ PIXMAN_x2b10g10r10,
NULL, fetch_scanline_x2b10g10r10,
- fetch_pixels32_generic_lossy, fetch_pixels_x2b10g10r10_64,
+ fetch_pixels_generic_lossy_32, fetch_pixels_x2b10g10r10_64,
NULL, store_scanline_x2b10g10r10 },
/* YUV formats */
{ PIXMAN_yuy2,
- fetch_scanline_yuy2, fetch_scanline64_generic,
- fetch_pixels_yuy2, fetch_pixels64_generic,
+ fetch_scanline_yuy2, fetch_scanline_generic_64,
+ fetch_pixels_yuy2, fetch_pixels_generic_64,
NULL, NULL },
{ PIXMAN_yv12,
- fetch_scanline_yv12, fetch_scanline64_generic,
- fetch_pixels_yv12, fetch_pixels64_generic,
+ fetch_scanline_yv12, fetch_scanline_generic_64,
+ fetch_pixels_yv12, fetch_pixels_generic_64,
NULL, NULL },
{ PIXMAN_null },
if (bits->common.alpha_map)
{
image->common.get_scanline_64 =
- _pixman_image_get_scanline_64_generic;
+ _pixman_image_get_scanline_generic_64;
image->common.get_scanline_32 =
bits_image_fetch_transformed;
}
else
{
image->common.get_scanline_64 =
- _pixman_image_get_scanline_64_generic;
+ _pixman_image_get_scanline_generic_64;
image->common.get_scanline_32 =
bits_image_fetch_transformed;
}
* no released draft exists that shows this, as the formulas have not been
* updated yet after the release of ISO 32000.
*
- * The default implementation here uses the PdfSeparableBlendMode and
- * PdfNonSeparableBlendMode macros, which take the blend function as an
+ * The default implementation here uses the PDF_SEPARABLE_BLEND_MODE and
+ * PDF_NON_SEPARABLE_BLEND_MODE macros, which take the blend function as an
* argument. Note that this implementation operates on premultiplied colors,
* while the PDF specification does not. Therefore the code uses the formula
* ar.Cra = (1 – as) . Dca + (1 – ad) . Sca + B(Dca, ad, Sca, as)
}
}
-#define PdfSeparableBlendMode(name) \
+#define PDF_SEPARABLE_BLEND_MODE(name) \
static void \
fbCombine ## name ## U (pixman_implementation_t *imp, pixman_op_t op, \
comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \
\
*(dest + i) = result + \
(DivOne (sa * da) << A_SHIFT) + \
- (Blend ## name (Red (d), da, Red (s), sa) << R_SHIFT) + \
- (Blend ## name (Green (d), da, Green (s), sa) << G_SHIFT) + \
- (Blend ## name (Blue (d), da, Blue (s), sa)); \
+ (blend_ ## name (Red (d), da, Red (s), sa) << R_SHIFT) + \
+ (blend_ ## name (Green (d), da, Green (s), sa) << G_SHIFT) + \
+ (blend_ ## name (Blue (d), da, Blue (s), sa)); \
} \
} \
\
\
result += \
(DivOne (Alpha (m) * da) << A_SHIFT) + \
- (Blend ## name (Red (d), da, Red (s), Red (m)) << R_SHIFT) + \
- (Blend ## name (Green (d), da, Green (s), Green (m)) << G_SHIFT) + \
- (Blend ## name (Blue (d), da, Blue (s), Blue (m))); \
+ (blend_ ## name (Red (d), da, Red (s), Red (m)) << R_SHIFT) + \
+ (blend_ ## name (Green (d), da, Green (s), Green (m)) << G_SHIFT) + \
+ (blend_ ## name (Blue (d), da, Blue (s), Blue (m))); \
\
*(dest + i) = result; \
} \
*/
static inline comp4_t
-BlendScreen (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_Screen (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
return DivOne (sca * da + dca * sa - sca * dca);
}
-PdfSeparableBlendMode (Screen)
+PDF_SEPARABLE_BLEND_MODE (Screen)
/*
* Overlay
*/
static inline comp4_t
-BlendOverlay (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_Overlay (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
comp4_t rca;
return DivOne (rca);
}
-PdfSeparableBlendMode (Overlay)
+PDF_SEPARABLE_BLEND_MODE (Overlay)
/*
* Darken
*/
static inline comp4_t
-BlendDarken (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_Darken (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
comp4_t s, d;
return DivOne (s > d ? d : s);
}
-PdfSeparableBlendMode (Darken)
+PDF_SEPARABLE_BLEND_MODE (Darken)
/*
* Lighten
*/
static inline comp4_t
-BlendLighten (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_Lighten (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
comp4_t s, d;
return DivOne (s > d ? s : d);
}
-PdfSeparableBlendMode (Lighten)
+PDF_SEPARABLE_BLEND_MODE (Lighten)
/*
* Color dodge
*/
static inline comp4_t
-BlendColorDodge (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_ColorDodge (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
if (sca >= sa) {
return DivOne (sa * da);
}
}
-PdfSeparableBlendMode (ColorDodge)
+PDF_SEPARABLE_BLEND_MODE (ColorDodge)
/*
* Color burn
*/
static inline comp4_t
-BlendColorBurn (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_ColorBurn (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
if (sca == 0) {
return 0;
}
}
-PdfSeparableBlendMode (ColorBurn)
+PDF_SEPARABLE_BLEND_MODE (ColorBurn)
/*
* Hard light
* Sa.Da - 2.(Da - Dca).(Sa - Sca)
*/
static inline comp4_t
-BlendHardLight (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_HardLight (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
if (2 * sca < sa)
return DivOne (2 * sca * dca);
return DivOne (sa * da - 2 * (da - dca) * (sa - sca));
}
-PdfSeparableBlendMode (HardLight)
+PDF_SEPARABLE_BLEND_MODE (HardLight)
/*
* Soft light
*/
static inline comp4_t
-BlendSoftLight (comp4_t dca_org, comp4_t da_org, comp4_t sca_org, comp4_t sa_org)
+blend_SoftLight (comp4_t dca_org, comp4_t da_org, comp4_t sca_org, comp4_t sa_org)
{
double dca = dca_org * (1.0 / MASK);
double da = da_org * (1.0 / MASK);
return rca * MASK + 0.5;
}
-PdfSeparableBlendMode (SoftLight)
+PDF_SEPARABLE_BLEND_MODE (SoftLight)
/*
* Difference
*/
static inline comp4_t
-BlendDifference (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_Difference (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
comp4_t dcasa = dca * sa;
comp4_t scada = sca * da;
return DivOne (scada - dcasa);
}
-PdfSeparableBlendMode (Difference)
+PDF_SEPARABLE_BLEND_MODE (Difference)
/*
* Exclusion
*/
/* This can be made faster by writing it directly and not using
- * PdfSeparableBlendMode, but that's a performance optimization */
+ * PDF_SEPARABLE_BLEND_MODE, but that's a performance optimization */
static inline comp4_t
-BlendExclusion (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+blend_Exclusion (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
{
return DivOne (sca * da + dca * sa - 2 * dca * sca);
}
-PdfSeparableBlendMode (Exclusion)
+PDF_SEPARABLE_BLEND_MODE (Exclusion)
-#undef PdfSeparableBlendMode
+#undef PDF_SEPARABLE_BLEND_MODE
/*
* PDF nonseperable blend modes are implemented using the following functions
- * to operate in HSL space, with Cmax, Cmid, Cmin referring to the max, mid
+ * to operate in Hsl space, with Cmax, Cmid, Cmin referring to the max, mid
* and min value of the red, green and blue components.
*
* Lum (C) = 0.3 × Cred + 0.59 × Cgreen + 0.11 × Cblue
#define Lum(c) ((c[0] * 30 + c[1] * 59 + c[2] * 11) / 100)
#define Sat(c) (Max (c) - Min (c))
-#define PdfNonSeparableBlendMode(name) \
+#define PDF_NON_SEPARABLE_BLEND_MODE(name) \
static void \
fbCombine ## name ## U (pixman_implementation_t *imp, pixman_op_t op, \
comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \
sc[1] = Green (s); \
dc[2] = Blue (d); \
sc[2] = Blue (s); \
- Blend ## name (c, dc, da, sc, sa); \
+ blend_ ## name (c, dc, da, sc, sa); \
\
*(dest + i) = result + \
(DivOne (sa * da) << A_SHIFT) + \
* B(Cb, Cs) = SetLum (SetSat (Cs, Sat (Cb)), Lum (Cb))
*/
static inline void
-BlendHSLHue (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
+blend_HslHue (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
{
c[0] = sc[0] * da;
c[1] = sc[1] * da;
SetLum (c, c, sa * da, Lum (dc) * sa);
}
-PdfNonSeparableBlendMode (HSLHue)
+PDF_NON_SEPARABLE_BLEND_MODE (HslHue)
/*
* Saturation:
* B(Cb, Cs) = SetLum (SetSat (Cb, Sat (Cs)), Lum (Cb))
*/
static inline void
-BlendHSLSaturation (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
+blend_HslSaturation (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
{
c[0] = dc[0] * sa;
c[1] = dc[1] * sa;
SetLum (c, c, sa * da, Lum (dc) * sa);
}
-PdfNonSeparableBlendMode (HSLSaturation)
+PDF_NON_SEPARABLE_BLEND_MODE (HslSaturation)
/*
* Color:
* B(Cb, Cs) = SetLum (Cs, Lum (Cb))
*/
static inline void
-BlendHSLColor (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
+blend_HslColor (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
{
c[0] = sc[0] * da;
c[1] = sc[1] * da;
SetLum (c, c, sa * da, Lum (dc) * sa);
}
-PdfNonSeparableBlendMode (HSLColor)
+PDF_NON_SEPARABLE_BLEND_MODE (HslColor)
/*
* Luminosity:
* B(Cb, Cs) = SetLum (Cb, Lum (Cs))
*/
static inline void
-BlendHSLLuminosity (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
+blend_HslLuminosity (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
{
c[0] = dc[0] * sa;
c[1] = dc[1] * sa;
SetLum (c, c, sa * da, Lum (sc) * da);
}
-PdfNonSeparableBlendMode (HSLLuminosity)
+PDF_NON_SEPARABLE_BLEND_MODE (HslLuminosity)
#undef Sat
#undef Lum
#undef Max
#undef Min
-#undef PdfNonSeparableBlendMode
+#undef PDF_NON_SEPARABLE_BLEND_MODE
/* Overlay
*
imp->combine_width[PIXMAN_OP_SOFT_LIGHT] = fbCombineSoftLightU;
imp->combine_width[PIXMAN_OP_DIFFERENCE] = fbCombineDifferenceU;
imp->combine_width[PIXMAN_OP_EXCLUSION] = fbCombineExclusionU;
- imp->combine_width[PIXMAN_OP_HSL_HUE] = fbCombineHSLHueU;
- imp->combine_width[PIXMAN_OP_HSL_SATURATION] = fbCombineHSLSaturationU;
- imp->combine_width[PIXMAN_OP_HSL_COLOR] = fbCombineHSLColorU;
- imp->combine_width[PIXMAN_OP_HSL_LUMINOSITY] = fbCombineHSLLuminosityU;
+ imp->combine_width[PIXMAN_OP_HSL_HUE] = fbCombineHslHueU;
+ imp->combine_width[PIXMAN_OP_HSL_SATURATION] = fbCombineHslSaturationU;
+ imp->combine_width[PIXMAN_OP_HSL_COLOR] = fbCombineHslColorU;
+ imp->combine_width[PIXMAN_OP_HSL_LUMINOSITY] = fbCombineHslLuminosityU;
/* Component alpha combiners */
imp->combine_width_ca[PIXMAN_OP_CLEAR] = fbCombineClearC;
conical_gradient_property_changed (pixman_image_t *image)
{
image->common.get_scanline_32 = conical_gradient_get_scanline_32;
- image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
+ image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64;
}
PIXMAN_EXPORT pixman_image_t *
enum CPUFeatures {
NoFeatures = 0,
MMX = 0x1,
- MMX_Extensions = 0x2,
+ MMX_EXTENSIONS = 0x2,
SSE = 0x6,
SSE2 = 0x8,
CMOV = 0x10
if (result & AV_386_MMX)
features |= MMX;
if (result & AV_386_AMD_MMX)
- features |= MMX_Extensions;
+ features |= MMX_EXTENSIONS;
if (result & AV_386_SSE)
features |= SSE;
if (result & AV_386_SSE2)
}
#endif
if (result & (1<<22))
- features |= MMX_Extensions;
+ features |= MMX_EXTENSIONS;
}
}
#endif /* HAVE_GETISAX */
if (!initialized)
{
unsigned int features = detectCPUFeatures();
- mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
+ mmx_present = (features & (MMX|MMX_EXTENSIONS)) == (MMX|MMX_EXTENSIONS);
initialized = TRUE;
}
if (!initialized)
{
unsigned int features = detectCPUFeatures();
- sse2_present = (features & (MMX|MMX_Extensions|SSE|SSE2)) == (MMX|MMX_Extensions|SSE|SSE2);
+ sse2_present = (features & (MMX|MMX_EXTENSIONS|SSE|SSE2)) == (MMX|MMX_EXTENSIONS|SSE|SSE2);
initialized = TRUE;
}
{
#ifdef WORDS_BIGENDIAN
-# define FbScrLeft(x,n) ((x) << (n))
+# define SCREEN_SHIFT_LEFT(x,n) ((x) << (n))
# define FbScrRight(x,n) ((x) >> (n))
#else
-# define FbScrLeft(x,n) ((x) >> (n))
+# define SCREEN_SHIFT_LEFT(x,n) ((x) >> (n))
# define FbScrRight(x,n) ((x) << (n))
#endif
-#define FbLeftMask(x) \
+#define LEFT_MASK(x) \
(((x) & 0x1f) ? \
FbScrRight (0xffffffff, (x) & 0x1f) : 0)
-#define FbRightMask(x) \
+#define RIGHT_MASK(x) \
(((32 - (x)) & 0x1f) ? \
- FbScrLeft (0xffffffff, (32 - (x)) & 0x1f) : 0)
+ SCREEN_SHIFT_LEFT (0xffffffff, (32 - (x)) & 0x1f) : 0)
#define FbMaskBits(x,w,l,n,r) { \
n = (w); \
- r = FbRightMask ((x) + n); \
- l = FbLeftMask (x); \
+ r = RIGHT_MASK ((x) + n); \
+ l = LEFT_MASK (x); \
if (l) { \
n -= 32 - ((x) & 0x1f); \
if (n < 0) { \
#include "pixman-combine32.h"
static force_inline uint32_t
-Fetch24 (uint8_t *a)
+fetch_24 (uint8_t *a)
{
if (((unsigned long)a) & 1)
{
}
static force_inline void
-Store24 (uint8_t *a, uint32_t v)
+store_24 (uint8_t *a, uint32_t v)
{
if (((unsigned long)a) & 1)
{
d = src;
else
{
- d = Fetch24(dst);
+ d = fetch_24(dst);
d = fbOver (src, d);
}
- Store24(dst, d);
+ store_24(dst, d);
}
else if (m)
{
- d = fbOver (fbIn(src,m), Fetch24(dst));
- Store24(dst, d);
+ d = fbOver (fbIn(src,m), fetch_24(dst));
+ store_24(dst, d);
}
dst += 3;
}
else
{
d = *dst;
- d = fbOver (src, cvt0565to0888(d));
+ d = fbOver (src, CONVERT_0565_TO_0888(d));
}
- *dst = cvt8888to0565(d);
+ *dst = CONVERT_8888_TO_0565(d);
}
else if (m)
{
d = *dst;
- d = fbOver (fbIn(src,m), cvt0565to0888(d));
- *dst = cvt8888to0565(d);
+ d = fbOver (fbIn(src,m), CONVERT_0565_TO_0888(d));
+ *dst = CONVERT_8888_TO_0565(d);
}
dst++;
}
if (src == 0)
return;
- src16 = cvt8888to0565(src);
+ src16 = CONVERT_8888_TO_0565(src);
fbComposeGetStart (dst_image, xDst, yDst, uint16_t, dstStride, dstLine, 1);
fbComposeGetStart (mask_image, xMask, yMask, uint32_t, maskStride, maskLine, 1);
else
{
d = *dst;
- d = fbOver (src, cvt0565to0888(d));
- *dst = cvt8888to0565(d);
+ d = fbOver (src, CONVERT_0565_TO_0888(d));
+ *dst = CONVERT_8888_TO_0565(d);
}
}
else if (ma)
{
d = *dst;
- d = cvt0565to0888(d);
+ d = CONVERT_0565_TO_0888(d);
FbByteMulC (src, ma);
FbByteMul (ma, srca);
ma = ~ma;
FbByteMulAddC (d, ma, src);
- *dst = cvt8888to0565(d);
+ *dst = CONVERT_8888_TO_0565(d);
}
dst++;
}
if (a == 0xff)
d = s;
else
- d = fbOver (s, Fetch24(dst));
+ d = fbOver (s, fetch_24(dst));
- Store24(dst, d);
+ store_24(dst, d);
}
dst += 3;
}
else
{
d = *dst;
- d = fbOver (s, cvt0565to0888(d));
+ d = fbOver (s, CONVERT_0565_TO_0888(d));
}
- *dst = cvt8888to0565(d);
+ *dst = CONVERT_8888_TO_0565(d);
}
dst++;
}
while (w--)
{
s = *src++;
- *dst = cvt8888to0565(s);
+ *dst = CONVERT_8888_TO_0565(s);
dst++;
}
}
src = src >> 24;
else if (dst_image->bits.format == PIXMAN_r5g6b5 ||
dst_image->bits.format == PIXMAN_b5g6r5)
- src = cvt8888to0565 (src);
+ src = CONVERT_8888_TO_0565 (src);
pixman_fill (dst_image->bits.bits, dst_image->bits.rowstride,
PIXMAN_FORMAT_BPP (dst_image->bits.format),
* depth, but that's a project for the future.
*/
void
-_pixman_image_get_scanline_64_generic (pixman_image_t * pict, int x, int y,
+_pixman_image_get_scanline_generic_64 (pixman_image_t * pict, int x, int y,
int width, uint32_t *buffer,
const uint32_t *mask, uint32_t maskBits)
{
linear_gradient_property_changed (pixman_image_t *image)
{
image->common.get_scanline_32 = linear_gradient_get_scanline_32;
- image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
+ image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64;
}
PIXMAN_EXPORT pixman_image_t *
#define epsilon (pixman_fixed_t) (2)
-#define is_same(a,b) (within_epsilon(a, b, epsilon))
-#define is_zero(a) (within_epsilon(a, 0, epsilon))
-#define is_one(a) (within_epsilon(a, F(1), epsilon))
-#define is_unit(a) (within_epsilon(a, F( 1), epsilon) || \
+#define IS_SAME(a,b) (within_epsilon(a, b, epsilon))
+#define IS_ZERO(a) (within_epsilon(a, 0, epsilon))
+#define IS_ONE(a) (within_epsilon(a, F(1), epsilon))
+#define IS_UNIT(a) (within_epsilon(a, F( 1), epsilon) || \
within_epsilon(a, F(-1), epsilon) || \
- is_zero(a))
-#define is_int(a) (is_zero(pixman_fixed_frac(a)))
+ IS_ZERO(a))
+#define IS_INT(a) (IS_ZERO(pixman_fixed_frac(a)))
PIXMAN_EXPORT pixman_bool_t
pixman_transform_is_identity(const struct pixman_transform *t)
{
- return ( is_same(t->matrix[0][0], t->matrix[1][1]) &&
- is_same(t->matrix[0][0], t->matrix[2][2]) &&
- !is_zero(t->matrix[0][0]) &&
- is_zero(t->matrix[0][1]) &&
- is_zero(t->matrix[0][2]) &&
- is_zero(t->matrix[1][0]) &&
- is_zero(t->matrix[1][2]) &&
- is_zero(t->matrix[2][0]) &&
- is_zero(t->matrix[2][1]));
+ return ( IS_SAME(t->matrix[0][0], t->matrix[1][1]) &&
+ IS_SAME(t->matrix[0][0], t->matrix[2][2]) &&
+ !IS_ZERO(t->matrix[0][0]) &&
+ IS_ZERO(t->matrix[0][1]) &&
+ IS_ZERO(t->matrix[0][2]) &&
+ IS_ZERO(t->matrix[1][0]) &&
+ IS_ZERO(t->matrix[1][2]) &&
+ IS_ZERO(t->matrix[2][0]) &&
+ IS_ZERO(t->matrix[2][1]));
}
PIXMAN_EXPORT pixman_bool_t
pixman_transform_is_scale(const struct pixman_transform *t)
{
- return (!is_zero(t->matrix[0][0]) &&
- is_zero(t->matrix[0][1]) &&
- is_zero(t->matrix[0][2]) &&
+ return (!IS_ZERO(t->matrix[0][0]) &&
+ IS_ZERO(t->matrix[0][1]) &&
+ IS_ZERO(t->matrix[0][2]) &&
- is_zero(t->matrix[1][0]) &&
- !is_zero(t->matrix[1][1]) &&
- is_zero(t->matrix[1][2]) &&
+ IS_ZERO(t->matrix[1][0]) &&
+ !IS_ZERO(t->matrix[1][1]) &&
+ IS_ZERO(t->matrix[1][2]) &&
- is_zero(t->matrix[2][0]) &&
- is_zero(t->matrix[2][1]) &&
- !is_zero(t->matrix[2][2]));
+ IS_ZERO(t->matrix[2][0]) &&
+ IS_ZERO(t->matrix[2][1]) &&
+ !IS_ZERO(t->matrix[2][2]));
}
PIXMAN_EXPORT pixman_bool_t
pixman_transform_is_int_translate(const struct pixman_transform *t)
{
- return (is_one (t->matrix[0][0]) &&
- is_zero(t->matrix[0][1]) &&
- is_int (t->matrix[0][2]) &&
+ return (IS_ONE (t->matrix[0][0]) &&
+ IS_ZERO(t->matrix[0][1]) &&
+ IS_INT (t->matrix[0][2]) &&
- is_zero(t->matrix[1][0]) &&
- is_one (t->matrix[1][1]) &&
- is_int (t->matrix[1][2]) &&
+ IS_ZERO(t->matrix[1][0]) &&
+ IS_ONE (t->matrix[1][1]) &&
+ IS_INT (t->matrix[1][2]) &&
- is_zero(t->matrix[2][0]) &&
- is_zero(t->matrix[2][1]) &&
- is_one (t->matrix[2][2]));
+ IS_ZERO(t->matrix[2][0]) &&
+ IS_ZERO(t->matrix[2][1]) &&
+ IS_ONE (t->matrix[2][2]));
}
PIXMAN_EXPORT pixman_bool_t
_pixman_bits_image_setup_raw_accessors (bits_image_t *image);
void
-_pixman_image_get_scanline_64_generic (pixman_image_t *pict,
+_pixman_image_get_scanline_generic_64 (pixman_image_t *pict,
int x,
int y,
int width,
/* Conversion between 8888 and 0565 */
-#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
+#define CONVERT_8888_TO_0565(s) ((((s) >> 3) & 0x001f) | \
(((s) >> 5) & 0x07e0) | \
(((s) >> 8) & 0xf800))
-#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
+#define CONVERT_0565_TO_0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
radial_gradient_property_changed (pixman_image_t *image)
{
image->common.get_scanline_32 = radial_gradient_get_scanline_32;
- image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
+ image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64;
}
PIXMAN_EXPORT pixman_image_t *
solid_fill_property_changed (pixman_image_t *image)
{
image->common.get_scanline_32 = solid_fill_get_scanline_32;
- image->common.get_scanline_64 = _pixman_image_get_scanline_64_generic;
+ image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64;
}
static uint32_t
c = c >> 24;
else if (format == PIXMAN_r5g6b5 ||
format == PIXMAN_b5g6r5)
- c = cvt8888to0565 (c);
+ c = CONVERT_8888_TO_0565 (c);
#if 0
printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);