nr-blit.cpp revision 9e87caa574d67b9b1aa1015d4faae055336c9d30
#define __NR_BLIT_C__
/*
* Pixel buffer rendering library
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* This code is in public domain
*/
#include "nr-pixops.h"
#include "nr-compose.h"
#include "nr-blit.h"
void
{
int w, h;
if (alpha == 0) return;
if (s->empty) return;
/* fixme: */
if (s->mode == NR_PIXBLOCK_MODE_A8) return;
/* fixme: */
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8) return;
/*
* Possible variants as of now:
*
* 0. SRC EP - DST EP *
* 1. SRC EP - DST EN *
* 2. SRC EP - DST P *
* 3. SRC EP - DST N *
* 4. SRC EN - DST EP *
* 5. SRC EN - DST EN *
* 6. SRC EN - DST P *
* 7. SRC EN - DST N *
* 8. SRC P - DST EP *
* 9. SRC P - DST EN *
* A. SRC P - DST P *
* B. SRC P - DST N *
* C. SRC N - DST EP *
* D. SRC N - DST EN *
* E. SRC N - DST P *
* F. SRC N - DST N *
*
*/
if (nr_rect_l_test_empty (&clip)) return;
/* Pointers */
dbpp = NR_PIXBLOCK_BPP (d);
sbpp = NR_PIXBLOCK_BPP (s);
switch (d->mode) {
case NR_PIXBLOCK_MODE_A8:
/* No rendering into alpha at moment */
break;
case NR_PIXBLOCK_MODE_R8G8B8:
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
} else {
}
break;
if (d->empty) {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* Case 8 */
} else {
/* Case C */
}
} else {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* case A */
} else {
/* case E */
}
}
break;
if (d->empty) {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* Case 9 */
} else {
/* Case D */
}
} else {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* case B */
} else {
/* case F */
}
}
break;
}
}
void
{
int w, h;
if (s->empty) return;
/* fixme: */
if (s->mode == NR_PIXBLOCK_MODE_A8) return;
/* fixme: */
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8) return;
/*
* Possible variants as of now:
*
* 0. SRC EP - DST EP *
* 1. SRC EP - DST EN *
* 2. SRC EP - DST P *
* 3. SRC EP - DST N *
* 4. SRC EN - DST EP *
* 5. SRC EN - DST EN *
* 6. SRC EN - DST P *
* 7. SRC EN - DST N *
* 8. SRC P - DST EP *
* 9. SRC P - DST EN *
* A. SRC P - DST P *
* B. SRC P - DST N *
* C. SRC N - DST EP *
* D. SRC N - DST EN *
* E. SRC N - DST P *
* F. SRC N - DST N *
*
*/
if (nr_rect_l_test_empty (&clip)) return;
/* Pointers */
dbpp = NR_PIXBLOCK_BPP (d);
sbpp = NR_PIXBLOCK_BPP (s);
switch (d->mode) {
case NR_PIXBLOCK_MODE_A8:
/* No rendering into alpha at moment */
break;
case NR_PIXBLOCK_MODE_R8G8B8:
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
} else {
}
break;
if (d->empty) {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* Case 8 */
} else {
/* Case C */
}
} else {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* case A */
} else {
/* case E */
}
}
break;
if (d->empty) {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* Case 9 */
} else {
/* Case D */
}
} else {
if (s->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
/* case B */
} else {
/* case F */
}
}
break;
}
}
void
{
if (!(rgba & 0xff)) return;
if (m) {
int w, h;
if (m->mode != NR_PIXBLOCK_MODE_A8) return;
/* Pointers */
dpx = NR_PIXBLOCK_PX (d) + (clip.y0 - d->area.y0) * d->rs + NR_PIXBLOCK_BPP (d) * (clip.x0 - d->area.x0);
if (d->empty) {
if (d->mode == NR_PIXBLOCK_MODE_R8G8B8) {
} else if (d->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
} else {
}
d->empty = 0;
} else {
if (d->mode == NR_PIXBLOCK_MODE_R8G8B8) {
} else if (d->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) {
} else {
}
}
} else {
unsigned int r, g, b, a;
int x, y;
r = NR_RGBA32_R (rgba);
g = NR_RGBA32_G (rgba);
b = NR_RGBA32_B (rgba);
a = NR_RGBA32_A (rgba);
unsigned char *p;
unsigned int da;
switch (d->mode) {
case NR_PIXBLOCK_MODE_R8G8B8:
p[0] = NR_COMPOSEN11_1111 (r, a, p[0]);
p += 3;
break;
p[0] = NR_COMPOSENPP_1111 (r, a, p[0]);
p += 4;
break;
p += 4;
break;
default:
break;
}
}
}
}
}