* on R5, the meaning of B_CONSTANT_ALPHA is a bit different
with regards to drawing bitmaps with alpha channel, instead of ignoring the bitmap alpha channel, it is further multiplied with the high color alpha channel, so basically, you can use the high color alpha as a "global" alpha value to draw the bitmap with * removed some duplicate code git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18843 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
846cc588f2
commit
d39634ce4d
@ -148,10 +148,8 @@ blend_color_hspan_alpha_cc(int x, int y, unsigned len,
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
// if (alpha) {
|
||||
if (alpha && (colors->a & 0xff)) {
|
||||
// support for transparent magic
|
||||
uint16 alpha = hAlpha * colors->a * *covers / 255;
|
||||
if (alpha) {
|
||||
if (alpha == 255 * 255) {
|
||||
ASSIGN_ALPHA_CC(p, colors->r, colors->g, colors->b);
|
||||
} else {
|
||||
@ -164,23 +162,17 @@ if (alpha && (colors->a & 0xff)) {
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
uint16 alpha = hAlpha * cover;
|
||||
uint16 alpha = hAlpha * colors->a * cover / 255;
|
||||
if (alpha == 255 * 255) {
|
||||
do {
|
||||
if (colors->a & 0xff) {
|
||||
// support for transparent magic
|
||||
ASSIGN_ALPHA_CC(p, colors->r, colors->g, colors->b);
|
||||
}
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (alpha) {
|
||||
do {
|
||||
if (colors->a & 0xff) {
|
||||
// support for transparent magic
|
||||
BLEND_ALPHA_CC(p, colors->r, colors->g, colors->b, alpha);
|
||||
}
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
|
@ -150,7 +150,7 @@ blend_color_hspan_alpha_co(int x, int y, unsigned len,
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
uint16 alpha = hAlpha * colors->a * *covers / 255;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
ASSIGN_ALPHA_CO(p, colors->r, colors->g, colors->b);
|
||||
@ -164,7 +164,7 @@ blend_color_hspan_alpha_co(int x, int y, unsigned len,
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
uint16 alpha = hAlpha * cover;
|
||||
uint16 alpha = hAlpha * colors->a * cover / 255;
|
||||
if (alpha == 255 * 255) {
|
||||
do {
|
||||
ASSIGN_ALPHA_CO(p, colors->r, colors->g, colors->b);
|
||||
|
@ -83,8 +83,6 @@ blend_solid_hspan_over_solid(int x, int y, unsigned len,
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// blend_solid_vspan_over_solid
|
||||
void
|
||||
blend_solid_vspan_over_solid(int x, int y, unsigned len,
|
||||
@ -109,50 +107,5 @@ blend_solid_vspan_over_solid(int x, int y, unsigned len,
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
// blend_color_hspan_over_solid
|
||||
void
|
||||
blend_color_hspan_over_solid(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const uint8* covers, uint8 cover,
|
||||
agg_buffer* buffer, const PatternHandler* pattern)
|
||||
{
|
||||
uint8* p = buffer->row_ptr(y) + (x << 2);
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
// if (*covers) {
|
||||
if (*covers && (colors->a & 0xff)) {
|
||||
if (*covers == 255) {
|
||||
ASSIGN_OVER(p, colors->r, colors->g, colors->b);
|
||||
} else {
|
||||
BLEND_OVER(p, colors->r, colors->g, colors->b, *covers);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
if (cover == 255) {
|
||||
do {
|
||||
if (colors->a & 0xff) {
|
||||
ASSIGN_OVER(p, colors->r, colors->g, colors->b);
|
||||
}
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (cover) {
|
||||
do {
|
||||
BLEND_OVER(p, colors->r, colors->g, colors->b, cover);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DRAWING_MODE_OVER_H
|
||||
|
||||
|
@ -140,14 +140,13 @@ PixelFormat::SetDrawingMode(drawing_mode mode, source_alpha alphaSrcMode,
|
||||
fBlendHLine = blend_hline_over;
|
||||
fBlendSolidHSpan = blend_solid_hspan_over;
|
||||
fBlendSolidVSpan = blend_solid_vspan_over;
|
||||
fBlendColorHSpan = blend_color_hspan_over;
|
||||
} else {
|
||||
fBlendPixel = blend_pixel_over_solid;
|
||||
fBlendHLine = blend_hline_over_solid;
|
||||
fBlendSolidHSpan = blend_solid_hspan_over_solid;
|
||||
fBlendSolidVSpan = blend_solid_vspan_over_solid;
|
||||
fBlendColorHSpan = blend_color_hspan_over_solid;
|
||||
}
|
||||
fBlendColorHSpan = blend_color_hspan_over;
|
||||
break;
|
||||
case B_OP_ERASE:
|
||||
fBlendPixel = blend_pixel_erase;
|
||||
|
Loading…
Reference in New Issue
Block a user