git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b473a77
)
premultiply alpha
author
kramm
<kramm>
Sat, 13 Jan 2007 17:24:41 +0000
(17:24 +0000)
committer
kramm
<kramm>
Sat, 13 Jan 2007 17:24:41 +0000
(17:24 +0000)
lib/pdf/GFXOutputDev.cc
patch
|
blob
|
history
diff --git
a/lib/pdf/GFXOutputDev.cc
b/lib/pdf/GFXOutputDev.cc
index
210f88d
..
81cb642
100644
(file)
--- a/
lib/pdf/GFXOutputDev.cc
+++ b/
lib/pdf/GFXOutputDev.cc
@@
-2717,6
+2717,10
@@
void GFXOutputDev::setSoftMask(GfxState *state, double *bbox, GBool alpha, Funct
states[statepos].softmask = 1;
}
states[statepos].softmask = 1;
}
+static inline Guchar div255(int x) {
+ return (Guchar)((x + (x >> 8) + 0x80) >> 8);
+}
+
void GFXOutputDev::clearSoftMask(GfxState *state)
{
if(!states[statepos].softmask)
void GFXOutputDev::clearSoftMask(GfxState *state)
{
if(!states[statepos].softmask)
@@
-2779,14
+2783,12
@@
void GFXOutputDev::clearSoftMask(GfxState *state)
gfxcolor_t* l1 = &maskimg->data[maskimg->width*y];
gfxcolor_t* l2 = &belowimg->data[belowimg->width*y];
for(x=0;x<width;x++) {
gfxcolor_t* l1 = &maskimg->data[maskimg->width*y];
gfxcolor_t* l2 = &belowimg->data[belowimg->width*y];
for(x=0;x<width;x++) {
- l1->a = 255;
l2->a = (77*l1->r + 151*l1->g + 28*l1->b) >> 8;
l2->a = (77*l1->r + 151*l1->g + 28*l1->b) >> 8;
- /* premultiply alpha... do we need this? (depends on output device)
- l2->r = (l2->a*l2->r) >> 8;
- l2->g = (l2->a*l2->g) >> 8;
- l2->b = (l2->a*l2->b) >> 8;
- */
+ /* premultiply alpha */
+ l2->r = div255(l2->a*l2->r);
+ l2->g = div255(l2->a*l2->g);
+ l2->b = div255(l2->a*l2->b);
l1++;
l2++;
l1++;
l2++;