.Painter: support for Invert in subpixel mode

git-svn-id: svn://ultimatepp.org/upp/trunk@3602 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-07-03 17:30:43 +00:00
parent 491fd630b5
commit b551a59698
3 changed files with 34 additions and 18 deletions

View file

@ -67,7 +67,7 @@ void SolidFiller::Render(int val, int len)
RGBA *e = t + len;
if(val == 256)
while(t < e) {
AlphaBlend(*t, InvertRGBA(*t));
*t = InvertRGBA(*t);
t++;
}
else
@ -223,23 +223,37 @@ void SubpixelFiller::Render(int val, int len)
l = len / 3;
len -= 3 * l;
RGBA *e = min(t + l, end);
if(val == 256)
if(!ss && color.a == 255) {
FillRGBA(t, color, e - t);
t = e;
}
if(invert && !ss) {
if(val == 256)
while(t < e) {
*t = InvertRGBA(*t);
t++;
}
else
while(t < e)
AlphaBlend(*t++, ss ? Mul8(*s++, alpha) : color);
else
if(ss)
while(t < e)
AlphaBlendCover8(*t++, Mul8(*s++, alpha), val);
else {
RGBA c = Mul8(color, val);
while(t < e)
AlphaBlend(*t++, c);
}
while(t < e) {
AlphaBlend(*t, Mul8(InvertRGBA(*t), val));
t++;
}
}
else {
if(val == 256)
if(!ss && color.a == 255) {
FillRGBA(t, color, e - t);
t = e;
}
else
while(t < e)
AlphaBlend(*t++, ss ? Mul8(*s++, alpha) : color);
else
if(ss)
while(t < e)
AlphaBlendCover8(*t++, Mul8(*s++, alpha), val);
else {
RGBA c = Mul8(color, val);
while(t < e)
AlphaBlend(*t++, c);
}
}
v = begin = sbuffer + 3;
v[0] = h + h + h;
v[1] = h;
@ -253,7 +267,7 @@ void SubpixelFiller::Write(int len)
RGBA *e = min(t + len, end);
int16 *q = begin;
while(t < e) {
RGBA c = ss ? Mul8(*s++, alpha) : color;
RGBA c = ss ? Mul8(*s++, alpha) : invert ? InvertRGBA(*t) : color;
int a;
if(t->a != 255)
AlphaBlendCover8(*t, c, (q[0] + q[1] + q[2]) / 3);

View file

@ -37,6 +37,7 @@ struct SubpixelFiller : Rasterizer::Filler {
int alpha;
RGBA *buffer;
int y;
bool invert;
void Write(int len);
void RenderN(int val, int h, int n);

View file

@ -81,6 +81,7 @@ Buffer<ClippingLine> BufferPainter::RenderPath(double width, SpanSource *ss, con
MaskFillerFilter mf;
bool doclip = width == CLIP;
subpixel_filler.sbuffer = subpixel;
subpixel_filler.invert = pathattr.invert;
if(doclip) {
rg = &clip_filler;
newclip.Alloc(ib.GetHeight());