idx
int64 | func_before
string | Vulnerability Classification
string | vul
int64 | func_after
string | patch
string | CWE ID
string | lines_before
string | lines_after
string |
|---|---|---|---|---|---|---|---|---|
3,200
|
void RunLengthStream::reset() {
str->reset();
bufPtr = bufEnd = buf;
eof = gFalse;
}
|
Overflow
| 0
|
void RunLengthStream::reset() {
str->reset();
bufPtr = bufEnd = buf;
eof = gFalse;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,201
|
void CCITTFaxStream::reset() {
int code1;
ccittReset(gFalse);
if (codingLine != NULL && refLine != NULL) {
eof = gFalse;
codingLine[0] = columns;
} else {
eof = gTrue;
}
while ((code1 = lookBits(12)) == 0) {
eatBits(1);
}
if (code1 == 0x001) {
eatBits(12);
endOfLine = gTrue;
}
if (encoding > 0) {
nextLine2D = !lookBits(1);
eatBits(1);
}
}
|
Overflow
| 0
|
void CCITTFaxStream::reset() {
int code1;
ccittReset(gFalse);
if (codingLine != NULL && refLine != NULL) {
eof = gFalse;
codingLine[0] = columns;
} else {
eof = gTrue;
}
while ((code1 = lookBits(12)) == 0) {
eatBits(1);
}
if (code1 == 0x001) {
eatBits(12);
endOfLine = gTrue;
}
if (encoding > 0) {
nextLine2D = !lookBits(1);
eatBits(1);
}
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,202
|
void DCTStream::reset() {
int i, j;
dctReset(gFalse);
if (!readHeader()) {
y = height;
return;
}
if (numComps == 1) {
compInfo[0].hSample = compInfo[0].vSample = 1;
}
mcuWidth = compInfo[0].hSample;
mcuHeight = compInfo[0].vSample;
for (i = 1; i < numComps; ++i) {
if (compInfo[i].hSample > mcuWidth) {
mcuWidth = compInfo[i].hSample;
}
if (compInfo[i].vSample > mcuHeight) {
mcuHeight = compInfo[i].vSample;
}
}
mcuWidth *= 8;
mcuHeight *= 8;
if (colorXform == -1) {
if (numComps == 3) {
if (gotJFIFMarker) {
colorXform = 1;
} else if (compInfo[0].id == 82 && compInfo[1].id == 71 &&
compInfo[2].id == 66) { // ASCII "RGB"
colorXform = 0;
} else {
colorXform = 1;
}
} else {
colorXform = 0;
}
}
if (progressive || !interleaved) {
bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
bufHeight = ((height + mcuHeight - 1) / mcuHeight) * mcuHeight;
if (bufWidth <= 0 || bufHeight <= 0 ||
bufWidth > INT_MAX / bufWidth / (int)sizeof(int)) {
error(errSyntaxError, getPos(), "Invalid image size in DCT stream");
y = height;
return;
}
for (i = 0; i < numComps; ++i) {
frameBuf[i] = (int *)gmallocn(bufWidth * bufHeight, sizeof(int));
memset(frameBuf[i], 0, bufWidth * bufHeight * sizeof(int));
}
do {
restartMarker = 0xd0;
restart();
readScan();
} while (readHeader());
decodeImage();
comp = 0;
x = 0;
y = 0;
} else {
bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
for (i = 0; i < numComps; ++i) {
for (j = 0; j < mcuHeight; ++j) {
rowBuf[i][j] = (Guchar *)gmallocn(bufWidth, sizeof(Guchar));
}
}
comp = 0;
x = 0;
y = 0;
dy = mcuHeight;
restartMarker = 0xd0;
restart();
}
}
|
Overflow
| 0
|
void DCTStream::reset() {
int i, j;
dctReset(gFalse);
if (!readHeader()) {
y = height;
return;
}
if (numComps == 1) {
compInfo[0].hSample = compInfo[0].vSample = 1;
}
mcuWidth = compInfo[0].hSample;
mcuHeight = compInfo[0].vSample;
for (i = 1; i < numComps; ++i) {
if (compInfo[i].hSample > mcuWidth) {
mcuWidth = compInfo[i].hSample;
}
if (compInfo[i].vSample > mcuHeight) {
mcuHeight = compInfo[i].vSample;
}
}
mcuWidth *= 8;
mcuHeight *= 8;
if (colorXform == -1) {
if (numComps == 3) {
if (gotJFIFMarker) {
colorXform = 1;
} else if (compInfo[0].id == 82 && compInfo[1].id == 71 &&
compInfo[2].id == 66) { // ASCII "RGB"
colorXform = 0;
} else {
colorXform = 1;
}
} else {
colorXform = 0;
}
}
if (progressive || !interleaved) {
bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
bufHeight = ((height + mcuHeight - 1) / mcuHeight) * mcuHeight;
if (bufWidth <= 0 || bufHeight <= 0 ||
bufWidth > INT_MAX / bufWidth / (int)sizeof(int)) {
error(errSyntaxError, getPos(), "Invalid image size in DCT stream");
y = height;
return;
}
for (i = 0; i < numComps; ++i) {
frameBuf[i] = (int *)gmallocn(bufWidth * bufHeight, sizeof(int));
memset(frameBuf[i], 0, bufWidth * bufHeight * sizeof(int));
}
do {
restartMarker = 0xd0;
restart();
readScan();
} while (readHeader());
decodeImage();
comp = 0;
x = 0;
y = 0;
} else {
bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
for (i = 0; i < numComps; ++i) {
for (j = 0; j < mcuHeight; ++j) {
rowBuf[i][j] = (Guchar *)gmallocn(bufWidth, sizeof(Guchar));
}
}
comp = 0;
x = 0;
y = 0;
dy = mcuHeight;
restartMarker = 0xd0;
restart();
}
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,203
|
void BufStream::reset() {
int i;
str->reset();
for (i = 0; i < bufSize; ++i) {
buf[i] = str->getChar();
}
}
|
Overflow
| 0
|
void BufStream::reset() {
int i;
str->reset();
for (i = 0; i < bufSize; ++i) {
buf[i] = str->getChar();
}
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,204
|
void FixedLengthEncoder::reset() {
str->reset();
count = 0;
}
|
Overflow
| 0
|
void FixedLengthEncoder::reset() {
str->reset();
count = 0;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,205
|
void ASCII85Encoder::reset() {
str->reset();
bufPtr = bufEnd = buf;
lineLen = 0;
eof = gFalse;
}
|
Overflow
| 0
|
void ASCII85Encoder::reset() {
str->reset();
bufPtr = bufEnd = buf;
lineLen = 0;
eof = gFalse;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,206
|
void RunLengthEncoder::reset() {
str->reset();
bufPtr = bufEnd = nextEnd = buf;
eof = gFalse;
}
|
Overflow
| 0
|
void RunLengthEncoder::reset() {
str->reset();
bufPtr = bufEnd = nextEnd = buf;
eof = gFalse;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,207
|
void DCTStream::restart() {
int i;
inputBits = 0;
restartCtr = restartInterval;
for (i = 0; i < numComps; ++i) {
compInfo[i].prevDC = 0;
}
eobRun = 0;
}
|
Overflow
| 0
|
void DCTStream::restart() {
int i;
inputBits = 0;
restartCtr = restartInterval;
for (i = 0; i < numComps; ++i) {
compInfo[i].prevDC = 0;
}
eobRun = 0;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,208
|
void FilterStream::setPos(Guint pos, int dir) {
error(errInternal, -1, "Internal: called setPos() on FilterStream");
}
|
Overflow
| 0
|
void FilterStream::setPos(Guint pos, int dir) {
error(errInternal, -1, "Internal: called setPos() on FilterStream");
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,209
|
void CachedFileStream::setPos(Guint pos, int dir)
{
Guint size;
if (dir >= 0) {
cc->seek(pos, SEEK_SET);
bufPos = pos;
} else {
cc->seek(0, SEEK_END);
size = (Guint)cc->tell();
if (pos > size)
pos = (Guint)size;
cc->seek(-(int)pos, SEEK_END);
bufPos = (Guint)cc->tell();
}
bufPtr = bufEnd = buf;
}
|
Overflow
| 0
|
void CachedFileStream::setPos(Guint pos, int dir)
{
Guint size;
if (dir >= 0) {
cc->seek(pos, SEEK_SET);
bufPos = pos;
} else {
cc->seek(0, SEEK_END);
size = (Guint)cc->tell();
if (pos > size)
pos = (Guint)size;
cc->seek(-(int)pos, SEEK_END);
bufPos = (Guint)cc->tell();
}
bufPtr = bufEnd = buf;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,210
|
void MemStream::setPos(Guint pos, int dir) {
Guint i;
if (dir >= 0) {
i = pos;
} else {
i = start + length - pos;
}
if (i < start) {
i = start;
} else if (i > start + length) {
i = start + length;
}
bufPtr = buf + i;
}
|
Overflow
| 0
|
void MemStream::setPos(Guint pos, int dir) {
Guint i;
if (dir >= 0) {
i = pos;
} else {
i = start + length - pos;
}
if (i < start) {
i = start;
} else if (i > start + length) {
i = start + length;
}
bufPtr = buf + i;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,211
|
void EmbedStream::setPos(Guint pos, int dir) {
error(errInternal, -1, "Internal: called setPos() on EmbedStream");
}
|
Overflow
| 0
|
void EmbedStream::setPos(Guint pos, int dir) {
error(errInternal, -1, "Internal: called setPos() on EmbedStream");
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,212
|
void ImageStream::skipLine() {
str->doGetChars(inputLineSize, inputLine);
}
|
Overflow
| 0
|
void ImageStream::skipLine() {
str->doGetChars(inputLineSize, inputLine);
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,213
|
GBool FlateStream::startBlock() {
int blockHdr;
int c;
int check;
if (litCodeTab.codes != fixedLitCodeTab.codes) {
gfree(litCodeTab.codes);
}
litCodeTab.codes = NULL;
if (distCodeTab.codes != fixedDistCodeTab.codes) {
gfree(distCodeTab.codes);
}
distCodeTab.codes = NULL;
blockHdr = getCodeWord(3);
if (blockHdr & 1)
eof = gTrue;
blockHdr >>= 1;
if (blockHdr == 0) {
compressedBlock = gFalse;
if ((c = str->getChar()) == EOF)
goto err;
blockLen = c & 0xff;
if ((c = str->getChar()) == EOF)
goto err;
blockLen |= (c & 0xff) << 8;
if ((c = str->getChar()) == EOF)
goto err;
check = c & 0xff;
if ((c = str->getChar()) == EOF)
goto err;
check |= (c & 0xff) << 8;
if (check != (~blockLen & 0xffff))
error(errSyntaxError, getPos(), "Bad uncompressed block length in flate stream");
codeBuf = 0;
codeSize = 0;
} else if (blockHdr == 1) {
compressedBlock = gTrue;
loadFixedCodes();
} else if (blockHdr == 2) {
compressedBlock = gTrue;
if (!readDynamicCodes()) {
goto err;
}
} else {
goto err;
}
endOfBlock = gFalse;
return gTrue;
err:
error(errSyntaxError, getPos(), "Bad block header in flate stream");
endOfBlock = eof = gTrue;
return gFalse;
}
|
Overflow
| 0
|
GBool FlateStream::startBlock() {
int blockHdr;
int c;
int check;
if (litCodeTab.codes != fixedLitCodeTab.codes) {
gfree(litCodeTab.codes);
}
litCodeTab.codes = NULL;
if (distCodeTab.codes != fixedDistCodeTab.codes) {
gfree(distCodeTab.codes);
}
distCodeTab.codes = NULL;
blockHdr = getCodeWord(3);
if (blockHdr & 1)
eof = gTrue;
blockHdr >>= 1;
if (blockHdr == 0) {
compressedBlock = gFalse;
if ((c = str->getChar()) == EOF)
goto err;
blockLen = c & 0xff;
if ((c = str->getChar()) == EOF)
goto err;
blockLen |= (c & 0xff) << 8;
if ((c = str->getChar()) == EOF)
goto err;
check = c & 0xff;
if ((c = str->getChar()) == EOF)
goto err;
check |= (c & 0xff) << 8;
if (check != (~blockLen & 0xffff))
error(errSyntaxError, getPos(), "Bad uncompressed block length in flate stream");
codeBuf = 0;
codeSize = 0;
} else if (blockHdr == 1) {
compressedBlock = gTrue;
loadFixedCodes();
} else if (blockHdr == 2) {
compressedBlock = gTrue;
if (!readDynamicCodes()) {
goto err;
}
} else {
goto err;
}
endOfBlock = gFalse;
return gTrue;
err:
error(errSyntaxError, getPos(), "Bad block header in flate stream");
endOfBlock = eof = gTrue;
return gFalse;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,214
|
void CCITTFaxStream::unfilteredReset() {
ccittReset(gTrue);
}
|
Overflow
| 0
|
void CCITTFaxStream::unfilteredReset() {
ccittReset(gTrue);
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,215
|
void DCTStream::unfilteredReset() {
dctReset(gTrue);
}
|
Overflow
| 0
|
void DCTStream::unfilteredReset() {
dctReset(gTrue);
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,216
|
void FlateStream::unfilteredReset() {
flateReset(gTrue);
}
|
Overflow
| 0
|
void FlateStream::unfilteredReset() {
flateReset(gTrue);
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,217
|
ASCII85Encoder::~ASCII85Encoder() {
if (str->isEncoder())
delete str;
}
|
Overflow
| 0
|
ASCII85Encoder::~ASCII85Encoder() {
if (str->isEncoder())
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,218
|
ASCII85Stream::~ASCII85Stream() {
delete str;
}
|
Overflow
| 0
|
ASCII85Stream::~ASCII85Stream() {
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,219
|
ASCIIHexEncoder::~ASCIIHexEncoder() {
if (str->isEncoder()) {
delete str;
}
}
|
Overflow
| 0
|
ASCIIHexEncoder::~ASCIIHexEncoder() {
if (str->isEncoder()) {
delete str;
}
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,220
|
ASCIIHexStream::~ASCIIHexStream() {
delete str;
}
|
Overflow
| 0
|
ASCIIHexStream::~ASCIIHexStream() {
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,221
|
BaseStream::~BaseStream() {
dict.free();
}
|
Overflow
| 0
|
BaseStream::~BaseStream() {
dict.free();
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,222
|
BufStream::~BufStream() {
gfree(buf);
delete str;
}
|
Overflow
| 0
|
BufStream::~BufStream() {
gfree(buf);
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,223
|
CCITTFaxStream::~CCITTFaxStream() {
delete str;
gfree(refLine);
gfree(codingLine);
}
|
Overflow
| 0
|
CCITTFaxStream::~CCITTFaxStream() {
delete str;
gfree(refLine);
gfree(codingLine);
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,224
|
CMYKGrayEncoder::~CMYKGrayEncoder() {
if (str->isEncoder())
delete str;
}
|
Overflow
| 0
|
CMYKGrayEncoder::~CMYKGrayEncoder() {
if (str->isEncoder())
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,225
|
CachedFileStream::~CachedFileStream()
{
close();
cc->decRefCnt();
}
|
Overflow
| 0
|
CachedFileStream::~CachedFileStream()
{
close();
cc->decRefCnt();
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,226
|
DCTStream::~DCTStream() {
close();
delete str;
}
|
Overflow
| 0
|
DCTStream::~DCTStream() {
close();
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,227
|
EOFStream::~EOFStream() {
delete str;
}
|
Overflow
| 0
|
EOFStream::~EOFStream() {
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,228
|
EmbedStream::~EmbedStream() {
}
|
Overflow
| 0
|
EmbedStream::~EmbedStream() {
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,229
|
FileOutStream::~FileOutStream ()
{
close ();
}
|
Overflow
| 0
|
FileOutStream::~FileOutStream ()
{
close ();
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,230
|
FileStream::~FileStream() {
close();
}
|
Overflow
| 0
|
FileStream::~FileStream() {
close();
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,231
|
FixedLengthEncoder::~FixedLengthEncoder() {
if (str->isEncoder())
delete str;
}
|
Overflow
| 0
|
FixedLengthEncoder::~FixedLengthEncoder() {
if (str->isEncoder())
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,232
|
FlateStream::~FlateStream() {
if (litCodeTab.codes != fixedLitCodeTab.codes) {
gfree(litCodeTab.codes);
}
if (distCodeTab.codes != fixedDistCodeTab.codes) {
gfree(distCodeTab.codes);
}
if (pred) {
delete pred;
}
delete str;
}
|
Overflow
| 0
|
FlateStream::~FlateStream() {
if (litCodeTab.codes != fixedLitCodeTab.codes) {
gfree(litCodeTab.codes);
}
if (distCodeTab.codes != fixedDistCodeTab.codes) {
gfree(distCodeTab.codes);
}
if (pred) {
delete pred;
}
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,233
|
LZWStream::~LZWStream() {
if (pred) {
delete pred;
}
delete str;
}
|
Overflow
| 0
|
LZWStream::~LZWStream() {
if (pred) {
delete pred;
}
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,234
|
MemStream::~MemStream() {
if (needFree) {
gfree(buf);
}
}
|
Overflow
| 0
|
MemStream::~MemStream() {
if (needFree) {
gfree(buf);
}
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,235
|
OutStream::~OutStream ()
{
}
|
Overflow
| 0
|
OutStream::~OutStream ()
{
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,236
|
RGBGrayEncoder::~RGBGrayEncoder() {
if (str->isEncoder())
delete str;
}
|
Overflow
| 0
|
RGBGrayEncoder::~RGBGrayEncoder() {
if (str->isEncoder())
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,237
|
RunLengthEncoder::~RunLengthEncoder() {
if (str->isEncoder())
delete str;
}
|
Overflow
| 0
|
RunLengthEncoder::~RunLengthEncoder() {
if (str->isEncoder())
delete str;
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,238
|
Stream::~Stream() {
}
|
Overflow
| 0
|
Stream::~Stream() {
}
|
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
// Copyright (C) 2008 Julien Rebetez <julien@fhtagn.net>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -1712,8 +1712,9 @@ int CCITTFaxStream::lookChar() {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
- refLine[i++] = columns;
- refLine[i] = columns;
+ for (; i < columns + 2; ++i) {
+ refLine[i] = columns;
+ }
codingLine[0] = 0;
a0i = 0;
b1i = 0;
|
CWE-119
| null | null |
3,239
|
Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
SplashScreenParams *screenParams) {
int i;
bitmap = bitmapA;
vectorAntialias = vectorAntialiasA;
inShading = gFalse;
state = new SplashState(bitmap->width, bitmap->height, vectorAntialias,
screenParams);
if (vectorAntialias) {
aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize,
1, splashModeMono1, gFalse);
for (i = 0; i <= splashAASize * splashAASize; ++i) {
aaGamma[i] = (Guchar)splashRound(
splashPow((SplashCoord)i /
(SplashCoord)(splashAASize * splashAASize),
splashAAGamma) * 255);
}
} else {
aaBuf = NULL;
}
minLineWidth = 0;
clearModRegion();
debugMode = gFalse;
}
|
DoS
| 0
|
Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
SplashScreenParams *screenParams) {
int i;
bitmap = bitmapA;
vectorAntialias = vectorAntialiasA;
inShading = gFalse;
state = new SplashState(bitmap->width, bitmap->height, vectorAntialias,
screenParams);
if (vectorAntialias) {
aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize,
1, splashModeMono1, gFalse);
for (i = 0; i <= splashAASize * splashAASize; ++i) {
aaGamma[i] = (Guchar)splashRound(
splashPow((SplashCoord)i /
(SplashCoord)(splashAASize * splashAASize),
splashAAGamma) * 255);
}
} else {
aaBuf = NULL;
}
minLineWidth = 0;
clearModRegion();
debugMode = gFalse;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,240
|
Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
SplashScreen *screenA) {
int i;
bitmap = bitmapA;
inShading = gFalse;
vectorAntialias = vectorAntialiasA;
state = new SplashState(bitmap->width, bitmap->height, vectorAntialias,
screenA);
if (vectorAntialias) {
aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize,
1, splashModeMono1, gFalse);
for (i = 0; i <= splashAASize * splashAASize; ++i) {
aaGamma[i] = (Guchar)splashRound(
splashPow((SplashCoord)i /
(SplashCoord)(splashAASize * splashAASize),
splashAAGamma) * 255);
}
} else {
aaBuf = NULL;
}
minLineWidth = 0;
clearModRegion();
debugMode = gFalse;
}
|
DoS
| 0
|
Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
SplashScreen *screenA) {
int i;
bitmap = bitmapA;
inShading = gFalse;
vectorAntialias = vectorAntialiasA;
state = new SplashState(bitmap->width, bitmap->height, vectorAntialias,
screenA);
if (vectorAntialias) {
aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize,
1, splashModeMono1, gFalse);
for (i = 0; i <= splashAASize * splashAASize; ++i) {
aaGamma[i] = (Guchar)splashRound(
splashPow((SplashCoord)i /
(SplashCoord)(splashAASize * splashAASize),
splashAAGamma) * 255);
}
} else {
aaBuf = NULL;
}
minLineWidth = 0;
clearModRegion();
debugMode = gFalse;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,241
|
void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest,
SplashClipResult clipRes) {
SplashPipe pipe;
SplashColor pixel;
Guchar *ap;
int w, h, x0, y0, x1, y1, x, y;
w = src->getWidth();
h = src->getHeight();
if (clipRes == splashClipAllInside) {
x0 = 0;
y0 = 0;
x1 = w;
y1 = h;
} else {
if (state->clip->getNumPaths()) {
x0 = x1 = w;
y0 = y1 = h;
} else {
if ((x0 = splashCeil(state->clip->getXMin()) - xDest) < 0) {
x0 = 0;
}
if ((y0 = splashCeil(state->clip->getYMin()) - yDest) < 0) {
y0 = 0;
}
if ((x1 = splashFloor(state->clip->getXMax()) - xDest) > w) {
x1 = w;
}
if (x1 < x0) {
x1 = x0;
}
if ((y1 = splashFloor(state->clip->getYMax()) - yDest) > h) {
y1 = h;
}
if (y1 < y0) {
y1 = y0;
}
}
}
if (x0 < w && y0 < h && x0 < x1 && y0 < y1) {
pipeInit(&pipe, xDest + x0, yDest + y0, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse);
if (srcAlpha) {
for (y = y0; y < y1; ++y) {
pipeSetXY(&pipe, xDest + x0, yDest + y);
ap = src->getAlphaPtr() + y * w + x0;
for (x = x0; x < x1; ++x) {
src->getPixel(x, y, pixel);
pipe.shape = *ap++;
(this->*pipe.run)(&pipe);
}
}
} else {
for (y = y0; y < y1; ++y) {
pipeSetXY(&pipe, xDest + x0, yDest + y);
for (x = x0; x < x1; ++x) {
src->getPixel(x, y, pixel);
(this->*pipe.run)(&pipe);
}
}
}
updateModX(xDest + x0);
updateModX(xDest + x1 - 1);
updateModY(yDest + y0);
updateModY(yDest + y1 - 1);
}
if (y0 > 0) {
blitImageClipped(src, srcAlpha, 0, 0, xDest, yDest, w, y0);
}
if (y1 < h) {
blitImageClipped(src, srcAlpha, 0, y1, xDest, yDest + y1, w, h - y1);
}
if (x0 > 0 && y0 < y1) {
blitImageClipped(src, srcAlpha, 0, y0, xDest, yDest + y0, x0, y1 - y0);
}
if (x1 < w && y0 < y1) {
blitImageClipped(src, srcAlpha, x1, y0, xDest + x1, yDest + y0,
w - x1, y1 - y0);
}
}
|
DoS
| 0
|
void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest,
SplashClipResult clipRes) {
SplashPipe pipe;
SplashColor pixel;
Guchar *ap;
int w, h, x0, y0, x1, y1, x, y;
w = src->getWidth();
h = src->getHeight();
if (clipRes == splashClipAllInside) {
x0 = 0;
y0 = 0;
x1 = w;
y1 = h;
} else {
if (state->clip->getNumPaths()) {
x0 = x1 = w;
y0 = y1 = h;
} else {
if ((x0 = splashCeil(state->clip->getXMin()) - xDest) < 0) {
x0 = 0;
}
if ((y0 = splashCeil(state->clip->getYMin()) - yDest) < 0) {
y0 = 0;
}
if ((x1 = splashFloor(state->clip->getXMax()) - xDest) > w) {
x1 = w;
}
if (x1 < x0) {
x1 = x0;
}
if ((y1 = splashFloor(state->clip->getYMax()) - yDest) > h) {
y1 = h;
}
if (y1 < y0) {
y1 = y0;
}
}
}
if (x0 < w && y0 < h && x0 < x1 && y0 < y1) {
pipeInit(&pipe, xDest + x0, yDest + y0, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse);
if (srcAlpha) {
for (y = y0; y < y1; ++y) {
pipeSetXY(&pipe, xDest + x0, yDest + y);
ap = src->getAlphaPtr() + y * w + x0;
for (x = x0; x < x1; ++x) {
src->getPixel(x, y, pixel);
pipe.shape = *ap++;
(this->*pipe.run)(&pipe);
}
}
} else {
for (y = y0; y < y1; ++y) {
pipeSetXY(&pipe, xDest + x0, yDest + y);
for (x = x0; x < x1; ++x) {
src->getPixel(x, y, pixel);
(this->*pipe.run)(&pipe);
}
}
}
updateModX(xDest + x0);
updateModX(xDest + x1 - 1);
updateModY(yDest + y0);
updateModY(yDest + y1 - 1);
}
if (y0 > 0) {
blitImageClipped(src, srcAlpha, 0, 0, xDest, yDest, w, y0);
}
if (y1 < h) {
blitImageClipped(src, srcAlpha, 0, y1, xDest, yDest + y1, w, h - y1);
}
if (x0 > 0 && y0 < y1) {
blitImageClipped(src, srcAlpha, 0, y0, xDest, yDest + y0, x0, y1 - y0);
}
if (x1 < w && y0 < y1) {
blitImageClipped(src, srcAlpha, x1, y0, xDest + x1, yDest + y0,
w - x1, y1 - y0);
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,242
|
void Splash::blitImageClipped(SplashBitmap *src, GBool srcAlpha,
int xSrc, int ySrc, int xDest, int yDest,
int w, int h) {
SplashPipe pipe;
SplashColor pixel;
Guchar *ap;
int x, y;
if (vectorAntialias) {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
if (srcAlpha) {
for (y = 0; y < h; ++y) {
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
pipe.shape = *ap++;
drawAAPixel(&pipe, xDest + x, yDest + y);
}
}
} else {
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
pipe.shape = 255;
drawAAPixel(&pipe, xDest + x, yDest + y);
}
}
}
} else {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse);
if (srcAlpha) {
for (y = 0; y < h; ++y) {
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
if (state->clip->test(xDest + x, yDest + y)) {
src->getPixel(xSrc + x, ySrc + y, pixel);
pipe.shape = *ap++;
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
++ap;
}
}
}
} else {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
if (state->clip->test(xDest + x, yDest + y)) {
src->getPixel(xSrc + x, ySrc + y, pixel);
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
}
}
}
}
}
}
|
DoS
| 0
|
void Splash::blitImageClipped(SplashBitmap *src, GBool srcAlpha,
int xSrc, int ySrc, int xDest, int yDest,
int w, int h) {
SplashPipe pipe;
SplashColor pixel;
Guchar *ap;
int x, y;
if (vectorAntialias) {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
if (srcAlpha) {
for (y = 0; y < h; ++y) {
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
pipe.shape = *ap++;
drawAAPixel(&pipe, xDest + x, yDest + y);
}
}
} else {
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
pipe.shape = 255;
drawAAPixel(&pipe, xDest + x, yDest + y);
}
}
}
} else {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse);
if (srcAlpha) {
for (y = 0; y < h; ++y) {
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
if (state->clip->test(xDest + x, yDest + y)) {
src->getPixel(xSrc + x, ySrc + y, pixel);
pipe.shape = *ap++;
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
++ap;
}
}
}
} else {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
if (state->clip->test(xDest + x, yDest + y)) {
src->getPixel(xSrc + x, ySrc + y, pixel);
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
}
}
}
}
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,243
|
void Splash::clear(SplashColorPtr color, Guchar alpha) {
SplashColorPtr row, p;
Guchar mono;
int x, y;
switch (bitmap->mode) {
case splashModeMono1:
mono = (color[0] & 0x80) ? 0xff : 0x00;
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
mono, -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, mono, bitmap->rowSize * bitmap->height);
}
break;
case splashModeMono8:
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
break;
case splashModeRGB8:
if (color[0] == color[1] && color[1] == color[2]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[2];
*p++ = color[1];
*p++ = color[0];
}
row += bitmap->rowSize;
}
}
break;
case splashModeXBGR8:
if (color[0] == color[1] && color[1] == color[2]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[0];
*p++ = color[1];
*p++ = color[2];
*p++ = 255;
}
row += bitmap->rowSize;
}
}
break;
case splashModeBGR8:
if (color[0] == color[1] && color[1] == color[2]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[0];
*p++ = color[1];
*p++ = color[2];
}
row += bitmap->rowSize;
}
}
break;
#if SPLASH_CMYK
case splashModeCMYK8:
if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[0];
*p++ = color[1];
*p++ = color[2];
*p++ = color[3];
}
row += bitmap->rowSize;
}
}
break;
case splashModeDeviceN8:
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*p++ = color[cp];
}
row += bitmap->rowSize;
}
break;
#endif
}
if (bitmap->alpha) {
memset(bitmap->alpha, alpha, bitmap->width * bitmap->height);
}
updateModX(0);
updateModY(0);
updateModX(bitmap->width - 1);
updateModY(bitmap->height - 1);
}
|
DoS
| 0
|
void Splash::clear(SplashColorPtr color, Guchar alpha) {
SplashColorPtr row, p;
Guchar mono;
int x, y;
switch (bitmap->mode) {
case splashModeMono1:
mono = (color[0] & 0x80) ? 0xff : 0x00;
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
mono, -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, mono, bitmap->rowSize * bitmap->height);
}
break;
case splashModeMono8:
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
break;
case splashModeRGB8:
if (color[0] == color[1] && color[1] == color[2]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[2];
*p++ = color[1];
*p++ = color[0];
}
row += bitmap->rowSize;
}
}
break;
case splashModeXBGR8:
if (color[0] == color[1] && color[1] == color[2]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[0];
*p++ = color[1];
*p++ = color[2];
*p++ = 255;
}
row += bitmap->rowSize;
}
}
break;
case splashModeBGR8:
if (color[0] == color[1] && color[1] == color[2]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[0];
*p++ = color[1];
*p++ = color[2];
}
row += bitmap->rowSize;
}
}
break;
#if SPLASH_CMYK
case splashModeCMYK8:
if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) {
if (bitmap->rowSize < 0) {
memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1),
color[0], -bitmap->rowSize * bitmap->height);
} else {
memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height);
}
} else {
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
*p++ = color[0];
*p++ = color[1];
*p++ = color[2];
*p++ = color[3];
}
row += bitmap->rowSize;
}
}
break;
case splashModeDeviceN8:
row = bitmap->data;
for (y = 0; y < bitmap->height; ++y) {
p = row;
for (x = 0; x < bitmap->width; ++x) {
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*p++ = color[cp];
}
row += bitmap->rowSize;
}
break;
#endif
}
if (bitmap->alpha) {
memset(bitmap->alpha, alpha, bitmap->width * bitmap->height);
}
updateModX(0);
updateModY(0);
updateModX(bitmap->width - 1);
updateModY(bitmap->height - 1);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,244
|
static inline Guchar clip255(int x) {
return x < 0 ? 0 : x > 255 ? 255 : x;
}
|
DoS
| 0
|
static inline Guchar clip255(int x) {
return x < 0 ? 0 : x > 255 ? 255 : x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,245
|
SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc,
int xDest, int yDest, int w, int h,
GBool noClip, GBool nonIsolated,
GBool knockout, SplashCoord knockoutOpacity) {
SplashPipe pipe;
SplashColor pixel;
Guchar alpha;
Guchar *ap;
int x, y;
if (src->mode != bitmap->mode) {
return splashErrModeMismatch;
}
if(src->getSeparationList()->getLength() > bitmap->getSeparationList()->getLength()) {
for (x = bitmap->getSeparationList()->getLength(); x < src->getSeparationList()->getLength(); x++)
bitmap->getSeparationList()->append(((GfxSeparationColorSpace *)src->getSeparationList()->get(x))->copy());
}
if (src->alpha) {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, nonIsolated,
knockout, (Guchar)splashRound(knockoutOpacity * 255));
if (noClip) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
alpha = *ap++;
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
}
}
updateModX(xDest);
updateModX(xDest + w - 1);
updateModY(yDest);
updateModY(yDest + h - 1);
} else {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
alpha = *ap++;
if (state->clip->test(xDest + x, yDest + y)) {
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
}
}
}
}
} else {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), gFalse, nonIsolated);
if (noClip) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
(this->*pipe.run)(&pipe);
}
}
updateModX(xDest);
updateModX(xDest + w - 1);
updateModY(yDest);
updateModY(yDest + h - 1);
} else {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
if (state->clip->test(xDest + x, yDest + y)) {
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
}
}
}
}
}
return splashOk;
}
|
DoS
| 0
|
SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc,
int xDest, int yDest, int w, int h,
GBool noClip, GBool nonIsolated,
GBool knockout, SplashCoord knockoutOpacity) {
SplashPipe pipe;
SplashColor pixel;
Guchar alpha;
Guchar *ap;
int x, y;
if (src->mode != bitmap->mode) {
return splashErrModeMismatch;
}
if(src->getSeparationList()->getLength() > bitmap->getSeparationList()->getLength()) {
for (x = bitmap->getSeparationList()->getLength(); x < src->getSeparationList()->getLength(); x++)
bitmap->getSeparationList()->append(((GfxSeparationColorSpace *)src->getSeparationList()->get(x))->copy());
}
if (src->alpha) {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, nonIsolated,
knockout, (Guchar)splashRound(knockoutOpacity * 255));
if (noClip) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
alpha = *ap++;
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
}
}
updateModX(xDest);
updateModX(xDest + w - 1);
updateModY(yDest);
updateModY(yDest + h - 1);
} else {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc;
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
alpha = *ap++;
if (state->clip->test(xDest + x, yDest + y)) {
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
}
}
}
}
} else {
pipeInit(&pipe, xDest, yDest, NULL, pixel,
(Guchar)splashRound(state->fillAlpha * 255), gFalse, nonIsolated);
if (noClip) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
(this->*pipe.run)(&pipe);
}
}
updateModX(xDest);
updateModX(xDest + w - 1);
updateModY(yDest);
updateModY(yDest + h - 1);
} else {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
src->getPixel(xSrc + x, ySrc + y, pixel);
if (state->clip->test(xDest + x, yDest + y)) {
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
}
}
}
}
}
return splashOk;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,246
|
void Splash::compositeBackground(SplashColorPtr color) {
SplashColorPtr p;
Guchar *q;
Guchar alpha, alpha1, c, color0, color1, color2;
#if SPLASH_CMYK
Guchar color3;
Guchar colorsp[SPOT_NCOMPS+4], cp;
#endif
int x, y, mask;
if (unlikely(bitmap->alpha == NULL)) {
error(errInternal, -1, "bitmap->alpha is NULL in Splash::compositeBackground");
return;
}
switch (bitmap->mode) {
case splashModeMono1:
color0 = color[0];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
mask = 0x80;
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
alpha1 = 255 - alpha;
c = (*p & mask) ? 0xff : 0x00;
c = div255(alpha1 * color0 + alpha * c);
if (c & 0x80) {
*p |= mask;
} else {
*p &= ~mask;
}
if (!(mask >>= 1)) {
mask = 0x80;
++p;
}
}
}
break;
case splashModeMono8:
color0 = color[0];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
++p;
}
}
break;
case splashModeRGB8:
case splashModeBGR8:
color0 = color[0];
color1 = color[1];
color2 = color[2];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
p[0] = color0;
p[1] = color1;
p[2] = color2;
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
p[1] = div255(alpha1 * color1 + alpha * p[1]);
p[2] = div255(alpha1 * color2 + alpha * p[2]);
}
p += 3;
}
}
break;
case splashModeXBGR8:
color0 = color[0];
color1 = color[1];
color2 = color[2];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
p[0] = color0;
p[1] = color1;
p[2] = color2;
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
p[1] = div255(alpha1 * color1 + alpha * p[1]);
p[2] = div255(alpha1 * color2 + alpha * p[2]);
}
p[3] = 255;
p += 4;
}
}
break;
#if SPLASH_CMYK
case splashModeCMYK8:
color0 = color[0];
color1 = color[1];
color2 = color[2];
color3 = color[3];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
p[0] = color0;
p[1] = color1;
p[2] = color2;
p[3] = color3;
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
p[1] = div255(alpha1 * color1 + alpha * p[1]);
p[2] = div255(alpha1 * color2 + alpha * p[2]);
p[3] = div255(alpha1 * color3 + alpha * p[3]);
}
p += 4;
}
}
break;
case splashModeDeviceN8:
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
colorsp[cp] = color[cp];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
p[cp] = colorsp[cp];
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
p[cp] = div255(alpha1 * colorsp[cp] + alpha * p[cp]);
}
p += (SPOT_NCOMPS+4);
}
}
break;
#endif
}
memset(bitmap->alpha, 255, bitmap->width * bitmap->height);
}
|
DoS
| 0
|
void Splash::compositeBackground(SplashColorPtr color) {
SplashColorPtr p;
Guchar *q;
Guchar alpha, alpha1, c, color0, color1, color2;
#if SPLASH_CMYK
Guchar color3;
Guchar colorsp[SPOT_NCOMPS+4], cp;
#endif
int x, y, mask;
if (unlikely(bitmap->alpha == NULL)) {
error(errInternal, -1, "bitmap->alpha is NULL in Splash::compositeBackground");
return;
}
switch (bitmap->mode) {
case splashModeMono1:
color0 = color[0];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
mask = 0x80;
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
alpha1 = 255 - alpha;
c = (*p & mask) ? 0xff : 0x00;
c = div255(alpha1 * color0 + alpha * c);
if (c & 0x80) {
*p |= mask;
} else {
*p &= ~mask;
}
if (!(mask >>= 1)) {
mask = 0x80;
++p;
}
}
}
break;
case splashModeMono8:
color0 = color[0];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
++p;
}
}
break;
case splashModeRGB8:
case splashModeBGR8:
color0 = color[0];
color1 = color[1];
color2 = color[2];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
p[0] = color0;
p[1] = color1;
p[2] = color2;
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
p[1] = div255(alpha1 * color1 + alpha * p[1]);
p[2] = div255(alpha1 * color2 + alpha * p[2]);
}
p += 3;
}
}
break;
case splashModeXBGR8:
color0 = color[0];
color1 = color[1];
color2 = color[2];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
p[0] = color0;
p[1] = color1;
p[2] = color2;
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
p[1] = div255(alpha1 * color1 + alpha * p[1]);
p[2] = div255(alpha1 * color2 + alpha * p[2]);
}
p[3] = 255;
p += 4;
}
}
break;
#if SPLASH_CMYK
case splashModeCMYK8:
color0 = color[0];
color1 = color[1];
color2 = color[2];
color3 = color[3];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
p[0] = color0;
p[1] = color1;
p[2] = color2;
p[3] = color3;
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
p[0] = div255(alpha1 * color0 + alpha * p[0]);
p[1] = div255(alpha1 * color1 + alpha * p[1]);
p[2] = div255(alpha1 * color2 + alpha * p[2]);
p[3] = div255(alpha1 * color3 + alpha * p[3]);
}
p += 4;
}
}
break;
case splashModeDeviceN8:
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
colorsp[cp] = color[cp];
for (y = 0; y < bitmap->height; ++y) {
p = &bitmap->data[y * bitmap->rowSize];
q = &bitmap->alpha[y * bitmap->width];
for (x = 0; x < bitmap->width; ++x) {
alpha = *q++;
if (alpha == 0)
{
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
p[cp] = colorsp[cp];
}
else if (alpha != 255)
{
alpha1 = 255 - alpha;
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
p[cp] = div255(alpha1 * colorsp[cp] + alpha * p[cp]);
}
p += (SPOT_NCOMPS+4);
}
}
break;
#endif
}
memset(bitmap->alpha, 255, bitmap->width * bitmap->height);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,247
|
inline void Splash::drawAAPixel(SplashPipe *pipe, int x, int y) {
#if splashAASize == 4
static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4 };
int w;
#else
int xx, yy;
#endif
SplashColorPtr p;
int x0, x1, t;
if (x < 0 || x >= bitmap->width ||
y < state->clip->getYMinI() || y > state->clip->getYMaxI()) {
return;
}
if (y != aaBufY) {
memset(aaBuf->getDataPtr(), 0xff,
aaBuf->getRowSize() * aaBuf->getHeight());
x0 = 0;
x1 = bitmap->width - 1;
state->clip->clipAALine(aaBuf, &x0, &x1, y);
aaBufY = y;
}
#if splashAASize == 4
p = aaBuf->getDataPtr() + (x >> 1);
w = aaBuf->getRowSize();
if (x & 1) {
t = bitCount4[*p & 0x0f] + bitCount4[p[w] & 0x0f] +
bitCount4[p[2*w] & 0x0f] + bitCount4[p[3*w] & 0x0f];
} else {
t = bitCount4[*p >> 4] + bitCount4[p[w] >> 4] +
bitCount4[p[2*w] >> 4] + bitCount4[p[3*w] >> 4];
}
#else
t = 0;
for (yy = 0; yy < splashAASize; ++yy) {
for (xx = 0; xx < splashAASize; ++xx) {
p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() +
((x * splashAASize + xx) >> 3);
t += (*p >> (7 - ((x * splashAASize + xx) & 7))) & 1;
}
}
#endif
if (t != 0) {
pipeSetXY(pipe, x, y);
pipe->shape = div255(aaGamma[t] * pipe->shape);
(this->*pipe->run)(pipe);
updateModX(x);
updateModY(y);
}
}
|
DoS
| 0
|
inline void Splash::drawAAPixel(SplashPipe *pipe, int x, int y) {
#if splashAASize == 4
static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4 };
int w;
#else
int xx, yy;
#endif
SplashColorPtr p;
int x0, x1, t;
if (x < 0 || x >= bitmap->width ||
y < state->clip->getYMinI() || y > state->clip->getYMaxI()) {
return;
}
if (y != aaBufY) {
memset(aaBuf->getDataPtr(), 0xff,
aaBuf->getRowSize() * aaBuf->getHeight());
x0 = 0;
x1 = bitmap->width - 1;
state->clip->clipAALine(aaBuf, &x0, &x1, y);
aaBufY = y;
}
#if splashAASize == 4
p = aaBuf->getDataPtr() + (x >> 1);
w = aaBuf->getRowSize();
if (x & 1) {
t = bitCount4[*p & 0x0f] + bitCount4[p[w] & 0x0f] +
bitCount4[p[2*w] & 0x0f] + bitCount4[p[3*w] & 0x0f];
} else {
t = bitCount4[*p >> 4] + bitCount4[p[w] >> 4] +
bitCount4[p[2*w] >> 4] + bitCount4[p[3*w] >> 4];
}
#else
t = 0;
for (yy = 0; yy < splashAASize; ++yy) {
for (xx = 0; xx < splashAASize; ++xx) {
p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() +
((x * splashAASize + xx) >> 3);
t += (*p >> (7 - ((x * splashAASize + xx) & 7))) & 1;
}
}
#endif
if (t != 0) {
pipeSetXY(pipe, x, y);
pipe->shape = div255(aaGamma[t] * pipe->shape);
(this->*pipe->run)(pipe);
updateModX(x);
updateModY(y);
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,248
|
SplashError Splash::drawImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, GBool srcAlpha,
int w, int h, SplashCoord *mat, GBool interpolate,
GBool tilingPattern) {
GBool ok;
SplashBitmap *scaledImg;
SplashClipResult clipRes;
GBool minorAxisZero;
int x0, y0, x1, y1, scaledWidth, scaledHeight;
int nComps;
int yp;
if (debugMode) {
printf("drawImage: srcMode=%d srcAlpha=%d w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n",
srcMode, srcAlpha, w, h, (double)mat[0], (double)mat[1], (double)mat[2],
(double)mat[3], (double)mat[4], (double)mat[5]);
}
ok = gFalse; // make gcc happy
nComps = 0; // make gcc happy
switch (bitmap->mode) {
case splashModeMono1:
case splashModeMono8:
ok = srcMode == splashModeMono8;
nComps = 1;
break;
case splashModeRGB8:
ok = srcMode == splashModeRGB8;
nComps = 3;
break;
case splashModeXBGR8:
ok = srcMode == splashModeXBGR8;
nComps = 4;
break;
case splashModeBGR8:
ok = srcMode == splashModeBGR8;
nComps = 3;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
ok = srcMode == splashModeCMYK8;
nComps = 4;
break;
case splashModeDeviceN8:
ok = srcMode == splashModeDeviceN8;
nComps = SPOT_NCOMPS+4;
break;
#endif
default:
ok = gFalse;
break;
}
if (!ok) {
return splashErrModeMismatch;
}
if (!splashCheckDet(mat[0], mat[1], mat[2], mat[3], 0.000001)) {
return splashErrSingularMatrix;
}
minorAxisZero = mat[1] == 0 && mat[2] == 0;
if (mat[0] > 0 && minorAxisZero && mat[3] > 0) {
x0 = imgCoordMungeLower(mat[4]);
y0 = imgCoordMungeLower(mat[5]);
x1 = imgCoordMungeUpper(mat[0] + mat[4]);
y1 = imgCoordMungeUpper(mat[3] + mat[5]);
if (x0 == x1) {
++x1;
}
if (y0 == y1) {
++y1;
}
clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1);
opClipRes = clipRes;
if (clipRes != splashClipAllOutside) {
scaledWidth = x1 - x0;
scaledHeight = y1 - y0;
yp = h / scaledHeight;
if (yp < 0 || yp > INT_MAX - 1) {
return splashErrBadArg;
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
scaledWidth, scaledHeight, interpolate);
if (scaledImg == NULL) {
return splashErrBadArg;
}
blitImage(scaledImg, srcAlpha, x0, y0, clipRes);
delete scaledImg;
}
} else if (mat[0] > 0 && minorAxisZero && mat[3] < 0) {
x0 = imgCoordMungeLower(mat[4]);
y0 = imgCoordMungeLower(mat[3] + mat[5]);
x1 = imgCoordMungeUpper(mat[0] + mat[4]);
y1 = imgCoordMungeUpper(mat[5]);
if (x0 == x1) {
if (mat[4] + mat[0] * 0.5 < x0) {
--x0;
} else {
++x1;
}
}
if (y0 == y1) {
if (mat[5] + mat[1] * 0.5 < y0) {
--y0;
} else {
++y1;
}
}
clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1);
opClipRes = clipRes;
if (clipRes != splashClipAllOutside) {
scaledWidth = x1 - x0;
scaledHeight = y1 - y0;
yp = h / scaledHeight;
if (yp < 0 || yp > INT_MAX - 1) {
return splashErrBadArg;
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
scaledWidth, scaledHeight, interpolate);
if (scaledImg == NULL) {
return splashErrBadArg;
}
vertFlipImage(scaledImg, scaledWidth, scaledHeight, nComps);
blitImage(scaledImg, srcAlpha, x0, y0, clipRes);
delete scaledImg;
}
} else {
return arbitraryTransformImage(src, srcData, srcMode, nComps, srcAlpha,
w, h, mat, interpolate, tilingPattern);
}
return splashOk;
}
|
DoS
| 0
|
SplashError Splash::drawImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, GBool srcAlpha,
int w, int h, SplashCoord *mat, GBool interpolate,
GBool tilingPattern) {
GBool ok;
SplashBitmap *scaledImg;
SplashClipResult clipRes;
GBool minorAxisZero;
int x0, y0, x1, y1, scaledWidth, scaledHeight;
int nComps;
int yp;
if (debugMode) {
printf("drawImage: srcMode=%d srcAlpha=%d w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n",
srcMode, srcAlpha, w, h, (double)mat[0], (double)mat[1], (double)mat[2],
(double)mat[3], (double)mat[4], (double)mat[5]);
}
ok = gFalse; // make gcc happy
nComps = 0; // make gcc happy
switch (bitmap->mode) {
case splashModeMono1:
case splashModeMono8:
ok = srcMode == splashModeMono8;
nComps = 1;
break;
case splashModeRGB8:
ok = srcMode == splashModeRGB8;
nComps = 3;
break;
case splashModeXBGR8:
ok = srcMode == splashModeXBGR8;
nComps = 4;
break;
case splashModeBGR8:
ok = srcMode == splashModeBGR8;
nComps = 3;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
ok = srcMode == splashModeCMYK8;
nComps = 4;
break;
case splashModeDeviceN8:
ok = srcMode == splashModeDeviceN8;
nComps = SPOT_NCOMPS+4;
break;
#endif
default:
ok = gFalse;
break;
}
if (!ok) {
return splashErrModeMismatch;
}
if (!splashCheckDet(mat[0], mat[1], mat[2], mat[3], 0.000001)) {
return splashErrSingularMatrix;
}
minorAxisZero = mat[1] == 0 && mat[2] == 0;
if (mat[0] > 0 && minorAxisZero && mat[3] > 0) {
x0 = imgCoordMungeLower(mat[4]);
y0 = imgCoordMungeLower(mat[5]);
x1 = imgCoordMungeUpper(mat[0] + mat[4]);
y1 = imgCoordMungeUpper(mat[3] + mat[5]);
if (x0 == x1) {
++x1;
}
if (y0 == y1) {
++y1;
}
clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1);
opClipRes = clipRes;
if (clipRes != splashClipAllOutside) {
scaledWidth = x1 - x0;
scaledHeight = y1 - y0;
yp = h / scaledHeight;
if (yp < 0 || yp > INT_MAX - 1) {
return splashErrBadArg;
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
scaledWidth, scaledHeight, interpolate);
if (scaledImg == NULL) {
return splashErrBadArg;
}
blitImage(scaledImg, srcAlpha, x0, y0, clipRes);
delete scaledImg;
}
} else if (mat[0] > 0 && minorAxisZero && mat[3] < 0) {
x0 = imgCoordMungeLower(mat[4]);
y0 = imgCoordMungeLower(mat[3] + mat[5]);
x1 = imgCoordMungeUpper(mat[0] + mat[4]);
y1 = imgCoordMungeUpper(mat[5]);
if (x0 == x1) {
if (mat[4] + mat[0] * 0.5 < x0) {
--x0;
} else {
++x1;
}
}
if (y0 == y1) {
if (mat[5] + mat[1] * 0.5 < y0) {
--y0;
} else {
++y1;
}
}
clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1);
opClipRes = clipRes;
if (clipRes != splashClipAllOutside) {
scaledWidth = x1 - x0;
scaledHeight = y1 - y0;
yp = h / scaledHeight;
if (yp < 0 || yp > INT_MAX - 1) {
return splashErrBadArg;
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
scaledWidth, scaledHeight, interpolate);
if (scaledImg == NULL) {
return splashErrBadArg;
}
vertFlipImage(scaledImg, scaledWidth, scaledHeight, nComps);
blitImage(scaledImg, srcAlpha, x0, y0, clipRes);
delete scaledImg;
}
} else {
return arbitraryTransformImage(src, srcData, srcMode, nComps, srcAlpha,
w, h, mat, interpolate, tilingPattern);
}
return splashOk;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,249
|
inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, GBool noClip) {
if (unlikely(y < 0))
return;
if (noClip || state->clip->test(x, y)) {
pipeSetXY(pipe, x, y);
(this->*pipe->run)(pipe);
updateModX(x);
updateModY(y);
}
}
|
DoS
| 0
|
inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, GBool noClip) {
if (unlikely(y < 0))
return;
if (noClip || state->clip->test(x, y)) {
pipeSetXY(pipe, x, y);
(this->*pipe->run)(pipe);
updateModX(x);
updateModY(y);
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,250
|
static void expandRow(Guchar *srcBuf, Guchar *dstBuf, int srcWidth, int scaledWidth, int nComps)
{
double xStep = (double)srcWidth/scaledWidth;
double xSrc = 0.0;
double xFrac, xInt;
int p;
for (int i = 0; i < nComps; i++)
srcBuf[srcWidth*nComps + i] = srcBuf[(srcWidth-1)*nComps + i];
for (int x = 0; x < scaledWidth; x++) {
xFrac = modf(xSrc, &xInt);
p = (int)xInt;
for (int c = 0; c < nComps; c++) {
dstBuf[nComps*x + c] = srcBuf[nComps*p + c]*(1.0 - xFrac) + srcBuf[nComps*(p+1) + c]*xFrac;
}
xSrc += xStep;
}
}
|
DoS
| 0
|
static void expandRow(Guchar *srcBuf, Guchar *dstBuf, int srcWidth, int scaledWidth, int nComps)
{
double xStep = (double)srcWidth/scaledWidth;
double xSrc = 0.0;
double xFrac, xInt;
int p;
for (int i = 0; i < nComps; i++)
srcBuf[srcWidth*nComps + i] = srcBuf[(srcWidth-1)*nComps + i];
for (int x = 0; x < scaledWidth; x++) {
xFrac = modf(xSrc, &xInt);
p = (int)xInt;
for (int c = 0; c < nComps; c++) {
dstBuf[nComps*x + c] = srcBuf[nComps*p + c]*(1.0 - xFrac) + srcBuf[nComps*(p+1) + c]*xFrac;
}
xSrc += xStep;
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,251
|
void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) {
SplashPipe pipe;
int alpha0;
Guchar alpha;
Guchar *p;
int x1, y1, xx, xx1, yy;
p = glyph->data;
int xStart = x0 - glyph->x;
int yStart = y0 - glyph->y;
int xxLimit = glyph->w;
int yyLimit = glyph->h;
int xShift = 0;
if (yStart < 0)
{
p += (glyph->aa ? glyph->w : splashCeil(glyph->w / 8.0)) * -yStart; // move p to the beginning of the first painted row
yyLimit += yStart;
yStart = 0;
}
if (xStart < 0)
{
if (glyph->aa) {
p += -xStart;
} else {
p += (-xStart) / 8;
xShift = (-xStart) % 8;
}
xxLimit += xStart;
xStart = 0;
}
if (xxLimit + xStart >= bitmap->width) xxLimit = bitmap->width - xStart;
if (yyLimit + yStart >= bitmap->height) yyLimit = bitmap->height - yStart;
if (noClip) {
if (glyph->aa) {
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) {
alpha = p[xx];
if (alpha != 0) {
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
}
p += glyph->w;
}
} else {
const int widthEight = splashCeil(glyph->w / 8.0);
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) {
alpha0 = (xShift > 0 ? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)) : p[xx / 8]);
for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) {
if (alpha0 & 0x80) {
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
alpha0 <<= 1;
}
}
p += widthEight;
}
}
} else {
if (glyph->aa) {
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) {
if (state->clip->test(x1, y1)) {
alpha = p[xx];
if (alpha != 0) {
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
} else {
pipeIncX(&pipe);
}
}
p += glyph->w;
}
} else {
const int widthEight = splashCeil(glyph->w / 8.0);
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) {
alpha0 = (xShift > 0 ? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)) : p[xx / 8]);
for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) {
if (state->clip->test(x1, y1)) {
if (alpha0 & 0x80) {
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
} else {
pipeIncX(&pipe);
}
alpha0 <<= 1;
}
}
p += widthEight;
}
}
}
}
|
DoS
| 0
|
void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) {
SplashPipe pipe;
int alpha0;
Guchar alpha;
Guchar *p;
int x1, y1, xx, xx1, yy;
p = glyph->data;
int xStart = x0 - glyph->x;
int yStart = y0 - glyph->y;
int xxLimit = glyph->w;
int yyLimit = glyph->h;
int xShift = 0;
if (yStart < 0)
{
p += (glyph->aa ? glyph->w : splashCeil(glyph->w / 8.0)) * -yStart; // move p to the beginning of the first painted row
yyLimit += yStart;
yStart = 0;
}
if (xStart < 0)
{
if (glyph->aa) {
p += -xStart;
} else {
p += (-xStart) / 8;
xShift = (-xStart) % 8;
}
xxLimit += xStart;
xStart = 0;
}
if (xxLimit + xStart >= bitmap->width) xxLimit = bitmap->width - xStart;
if (yyLimit + yStart >= bitmap->height) yyLimit = bitmap->height - yStart;
if (noClip) {
if (glyph->aa) {
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) {
alpha = p[xx];
if (alpha != 0) {
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
}
p += glyph->w;
}
} else {
const int widthEight = splashCeil(glyph->w / 8.0);
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) {
alpha0 = (xShift > 0 ? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)) : p[xx / 8]);
for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) {
if (alpha0 & 0x80) {
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
alpha0 <<= 1;
}
}
p += widthEight;
}
}
} else {
if (glyph->aa) {
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) {
if (state->clip->test(x1, y1)) {
alpha = p[xx];
if (alpha != 0) {
pipe.shape = alpha;
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
} else {
pipeIncX(&pipe);
}
}
p += glyph->w;
}
} else {
const int widthEight = splashCeil(glyph->w / 8.0);
pipeInit(&pipe, xStart, yStart,
state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse);
for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
pipeSetXY(&pipe, xStart, y1);
for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) {
alpha0 = (xShift > 0 ? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)) : p[xx / 8]);
for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) {
if (state->clip->test(x1, y1)) {
if (alpha0 & 0x80) {
(this->*pipe.run)(&pipe);
updateModX(x1);
updateModY(y1);
} else {
pipeIncX(&pipe);
}
} else {
pipeIncX(&pipe);
}
alpha0 <<= 1;
}
}
p += widthEight;
}
}
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,252
|
SplashError Splash::fillWithPattern(SplashPath *path, GBool eo,
SplashPattern *pattern,
SplashCoord alpha) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes, clipRes2;
if (path->length == 0) {
return splashErrEmptyPath;
}
if (pathAllOutside(path)) {
opClipRes = splashClipAllOutside;
return splashOk;
}
if (state->strokeAdjust && !path->hints) {
int n;
n = path->getLength();
if (n == 4 &&
!(path->flags[0] & splashPathClosed) &&
!(path->flags[1] & splashPathLast) &&
!(path->flags[2] & splashPathLast)) {
path->close(gTrue);
path->addStrokeAdjustHint(0, 2, 0, 4);
path->addStrokeAdjustHint(1, 3, 0, 4);
} else if (n == 5 &&
(path->flags[0] & splashPathClosed) &&
!(path->flags[1] & splashPathLast) &&
!(path->flags[2] & splashPathLast) &&
!(path->flags[3] & splashPathLast)) {
path->addStrokeAdjustHint(0, 2, 0, 4);
path->addStrokeAdjustHint(1, 3, 0, 4);
}
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
if (vectorAntialias && !inShading) {
xPath->aaScale();
}
xPath->sort();
yMinI = state->clip->getYMinI();
yMaxI = state->clip->getYMaxI();
if (vectorAntialias && !inShading) {
yMinI = yMinI * splashAASize;
yMaxI = (yMaxI + 1) * splashAASize - 1;
}
scanner = new SplashXPathScanner(xPath, eo, yMinI, yMaxI);
if (vectorAntialias && !inShading) {
scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI);
} else {
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
}
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI))
!= splashClipAllOutside) {
if (scanner->hasPartialClip()) {
clipRes = splashClipPartial;
}
pipeInit(&pipe, 0, yMinI, pattern, NULL, (Guchar)splashRound(alpha * 255),
vectorAntialias && !inShading, gFalse);
if (vectorAntialias && !inShading) {
for (y = yMinI; y <= yMaxI; ++y) {
scanner->renderAALine(aaBuf, &x0, &x1, y);
if (clipRes != splashClipAllInside) {
state->clip->clipAALine(aaBuf, &x0, &x1, y);
}
drawAALine(&pipe, x0, x1, y);
}
} else {
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
}
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
|
DoS
| 0
|
SplashError Splash::fillWithPattern(SplashPath *path, GBool eo,
SplashPattern *pattern,
SplashCoord alpha) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes, clipRes2;
if (path->length == 0) {
return splashErrEmptyPath;
}
if (pathAllOutside(path)) {
opClipRes = splashClipAllOutside;
return splashOk;
}
if (state->strokeAdjust && !path->hints) {
int n;
n = path->getLength();
if (n == 4 &&
!(path->flags[0] & splashPathClosed) &&
!(path->flags[1] & splashPathLast) &&
!(path->flags[2] & splashPathLast)) {
path->close(gTrue);
path->addStrokeAdjustHint(0, 2, 0, 4);
path->addStrokeAdjustHint(1, 3, 0, 4);
} else if (n == 5 &&
(path->flags[0] & splashPathClosed) &&
!(path->flags[1] & splashPathLast) &&
!(path->flags[2] & splashPathLast) &&
!(path->flags[3] & splashPathLast)) {
path->addStrokeAdjustHint(0, 2, 0, 4);
path->addStrokeAdjustHint(1, 3, 0, 4);
}
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
if (vectorAntialias && !inShading) {
xPath->aaScale();
}
xPath->sort();
yMinI = state->clip->getYMinI();
yMaxI = state->clip->getYMaxI();
if (vectorAntialias && !inShading) {
yMinI = yMinI * splashAASize;
yMaxI = (yMaxI + 1) * splashAASize - 1;
}
scanner = new SplashXPathScanner(xPath, eo, yMinI, yMaxI);
if (vectorAntialias && !inShading) {
scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI);
} else {
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
}
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI))
!= splashClipAllOutside) {
if (scanner->hasPartialClip()) {
clipRes = splashClipPartial;
}
pipeInit(&pipe, 0, yMinI, pattern, NULL, (Guchar)splashRound(alpha * 255),
vectorAntialias && !inShading, gFalse);
if (vectorAntialias && !inShading) {
for (y = yMinI; y <= yMaxI; ++y) {
scanner->renderAALine(aaBuf, &x0, &x1, y);
if (clipRes != splashClipAllInside) {
state->clip->clipAALine(aaBuf, &x0, &x1, y);
}
drawAALine(&pipe, x0, x1, y);
}
} else {
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
}
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,253
|
void Splash::flattenCurve(SplashCoord x0, SplashCoord y0,
SplashCoord x1, SplashCoord y1,
SplashCoord x2, SplashCoord y2,
SplashCoord x3, SplashCoord y3,
SplashCoord *matrix, SplashCoord flatness2,
SplashPath *fPath) {
SplashCoord cx[splashMaxCurveSplits + 1][3];
SplashCoord cy[splashMaxCurveSplits + 1][3];
int cNext[splashMaxCurveSplits + 1];
SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh;
SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh;
SplashCoord dx, dy, mx, my, tx, ty, d1, d2;
int p1, p2, p3;
p1 = 0;
p2 = splashMaxCurveSplits;
cx[p1][0] = x0; cy[p1][0] = y0;
cx[p1][1] = x1; cy[p1][1] = y1;
cx[p1][2] = x2; cy[p1][2] = y2;
cx[p2][0] = x3; cy[p2][0] = y3;
cNext[p1] = p2;
while (p1 < splashMaxCurveSplits) {
xl0 = cx[p1][0]; yl0 = cy[p1][0];
xx1 = cx[p1][1]; yy1 = cy[p1][1];
xx2 = cx[p1][2]; yy2 = cy[p1][2];
p2 = cNext[p1];
xr3 = cx[p2][0]; yr3 = cy[p2][0];
transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my);
transform(matrix, xx1, yy1, &tx, &ty);
#if USE_FIXEDPOINT
d1 = splashDist(tx, ty, mx, my);
#else
dx = tx - mx;
dy = ty - my;
d1 = dx*dx + dy*dy;
#endif
transform(matrix, xx2, yy2, &tx, &ty);
#if USE_FIXEDPOINT
d2 = splashDist(tx, ty, mx, my);
#else
dx = tx - mx;
dy = ty - my;
d2 = dx*dx + dy*dy;
#endif
if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) {
fPath->lineTo(xr3, yr3);
p1 = p2;
} else {
xl1 = splashAvg(xl0, xx1);
yl1 = splashAvg(yl0, yy1);
xh = splashAvg(xx1, xx2);
yh = splashAvg(yy1, yy2);
xl2 = splashAvg(xl1, xh);
yl2 = splashAvg(yl1, yh);
xr2 = splashAvg(xx2, xr3);
yr2 = splashAvg(yy2, yr3);
xr1 = splashAvg(xh, xr2);
yr1 = splashAvg(yh, yr2);
xr0 = splashAvg(xl2, xr1);
yr0 = splashAvg(yl2, yr1);
p3 = (p1 + p2) / 2;
cx[p1][1] = xl1; cy[p1][1] = yl1;
cx[p1][2] = xl2; cy[p1][2] = yl2;
cNext[p1] = p3;
cx[p3][0] = xr0; cy[p3][0] = yr0;
cx[p3][1] = xr1; cy[p3][1] = yr1;
cx[p3][2] = xr2; cy[p3][2] = yr2;
cNext[p3] = p2;
}
}
}
|
DoS
| 0
|
void Splash::flattenCurve(SplashCoord x0, SplashCoord y0,
SplashCoord x1, SplashCoord y1,
SplashCoord x2, SplashCoord y2,
SplashCoord x3, SplashCoord y3,
SplashCoord *matrix, SplashCoord flatness2,
SplashPath *fPath) {
SplashCoord cx[splashMaxCurveSplits + 1][3];
SplashCoord cy[splashMaxCurveSplits + 1][3];
int cNext[splashMaxCurveSplits + 1];
SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh;
SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh;
SplashCoord dx, dy, mx, my, tx, ty, d1, d2;
int p1, p2, p3;
p1 = 0;
p2 = splashMaxCurveSplits;
cx[p1][0] = x0; cy[p1][0] = y0;
cx[p1][1] = x1; cy[p1][1] = y1;
cx[p1][2] = x2; cy[p1][2] = y2;
cx[p2][0] = x3; cy[p2][0] = y3;
cNext[p1] = p2;
while (p1 < splashMaxCurveSplits) {
xl0 = cx[p1][0]; yl0 = cy[p1][0];
xx1 = cx[p1][1]; yy1 = cy[p1][1];
xx2 = cx[p1][2]; yy2 = cy[p1][2];
p2 = cNext[p1];
xr3 = cx[p2][0]; yr3 = cy[p2][0];
transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my);
transform(matrix, xx1, yy1, &tx, &ty);
#if USE_FIXEDPOINT
d1 = splashDist(tx, ty, mx, my);
#else
dx = tx - mx;
dy = ty - my;
d1 = dx*dx + dy*dy;
#endif
transform(matrix, xx2, yy2, &tx, &ty);
#if USE_FIXEDPOINT
d2 = splashDist(tx, ty, mx, my);
#else
dx = tx - mx;
dy = ty - my;
d2 = dx*dx + dy*dy;
#endif
if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) {
fPath->lineTo(xr3, yr3);
p1 = p2;
} else {
xl1 = splashAvg(xl0, xx1);
yl1 = splashAvg(yl0, yy1);
xh = splashAvg(xx1, xx2);
yh = splashAvg(yy1, yy2);
xl2 = splashAvg(xl1, xh);
yl2 = splashAvg(yl1, yh);
xr2 = splashAvg(xx2, xr3);
yr2 = splashAvg(yy2, yr3);
xr1 = splashAvg(xh, xr2);
yr1 = splashAvg(yh, yr2);
xr0 = splashAvg(xl2, xr1);
yr0 = splashAvg(yl2, yr1);
p3 = (p1 + p2) / 2;
cx[p1][1] = xl1; cy[p1][1] = yl1;
cx[p1][2] = xl2; cy[p1][2] = yl2;
cNext[p1] = p3;
cx[p3][0] = xr0; cy[p3][0] = yr0;
cx[p3][1] = xr1; cy[p3][1] = yr1;
cx[p3][2] = xr2; cy[p3][2] = yr2;
cNext[p3] = p2;
}
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,254
|
SplashPath *Splash::flattenPath(SplashPath *path, SplashCoord *matrix,
SplashCoord flatness) {
SplashPath *fPath;
SplashCoord flatness2;
Guchar flag;
int i;
fPath = new SplashPath();
#if USE_FIXEDPOINT
flatness2 = flatness;
#else
flatness2 = flatness * flatness;
#endif
i = 0;
while (i < path->length) {
flag = path->flags[i];
if (flag & splashPathFirst) {
fPath->moveTo(path->pts[i].x, path->pts[i].y);
++i;
} else {
if (flag & splashPathCurve) {
flattenCurve(path->pts[i-1].x, path->pts[i-1].y,
path->pts[i ].x, path->pts[i ].y,
path->pts[i+1].x, path->pts[i+1].y,
path->pts[i+2].x, path->pts[i+2].y,
matrix, flatness2, fPath);
i += 3;
} else {
fPath->lineTo(path->pts[i].x, path->pts[i].y);
++i;
}
if (path->flags[i-1] & splashPathClosed) {
fPath->close();
}
}
}
return fPath;
}
|
DoS
| 0
|
SplashPath *Splash::flattenPath(SplashPath *path, SplashCoord *matrix,
SplashCoord flatness) {
SplashPath *fPath;
SplashCoord flatness2;
Guchar flag;
int i;
fPath = new SplashPath();
#if USE_FIXEDPOINT
flatness2 = flatness;
#else
flatness2 = flatness * flatness;
#endif
i = 0;
while (i < path->length) {
flag = path->flags[i];
if (flag & splashPathFirst) {
fPath->moveTo(path->pts[i].x, path->pts[i].y);
++i;
} else {
if (flag & splashPathCurve) {
flattenCurve(path->pts[i-1].x, path->pts[i-1].y,
path->pts[i ].x, path->pts[i ].y,
path->pts[i+1].x, path->pts[i+1].y,
path->pts[i+2].x, path->pts[i+2].y,
matrix, flatness2, fPath);
i += 3;
} else {
fPath->lineTo(path->pts[i].x, path->pts[i].y);
++i;
}
if (path->flags[i-1] & splashPathClosed) {
fPath->close();
}
}
}
return fPath;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,255
|
GBool Splash::getStrokeAdjust() {
return state->strokeAdjust;
}
|
DoS
| 0
|
GBool Splash::getStrokeAdjust() {
return state->strokeAdjust;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,256
|
GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading)
{
double xdbl[3] = {0., 0., 0.};
double ydbl[3] = {0., 0., 0.};
int x[3] = {0, 0, 0};
int y[3] = {0, 0, 0};
double xt=0., xa=0., yt=0.;
double ca=0., ct=0.;
double scanLimitMapL[2] = {0., 0.};
double scanLimitMapR[2] = {0., 0.};
double scanColorMapL[2] = {0., 0.};
double scanColorMapR[2] = {0., 0.};
double scanColorMap[2] = {0., 0.};
int scanEdgeL[2] = { 0, 0 };
int scanEdgeR[2] = { 0, 0 };
GBool hasFurtherSegment = gFalse;
int scanLineOff = 0;
int bitmapOff = 0;
int scanLimitR = 0, scanLimitL = 0;
int bitmapWidth = bitmap->getWidth();
SplashClip* clip = getClip();
SplashBitmap *blitTarget = bitmap;
SplashColorPtr bitmapData = bitmap->getDataPtr();
SplashColorPtr bitmapAlpha = bitmap->getAlphaPtr();
SplashColorPtr cur = NULL;
SplashCoord* userToCanvasMatrix = getMatrix();
SplashColorMode bitmapMode = bitmap->getMode();
GBool hasAlpha = (bitmapAlpha != NULL);
int rowSize = bitmap->getRowSize();
int colorComps = 0;
switch (bitmapMode) {
case splashModeMono1:
break;
case splashModeMono8:
colorComps=1;
break;
case splashModeRGB8:
colorComps=3;
break;
case splashModeBGR8:
colorComps=3;
break;
case splashModeXBGR8:
colorComps=4;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
colorComps=4;
break;
case splashModeDeviceN8:
colorComps=SPOT_NCOMPS+4;
break;
#endif
}
SplashPipe pipe;
SplashColor cSrcVal;
pipeInit(&pipe, 0, 0, NULL, cSrcVal, (Guchar)splashRound(state->strokeAlpha * 255), gFalse, gFalse);
if (vectorAntialias) {
if (aaBuf == NULL)
return gFalse; // fall back to old behaviour
drawAAPixelInit();
}
GBool bDirectBlit = vectorAntialias ? gFalse : pipe.noTransparency && !state->blendFunc;
if (!bDirectBlit) {
blitTarget = new SplashBitmap(bitmap->getWidth(),
bitmap->getHeight(),
bitmap->getRowPad(),
bitmap->getMode(),
gTrue,
bitmap->getRowSize() >= 0);
bitmapData = blitTarget->getDataPtr();
bitmapAlpha = blitTarget->getAlphaPtr();
int S = bitmap->getWidth() * bitmap->getHeight();
for (int i = 0; i < S; ++i)
bitmapAlpha[i] = 0;
hasAlpha = gTrue;
}
if (shading->isParameterized()) {
double color[3];
double colorinterp;
for (int i = 0; i < shading->getNTriangles(); ++i) {
shading->getTriangle(i,
xdbl + 0, ydbl + 0, color + 0,
xdbl + 1, ydbl + 1, color + 1,
xdbl + 2, ydbl + 2, color + 2);
for (int m = 0; m < 3; ++m) {
xt = xdbl[m] * (double)userToCanvasMatrix[0] + ydbl[m] * (double)userToCanvasMatrix[2] + (double)userToCanvasMatrix[4];
yt = xdbl[m] * (double)userToCanvasMatrix[1] + ydbl[m] * (double)userToCanvasMatrix[3] + (double)userToCanvasMatrix[5];
xdbl[m] = xt;
ydbl[m] = yt;
x[m] = splashRound(xt);
y[m] = splashRound(yt);
}
if (y[0] > y[1]) {
Guswap(x[0], x[1]);
Guswap(y[0], y[1]);
Guswap(color[0], color[1]);
}
assert(y[0] <= y[1]);
if (y[1] > y[2]) {
int tmpX = x[2];
int tmpY = y[2];
double tmpC = color[2];
x[2] = x[1]; y[2] = y[1]; color[2] = color[1];
if (y[0] > tmpY) {
x[1] = x[0]; y[1] = y[0]; color[1] = color[0];
x[0] = tmpX; y[0] = tmpY; color[0] = tmpC;
} else {
x[1] = tmpX; y[1] = tmpY; color[1] = tmpC;
}
}
assert(y[0] <= y[1]);
assert(y[1] <= y[2]);
if ((x[0] - x[2]) * (y[1] - y[2]) - (x[1] - x[2]) * (y[0] - y[2]) == 0)
continue; // degenerate triangle.
scanEdgeL[0] = 0;
scanEdgeR[0] = 0;
if (y[0] == y[1]) {
scanEdgeL[0] = 1;
scanEdgeL[1] = scanEdgeR[1] = 2;
} else {
scanEdgeL[1] = 1; scanEdgeR[1] = 2;
}
assert(y[scanEdgeL[0]] < y[scanEdgeL[1]]);
assert(y[scanEdgeR[0]] < y[scanEdgeR[1]]);
scanLimitMapL[0] = double(x[scanEdgeL[1]] - x[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanLimitMapL[1] = x[scanEdgeL[0]] - y[scanEdgeL[0]] * scanLimitMapL[0];
scanLimitMapR[0] = double(x[scanEdgeR[1]] - x[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanLimitMapR[1] = x[scanEdgeR[0]] - y[scanEdgeR[0]] * scanLimitMapR[0];
xa = y[1] * scanLimitMapL[0] + scanLimitMapL[1];
xt = y[1] * scanLimitMapR[0] + scanLimitMapR[1];
if (xa > xt) {
Guswap(scanEdgeL[0], scanEdgeR[0]);
Guswap(scanEdgeL[1], scanEdgeR[1]);
Guswap(scanLimitMapL[0], scanLimitMapR[0]);
Guswap(scanLimitMapL[1], scanLimitMapR[1]);
}
scanColorMapL[0] = (color[scanEdgeL[1]] - color[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanColorMapL[1] = color[scanEdgeL[0]] - y[scanEdgeL[0]] * scanColorMapL[0];
scanColorMapR[0] = (color[scanEdgeR[1]] - color[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanColorMapR[1] = color[scanEdgeR[0]] - y[scanEdgeR[0]] * scanColorMapR[0];
hasFurtherSegment = (y[1] < y[2]);
scanLineOff = y[0] * rowSize;
for (int Y = y[0]; Y <= y[2]; ++Y, scanLineOff += rowSize) {
if (hasFurtherSegment && Y == y[1]) {
if (scanEdgeL[1] == 1) {
scanEdgeL[0] = 1;
scanEdgeL[1] = 2;
scanLimitMapL[0] = double(x[scanEdgeL[1]] - x[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanLimitMapL[1] = x[scanEdgeL[0]] - y[scanEdgeL[0]] * scanLimitMapL[0];
scanColorMapL[0] = (color[scanEdgeL[1]] - color[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanColorMapL[1] = color[scanEdgeL[0]] - y[scanEdgeL[0]] * scanColorMapL[0];
} else if (scanEdgeR[1] == 1) {
scanEdgeR[0] = 1;
scanEdgeR[1] = 2;
scanLimitMapR[0] = double(x[scanEdgeR[1]] - x[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanLimitMapR[1] = x[scanEdgeR[0]] - y[scanEdgeR[0]] * scanLimitMapR[0];
scanColorMapR[0] = (color[scanEdgeR[1]] - color[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanColorMapR[1] = color[scanEdgeR[0]] - y[scanEdgeR[0]] * scanColorMapR[0];
}
assert( y[scanEdgeL[0]] < y[scanEdgeL[1]] );
assert( y[scanEdgeR[0]] < y[scanEdgeR[1]] );
hasFurtherSegment = gFalse;
}
yt = Y;
xa = yt * scanLimitMapL[0] + scanLimitMapL[1];
xt = yt * scanLimitMapR[0] + scanLimitMapR[1];
ca = yt * scanColorMapL[0] + scanColorMapL[1];
ct = yt * scanColorMapR[0] + scanColorMapR[1];
scanLimitL = splashRound(xa);
scanLimitR = splashRound(xt);
scanColorMap[0] = (scanLimitR == scanLimitL) ? 0. : ((ct - ca) / (scanLimitR - scanLimitL));
scanColorMap[1] = ca - scanLimitL * scanColorMap[0];
assert(scanLimitL <= scanLimitR || abs(scanLimitL - scanLimitR) <= 2); // allow rounding inaccuracies
assert(scanLineOff == Y * rowSize);
colorinterp = scanColorMap[0] * scanLimitL + scanColorMap[1];
bitmapOff = scanLineOff + scanLimitL * colorComps;
for (int X = scanLimitL; X <= scanLimitR; ++X, colorinterp += scanColorMap[0], bitmapOff += colorComps) {
if (!clip->test(X, Y))
continue;
assert(fabs(colorinterp - (scanColorMap[0] * X + scanColorMap[1])) < 1e-10);
assert(bitmapOff == Y * rowSize + colorComps * X && scanLineOff == Y * rowSize);
shading->getParameterizedColor(colorinterp, bitmapMode, &bitmapData[bitmapOff]);
if (hasAlpha)
bitmapAlpha[Y * bitmapWidth + X] = 255;
}
}
}
} else {
return gFalse;
}
if (!bDirectBlit) {
int W = blitTarget->getWidth();
int H = blitTarget->getHeight();
cur = cSrcVal;
for (int X = 0; X < W; ++X) {
for (int Y = 0; Y < H; ++Y) {
if (!bitmapAlpha[Y * bitmapWidth + X])
continue; // draw only parts of the shading!
bitmapOff = Y * rowSize + colorComps * X;
for (int m = 0; m < colorComps; ++m)
cur[m] = bitmapData[bitmapOff + m];
if (vectorAntialias) {
drawAAPixel(&pipe, X, Y);
} else {
drawPixel(&pipe, X, Y, gTrue); // no clipping - has already been done.
}
}
}
delete blitTarget;
blitTarget = NULL;
}
return gTrue;
}
|
DoS
| 0
|
GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading)
{
double xdbl[3] = {0., 0., 0.};
double ydbl[3] = {0., 0., 0.};
int x[3] = {0, 0, 0};
int y[3] = {0, 0, 0};
double xt=0., xa=0., yt=0.;
double ca=0., ct=0.;
double scanLimitMapL[2] = {0., 0.};
double scanLimitMapR[2] = {0., 0.};
double scanColorMapL[2] = {0., 0.};
double scanColorMapR[2] = {0., 0.};
double scanColorMap[2] = {0., 0.};
int scanEdgeL[2] = { 0, 0 };
int scanEdgeR[2] = { 0, 0 };
GBool hasFurtherSegment = gFalse;
int scanLineOff = 0;
int bitmapOff = 0;
int scanLimitR = 0, scanLimitL = 0;
int bitmapWidth = bitmap->getWidth();
SplashClip* clip = getClip();
SplashBitmap *blitTarget = bitmap;
SplashColorPtr bitmapData = bitmap->getDataPtr();
SplashColorPtr bitmapAlpha = bitmap->getAlphaPtr();
SplashColorPtr cur = NULL;
SplashCoord* userToCanvasMatrix = getMatrix();
SplashColorMode bitmapMode = bitmap->getMode();
GBool hasAlpha = (bitmapAlpha != NULL);
int rowSize = bitmap->getRowSize();
int colorComps = 0;
switch (bitmapMode) {
case splashModeMono1:
break;
case splashModeMono8:
colorComps=1;
break;
case splashModeRGB8:
colorComps=3;
break;
case splashModeBGR8:
colorComps=3;
break;
case splashModeXBGR8:
colorComps=4;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
colorComps=4;
break;
case splashModeDeviceN8:
colorComps=SPOT_NCOMPS+4;
break;
#endif
}
SplashPipe pipe;
SplashColor cSrcVal;
pipeInit(&pipe, 0, 0, NULL, cSrcVal, (Guchar)splashRound(state->strokeAlpha * 255), gFalse, gFalse);
if (vectorAntialias) {
if (aaBuf == NULL)
return gFalse; // fall back to old behaviour
drawAAPixelInit();
}
GBool bDirectBlit = vectorAntialias ? gFalse : pipe.noTransparency && !state->blendFunc;
if (!bDirectBlit) {
blitTarget = new SplashBitmap(bitmap->getWidth(),
bitmap->getHeight(),
bitmap->getRowPad(),
bitmap->getMode(),
gTrue,
bitmap->getRowSize() >= 0);
bitmapData = blitTarget->getDataPtr();
bitmapAlpha = blitTarget->getAlphaPtr();
int S = bitmap->getWidth() * bitmap->getHeight();
for (int i = 0; i < S; ++i)
bitmapAlpha[i] = 0;
hasAlpha = gTrue;
}
if (shading->isParameterized()) {
double color[3];
double colorinterp;
for (int i = 0; i < shading->getNTriangles(); ++i) {
shading->getTriangle(i,
xdbl + 0, ydbl + 0, color + 0,
xdbl + 1, ydbl + 1, color + 1,
xdbl + 2, ydbl + 2, color + 2);
for (int m = 0; m < 3; ++m) {
xt = xdbl[m] * (double)userToCanvasMatrix[0] + ydbl[m] * (double)userToCanvasMatrix[2] + (double)userToCanvasMatrix[4];
yt = xdbl[m] * (double)userToCanvasMatrix[1] + ydbl[m] * (double)userToCanvasMatrix[3] + (double)userToCanvasMatrix[5];
xdbl[m] = xt;
ydbl[m] = yt;
x[m] = splashRound(xt);
y[m] = splashRound(yt);
}
if (y[0] > y[1]) {
Guswap(x[0], x[1]);
Guswap(y[0], y[1]);
Guswap(color[0], color[1]);
}
assert(y[0] <= y[1]);
if (y[1] > y[2]) {
int tmpX = x[2];
int tmpY = y[2];
double tmpC = color[2];
x[2] = x[1]; y[2] = y[1]; color[2] = color[1];
if (y[0] > tmpY) {
x[1] = x[0]; y[1] = y[0]; color[1] = color[0];
x[0] = tmpX; y[0] = tmpY; color[0] = tmpC;
} else {
x[1] = tmpX; y[1] = tmpY; color[1] = tmpC;
}
}
assert(y[0] <= y[1]);
assert(y[1] <= y[2]);
if ((x[0] - x[2]) * (y[1] - y[2]) - (x[1] - x[2]) * (y[0] - y[2]) == 0)
continue; // degenerate triangle.
scanEdgeL[0] = 0;
scanEdgeR[0] = 0;
if (y[0] == y[1]) {
scanEdgeL[0] = 1;
scanEdgeL[1] = scanEdgeR[1] = 2;
} else {
scanEdgeL[1] = 1; scanEdgeR[1] = 2;
}
assert(y[scanEdgeL[0]] < y[scanEdgeL[1]]);
assert(y[scanEdgeR[0]] < y[scanEdgeR[1]]);
scanLimitMapL[0] = double(x[scanEdgeL[1]] - x[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanLimitMapL[1] = x[scanEdgeL[0]] - y[scanEdgeL[0]] * scanLimitMapL[0];
scanLimitMapR[0] = double(x[scanEdgeR[1]] - x[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanLimitMapR[1] = x[scanEdgeR[0]] - y[scanEdgeR[0]] * scanLimitMapR[0];
xa = y[1] * scanLimitMapL[0] + scanLimitMapL[1];
xt = y[1] * scanLimitMapR[0] + scanLimitMapR[1];
if (xa > xt) {
Guswap(scanEdgeL[0], scanEdgeR[0]);
Guswap(scanEdgeL[1], scanEdgeR[1]);
Guswap(scanLimitMapL[0], scanLimitMapR[0]);
Guswap(scanLimitMapL[1], scanLimitMapR[1]);
}
scanColorMapL[0] = (color[scanEdgeL[1]] - color[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanColorMapL[1] = color[scanEdgeL[0]] - y[scanEdgeL[0]] * scanColorMapL[0];
scanColorMapR[0] = (color[scanEdgeR[1]] - color[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanColorMapR[1] = color[scanEdgeR[0]] - y[scanEdgeR[0]] * scanColorMapR[0];
hasFurtherSegment = (y[1] < y[2]);
scanLineOff = y[0] * rowSize;
for (int Y = y[0]; Y <= y[2]; ++Y, scanLineOff += rowSize) {
if (hasFurtherSegment && Y == y[1]) {
if (scanEdgeL[1] == 1) {
scanEdgeL[0] = 1;
scanEdgeL[1] = 2;
scanLimitMapL[0] = double(x[scanEdgeL[1]] - x[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanLimitMapL[1] = x[scanEdgeL[0]] - y[scanEdgeL[0]] * scanLimitMapL[0];
scanColorMapL[0] = (color[scanEdgeL[1]] - color[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]);
scanColorMapL[1] = color[scanEdgeL[0]] - y[scanEdgeL[0]] * scanColorMapL[0];
} else if (scanEdgeR[1] == 1) {
scanEdgeR[0] = 1;
scanEdgeR[1] = 2;
scanLimitMapR[0] = double(x[scanEdgeR[1]] - x[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanLimitMapR[1] = x[scanEdgeR[0]] - y[scanEdgeR[0]] * scanLimitMapR[0];
scanColorMapR[0] = (color[scanEdgeR[1]] - color[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]);
scanColorMapR[1] = color[scanEdgeR[0]] - y[scanEdgeR[0]] * scanColorMapR[0];
}
assert( y[scanEdgeL[0]] < y[scanEdgeL[1]] );
assert( y[scanEdgeR[0]] < y[scanEdgeR[1]] );
hasFurtherSegment = gFalse;
}
yt = Y;
xa = yt * scanLimitMapL[0] + scanLimitMapL[1];
xt = yt * scanLimitMapR[0] + scanLimitMapR[1];
ca = yt * scanColorMapL[0] + scanColorMapL[1];
ct = yt * scanColorMapR[0] + scanColorMapR[1];
scanLimitL = splashRound(xa);
scanLimitR = splashRound(xt);
scanColorMap[0] = (scanLimitR == scanLimitL) ? 0. : ((ct - ca) / (scanLimitR - scanLimitL));
scanColorMap[1] = ca - scanLimitL * scanColorMap[0];
assert(scanLimitL <= scanLimitR || abs(scanLimitL - scanLimitR) <= 2); // allow rounding inaccuracies
assert(scanLineOff == Y * rowSize);
colorinterp = scanColorMap[0] * scanLimitL + scanColorMap[1];
bitmapOff = scanLineOff + scanLimitL * colorComps;
for (int X = scanLimitL; X <= scanLimitR; ++X, colorinterp += scanColorMap[0], bitmapOff += colorComps) {
if (!clip->test(X, Y))
continue;
assert(fabs(colorinterp - (scanColorMap[0] * X + scanColorMap[1])) < 1e-10);
assert(bitmapOff == Y * rowSize + colorComps * X && scanLineOff == Y * rowSize);
shading->getParameterizedColor(colorinterp, bitmapMode, &bitmapData[bitmapOff]);
if (hasAlpha)
bitmapAlpha[Y * bitmapWidth + X] = 255;
}
}
}
} else {
return gFalse;
}
if (!bDirectBlit) {
int W = blitTarget->getWidth();
int H = blitTarget->getHeight();
cur = cSrcVal;
for (int X = 0; X < W; ++X) {
for (int Y = 0; Y < H; ++Y) {
if (!bitmapAlpha[Y * bitmapWidth + X])
continue; // draw only parts of the shading!
bitmapOff = Y * rowSize + colorComps * X;
for (int m = 0; m < colorComps; ++m)
cur[m] = bitmapData[bitmapOff + m];
if (vectorAntialias) {
drawAAPixel(&pipe, X, Y);
} else {
drawPixel(&pipe, X, Y, gTrue); // no clipping - has already been done.
}
}
}
delete blitTarget;
blitTarget = NULL;
}
return gTrue;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,257
|
static inline int imgCoordMungeLower(SplashCoord x) {
return splashFloor(x);
}
|
DoS
| 0
|
static inline int imgCoordMungeLower(SplashCoord x) {
return splashFloor(x);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,258
|
static inline int imgCoordMungeLowerC(SplashCoord x, GBool glyphMode) {
return glyphMode ? (splashCeil(x + 0.5) - 1) : splashFloor(x);
}
|
DoS
| 0
|
static inline int imgCoordMungeLowerC(SplashCoord x, GBool glyphMode) {
return glyphMode ? (splashCeil(x + 0.5) - 1) : splashFloor(x);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,259
|
static inline int imgCoordMungeUpper(SplashCoord x) {
return splashFloor(x) + 1;
}
|
DoS
| 0
|
static inline int imgCoordMungeUpper(SplashCoord x) {
return splashFloor(x) + 1;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,260
|
static inline int imgCoordMungeUpperC(SplashCoord x, GBool glyphMode) {
return glyphMode ? (splashCeil(x + 0.5) - 1) : (splashFloor(x) + 1);
}
|
DoS
| 0
|
static inline int imgCoordMungeUpperC(SplashCoord x, GBool glyphMode) {
return glyphMode ? (splashCeil(x + 0.5) - 1) : (splashFloor(x) + 1);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,261
|
static GBool isImageInterpolationRequired(int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
GBool interpolate) {
if (interpolate)
return gTrue;
/* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */
if (scaledWidth / srcWidth >= 4 || scaledHeight / srcHeight >= 4)
return gFalse;
return gTrue;
}
|
DoS
| 0
|
static GBool isImageInterpolationRequired(int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
GBool interpolate) {
if (interpolate)
return gTrue;
/* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */
if (scaledWidth / srcWidth >= 4 || scaledHeight / srcHeight >= 4)
return gFalse;
return gTrue;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,262
|
SplashPath *Splash::makeDashedPath(SplashPath *path) {
SplashPath *dPath;
SplashCoord lineDashTotal;
SplashCoord lineDashStartPhase, lineDashDist, segLen;
SplashCoord x0, y0, x1, y1, xa, ya;
GBool lineDashStartOn, lineDashOn, newPath;
int lineDashStartIdx, lineDashIdx;
int i, j, k;
lineDashTotal = 0;
for (i = 0; i < state->lineDashLength; ++i) {
lineDashTotal += state->lineDash[i];
}
if (lineDashTotal == 0) {
return new SplashPath();
}
lineDashStartPhase = state->lineDashPhase;
i = splashFloor(lineDashStartPhase / lineDashTotal);
lineDashStartPhase -= (SplashCoord)i * lineDashTotal;
lineDashStartOn = gTrue;
lineDashStartIdx = 0;
if (lineDashStartPhase > 0) {
while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) {
lineDashStartOn = !lineDashStartOn;
lineDashStartPhase -= state->lineDash[lineDashStartIdx];
++lineDashStartIdx;
}
}
dPath = new SplashPath();
i = 0;
while (i < path->length) {
for (j = i;
j < path->length - 1 && !(path->flags[j] & splashPathLast);
++j) ;
lineDashOn = lineDashStartOn;
lineDashIdx = lineDashStartIdx;
lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase;
newPath = gTrue;
for (k = i; k < j; ++k) {
x0 = path->pts[k].x;
y0 = path->pts[k].y;
x1 = path->pts[k+1].x;
y1 = path->pts[k+1].y;
segLen = splashDist(x0, y0, x1, y1);
while (segLen > 0) {
if (lineDashDist >= segLen) {
if (lineDashOn) {
if (newPath) {
dPath->moveTo(x0, y0);
newPath = gFalse;
}
dPath->lineTo(x1, y1);
}
lineDashDist -= segLen;
segLen = 0;
} else {
xa = x0 + (lineDashDist / segLen) * (x1 - x0);
ya = y0 + (lineDashDist / segLen) * (y1 - y0);
if (lineDashOn) {
if (newPath) {
dPath->moveTo(x0, y0);
newPath = gFalse;
}
dPath->lineTo(xa, ya);
}
x0 = xa;
y0 = ya;
segLen -= lineDashDist;
lineDashDist = 0;
}
if (lineDashDist <= 0) {
lineDashOn = !lineDashOn;
if (++lineDashIdx == state->lineDashLength) {
lineDashIdx = 0;
}
lineDashDist = state->lineDash[lineDashIdx];
newPath = gTrue;
}
}
}
i = j + 1;
}
if (dPath->length == 0) {
GBool allSame = gTrue;
for (int i = 0; allSame && i < path->length - 1; ++i) {
allSame = path->pts[i].x == path->pts[i + 1].x && path->pts[i].y == path->pts[i + 1].y;
}
if (allSame) {
x0 = path->pts[0].x;
y0 = path->pts[0].y;
dPath->moveTo(x0, y0);
dPath->lineTo(x0, y0);
}
}
return dPath;
}
|
DoS
| 0
|
SplashPath *Splash::makeDashedPath(SplashPath *path) {
SplashPath *dPath;
SplashCoord lineDashTotal;
SplashCoord lineDashStartPhase, lineDashDist, segLen;
SplashCoord x0, y0, x1, y1, xa, ya;
GBool lineDashStartOn, lineDashOn, newPath;
int lineDashStartIdx, lineDashIdx;
int i, j, k;
lineDashTotal = 0;
for (i = 0; i < state->lineDashLength; ++i) {
lineDashTotal += state->lineDash[i];
}
if (lineDashTotal == 0) {
return new SplashPath();
}
lineDashStartPhase = state->lineDashPhase;
i = splashFloor(lineDashStartPhase / lineDashTotal);
lineDashStartPhase -= (SplashCoord)i * lineDashTotal;
lineDashStartOn = gTrue;
lineDashStartIdx = 0;
if (lineDashStartPhase > 0) {
while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) {
lineDashStartOn = !lineDashStartOn;
lineDashStartPhase -= state->lineDash[lineDashStartIdx];
++lineDashStartIdx;
}
}
dPath = new SplashPath();
i = 0;
while (i < path->length) {
for (j = i;
j < path->length - 1 && !(path->flags[j] & splashPathLast);
++j) ;
lineDashOn = lineDashStartOn;
lineDashIdx = lineDashStartIdx;
lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase;
newPath = gTrue;
for (k = i; k < j; ++k) {
x0 = path->pts[k].x;
y0 = path->pts[k].y;
x1 = path->pts[k+1].x;
y1 = path->pts[k+1].y;
segLen = splashDist(x0, y0, x1, y1);
while (segLen > 0) {
if (lineDashDist >= segLen) {
if (lineDashOn) {
if (newPath) {
dPath->moveTo(x0, y0);
newPath = gFalse;
}
dPath->lineTo(x1, y1);
}
lineDashDist -= segLen;
segLen = 0;
} else {
xa = x0 + (lineDashDist / segLen) * (x1 - x0);
ya = y0 + (lineDashDist / segLen) * (y1 - y0);
if (lineDashOn) {
if (newPath) {
dPath->moveTo(x0, y0);
newPath = gFalse;
}
dPath->lineTo(xa, ya);
}
x0 = xa;
y0 = ya;
segLen -= lineDashDist;
lineDashDist = 0;
}
if (lineDashDist <= 0) {
lineDashOn = !lineDashOn;
if (++lineDashIdx == state->lineDashLength) {
lineDashIdx = 0;
}
lineDashDist = state->lineDash[lineDashIdx];
newPath = gTrue;
}
}
}
i = j + 1;
}
if (dPath->length == 0) {
GBool allSame = gTrue;
for (int i = 0; allSame && i < path->length - 1; ++i) {
allSame = path->pts[i].x == path->pts[i + 1].x && path->pts[i].y == path->pts[i + 1].y;
}
if (allSame) {
x0 = path->pts[0].x;
y0 = path->pts[0].y;
dPath->moveTo(x0, y0);
dPath->lineTo(x0, y0);
}
}
return dPath;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,263
|
SplashPath *Splash::makeStrokePath(SplashPath *path, SplashCoord w,
GBool flatten) {
SplashPath *pathIn, *dashPath, *pathOut;
SplashCoord d, dx, dy, wdx, wdy, dxNext, dyNext, wdxNext, wdyNext;
SplashCoord crossprod, dotprod, miter, m;
GBool first, last, closed;
int subpathStart0, subpathStart1, seg, i0, i1, j0, j1, k0, k1;
int left0, left1, left2, right0, right1, right2, join0, join1, join2;
int leftFirst, rightFirst, firstPt;
pathOut = new SplashPath();
if (path->length == 0) {
return pathOut;
}
if (flatten) {
pathIn = flattenPath(path, state->matrix, state->flatness);
if (state->lineDashLength > 0) {
dashPath = makeDashedPath(pathIn);
delete pathIn;
pathIn = dashPath;
if (pathIn->length == 0) {
delete pathIn;
return pathOut;
}
}
} else {
pathIn = path;
}
subpathStart0 = subpathStart1 = 0; // make gcc happy
seg = 0; // make gcc happy
closed = gFalse; // make gcc happy
left0 = left1 = right0 = right1 = join0 = join1 = 0; // make gcc happy
leftFirst = rightFirst = firstPt = 0; // make gcc happy
i0 = 0;
for (i1 = i0;
!(pathIn->flags[i1] & splashPathLast) &&
i1 + 1 < pathIn->length &&
pathIn->pts[i1+1].x == pathIn->pts[i1].x &&
pathIn->pts[i1+1].y == pathIn->pts[i1].y;
++i1) ;
while (i1 < pathIn->length) {
if ((first = pathIn->flags[i0] & splashPathFirst)) {
subpathStart0 = i0;
subpathStart1 = i1;
seg = 0;
closed = pathIn->flags[i0] & splashPathClosed;
}
j0 = i1 + 1;
if (j0 < pathIn->length) {
for (j1 = j0;
!(pathIn->flags[j1] & splashPathLast) &&
j1 + 1 < pathIn->length &&
pathIn->pts[j1+1].x == pathIn->pts[j1].x &&
pathIn->pts[j1+1].y == pathIn->pts[j1].y;
++j1) ;
} else {
j1 = j0;
}
if (pathIn->flags[i1] & splashPathLast) {
if (first && state->lineCap == splashLineCapRound) {
pathOut->moveTo(pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y);
pathOut->curveTo(pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y + bezierCircle2 * w,
pathIn->pts[i0].x + bezierCircle2 * w,
pathIn->pts[i0].y + (SplashCoord)0.5 * w,
pathIn->pts[i0].x,
pathIn->pts[i0].y + (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[i0].x - bezierCircle2 * w,
pathIn->pts[i0].y + (SplashCoord)0.5 * w,
pathIn->pts[i0].x - (SplashCoord)0.5 * w,
pathIn->pts[i0].y + bezierCircle2 * w,
pathIn->pts[i0].x - (SplashCoord)0.5 * w,
pathIn->pts[i0].y);
pathOut->curveTo(pathIn->pts[i0].x - (SplashCoord)0.5 * w,
pathIn->pts[i0].y - bezierCircle2 * w,
pathIn->pts[i0].x - bezierCircle2 * w,
pathIn->pts[i0].y - (SplashCoord)0.5 * w,
pathIn->pts[i0].x,
pathIn->pts[i0].y - (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[i0].x + bezierCircle2 * w,
pathIn->pts[i0].y - (SplashCoord)0.5 * w,
pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y - bezierCircle2 * w,
pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y);
pathOut->close();
}
i0 = j0;
i1 = j1;
continue;
}
last = pathIn->flags[j1] & splashPathLast;
if (last) {
k0 = subpathStart1 + 1;
} else {
k0 = j1 + 1;
}
for (k1 = k0;
!(pathIn->flags[k1] & splashPathLast) &&
k1 + 1 < pathIn->length &&
pathIn->pts[k1+1].x == pathIn->pts[k1].x &&
pathIn->pts[k1+1].y == pathIn->pts[k1].y;
++k1) ;
#if USE_FIXEDPOINT
d = splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y,
pathIn->pts[j0].x, pathIn->pts[j0].y);
dx = (pathIn->pts[j0].x - pathIn->pts[i1].x) / d;
dy = (pathIn->pts[j0].y - pathIn->pts[i1].y) / d;
#else
d = (SplashCoord)1 / splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y,
pathIn->pts[j0].x, pathIn->pts[j0].y);
dx = d * (pathIn->pts[j0].x - pathIn->pts[i1].x);
dy = d * (pathIn->pts[j0].y - pathIn->pts[i1].y);
#endif
wdx = (SplashCoord)0.5 * w * dx;
wdy = (SplashCoord)0.5 * w * dy;
pathOut->moveTo(pathIn->pts[i0].x - wdy, pathIn->pts[i0].y + wdx);
if (i0 == subpathStart0) {
firstPt = pathOut->length - 1;
}
if (first && !closed) {
switch (state->lineCap) {
case splashLineCapButt:
pathOut->lineTo(pathIn->pts[i0].x + wdy, pathIn->pts[i0].y - wdx);
break;
case splashLineCapRound:
pathOut->curveTo(pathIn->pts[i0].x - wdy - bezierCircle * wdx,
pathIn->pts[i0].y + wdx - bezierCircle * wdy,
pathIn->pts[i0].x - wdx - bezierCircle * wdy,
pathIn->pts[i0].y - wdy + bezierCircle * wdx,
pathIn->pts[i0].x - wdx,
pathIn->pts[i0].y - wdy);
pathOut->curveTo(pathIn->pts[i0].x - wdx + bezierCircle * wdy,
pathIn->pts[i0].y - wdy - bezierCircle * wdx,
pathIn->pts[i0].x + wdy - bezierCircle * wdx,
pathIn->pts[i0].y - wdx - bezierCircle * wdy,
pathIn->pts[i0].x + wdy,
pathIn->pts[i0].y - wdx);
break;
case splashLineCapProjecting:
pathOut->lineTo(pathIn->pts[i0].x - wdx - wdy,
pathIn->pts[i0].y + wdx - wdy);
pathOut->lineTo(pathIn->pts[i0].x - wdx + wdy,
pathIn->pts[i0].y - wdx - wdy);
pathOut->lineTo(pathIn->pts[i0].x + wdy,
pathIn->pts[i0].y - wdx);
break;
}
} else {
pathOut->lineTo(pathIn->pts[i0].x + wdy, pathIn->pts[i0].y - wdx);
}
left2 = pathOut->length - 1;
pathOut->lineTo(pathIn->pts[j0].x + wdy, pathIn->pts[j0].y - wdx);
if (last && !closed) {
switch (state->lineCap) {
case splashLineCapButt:
pathOut->lineTo(pathIn->pts[j0].x - wdy, pathIn->pts[j0].y + wdx);
break;
case splashLineCapRound:
pathOut->curveTo(pathIn->pts[j0].x + wdy + bezierCircle * wdx,
pathIn->pts[j0].y - wdx + bezierCircle * wdy,
pathIn->pts[j0].x + wdx + bezierCircle * wdy,
pathIn->pts[j0].y + wdy - bezierCircle * wdx,
pathIn->pts[j0].x + wdx,
pathIn->pts[j0].y + wdy);
pathOut->curveTo(pathIn->pts[j0].x + wdx - bezierCircle * wdy,
pathIn->pts[j0].y + wdy + bezierCircle * wdx,
pathIn->pts[j0].x - wdy + bezierCircle * wdx,
pathIn->pts[j0].y + wdx + bezierCircle * wdy,
pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
break;
case splashLineCapProjecting:
pathOut->lineTo(pathIn->pts[j0].x + wdy + wdx,
pathIn->pts[j0].y - wdx + wdy);
pathOut->lineTo(pathIn->pts[j0].x - wdy + wdx,
pathIn->pts[j0].y + wdx + wdy);
pathOut->lineTo(pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
break;
}
} else {
pathOut->lineTo(pathIn->pts[j0].x - wdy, pathIn->pts[j0].y + wdx);
}
right2 = pathOut->length - 1;
pathOut->close(state->strokeAdjust);
join2 = pathOut->length;
if (!last || closed) {
#if USE_FIXEDPOINT
d = splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y,
pathIn->pts[k0].x, pathIn->pts[k0].y);
dxNext = (pathIn->pts[k0].x - pathIn->pts[j1].x) / d;
dyNext = (pathIn->pts[k0].y - pathIn->pts[j1].y) / d;
#else
d = (SplashCoord)1 / splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y,
pathIn->pts[k0].x, pathIn->pts[k0].y);
dxNext = d * (pathIn->pts[k0].x - pathIn->pts[j1].x);
dyNext = d * (pathIn->pts[k0].y - pathIn->pts[j1].y);
#endif
wdxNext = (SplashCoord)0.5 * w * dxNext;
wdyNext = (SplashCoord)0.5 * w * dyNext;
crossprod = dx * dyNext - dy * dxNext;
dotprod = -(dx * dxNext + dy * dyNext);
if (dotprod > 0.9999) {
miter = (state->miterLimit + 1) * (state->miterLimit + 1);
m = 0;
} else {
miter = (SplashCoord)2 / ((SplashCoord)1 - dotprod);
if (miter < 1) {
miter = 1;
}
m = splashSqrt(miter - 1);
}
if (state->lineJoin == splashLineJoinRound) {
pathOut->moveTo(pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y);
pathOut->curveTo(pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y + bezierCircle2 * w,
pathIn->pts[j0].x + bezierCircle2 * w,
pathIn->pts[j0].y + (SplashCoord)0.5 * w,
pathIn->pts[j0].x,
pathIn->pts[j0].y + (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[j0].x - bezierCircle2 * w,
pathIn->pts[j0].y + (SplashCoord)0.5 * w,
pathIn->pts[j0].x - (SplashCoord)0.5 * w,
pathIn->pts[j0].y + bezierCircle2 * w,
pathIn->pts[j0].x - (SplashCoord)0.5 * w,
pathIn->pts[j0].y);
pathOut->curveTo(pathIn->pts[j0].x - (SplashCoord)0.5 * w,
pathIn->pts[j0].y - bezierCircle2 * w,
pathIn->pts[j0].x - bezierCircle2 * w,
pathIn->pts[j0].y - (SplashCoord)0.5 * w,
pathIn->pts[j0].x,
pathIn->pts[j0].y - (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[j0].x + bezierCircle2 * w,
pathIn->pts[j0].y - (SplashCoord)0.5 * w,
pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y - bezierCircle2 * w,
pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y);
} else {
pathOut->moveTo(pathIn->pts[j0].x, pathIn->pts[j0].y);
if (crossprod < 0) {
pathOut->lineTo(pathIn->pts[j0].x - wdyNext,
pathIn->pts[j0].y + wdxNext);
if (state->lineJoin == splashLineJoinMiter &&
splashSqrt(miter) <= state->miterLimit) {
pathOut->lineTo(pathIn->pts[j0].x - wdy + wdx * m,
pathIn->pts[j0].y + wdx + wdy * m);
pathOut->lineTo(pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
} else {
pathOut->lineTo(pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
}
} else {
pathOut->lineTo(pathIn->pts[j0].x + wdy,
pathIn->pts[j0].y - wdx);
if (state->lineJoin == splashLineJoinMiter &&
splashSqrt(miter) <= state->miterLimit) {
pathOut->lineTo(pathIn->pts[j0].x + wdy + wdx * m,
pathIn->pts[j0].y - wdx + wdy * m);
pathOut->lineTo(pathIn->pts[j0].x + wdyNext,
pathIn->pts[j0].y - wdxNext);
} else {
pathOut->lineTo(pathIn->pts[j0].x + wdyNext,
pathIn->pts[j0].y - wdxNext);
}
}
}
pathOut->close();
}
if (state->strokeAdjust) {
if (seg == 0 && !closed) {
if (state->lineCap == splashLineCapButt) {
pathOut->addStrokeAdjustHint(firstPt, left2 + 1,
firstPt, firstPt + 1);
if (last) {
pathOut->addStrokeAdjustHint(firstPt, left2 + 1,
left2 + 1, left2 + 2);
}
} else if (state->lineCap == splashLineCapProjecting) {
if (last) {
pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 2,
firstPt + 1, firstPt + 2);
pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 2,
left2 + 2, left2 + 3);
} else {
pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 1,
firstPt + 1, firstPt + 2);
}
}
}
if (seg >= 1) {
if (seg >= 2) {
pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0);
pathOut->addStrokeAdjustHint(left1, right1, join0, left2);
} else {
pathOut->addStrokeAdjustHint(left1, right1, firstPt, left2);
}
pathOut->addStrokeAdjustHint(left1, right1, right2 + 1, right2 + 1);
}
left0 = left1;
left1 = left2;
right0 = right1;
right1 = right2;
join0 = join1;
join1 = join2;
if (seg == 0) {
leftFirst = left2;
rightFirst = right2;
}
if (last) {
if (seg >= 2) {
pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0);
pathOut->addStrokeAdjustHint(left1, right1,
join0, pathOut->length - 1);
} else {
pathOut->addStrokeAdjustHint(left1, right1,
firstPt, pathOut->length - 1);
}
if (closed) {
pathOut->addStrokeAdjustHint(left1, right1, firstPt, leftFirst);
pathOut->addStrokeAdjustHint(left1, right1,
rightFirst + 1, rightFirst + 1);
pathOut->addStrokeAdjustHint(leftFirst, rightFirst,
left1 + 1, right1);
pathOut->addStrokeAdjustHint(leftFirst, rightFirst,
join1, pathOut->length - 1);
}
if (!closed && seg > 0) {
if (state->lineCap == splashLineCapButt) {
pathOut->addStrokeAdjustHint(left1 - 1, left1 + 1,
left1 + 1, left1 + 2);
} else if (state->lineCap == splashLineCapProjecting) {
pathOut->addStrokeAdjustHint(left1 - 1, left1 + 2,
left1 + 2, left1 + 3);
}
}
}
}
i0 = j0;
i1 = j1;
++seg;
}
if (pathIn != path) {
delete pathIn;
}
return pathOut;
}
|
DoS
| 0
|
SplashPath *Splash::makeStrokePath(SplashPath *path, SplashCoord w,
GBool flatten) {
SplashPath *pathIn, *dashPath, *pathOut;
SplashCoord d, dx, dy, wdx, wdy, dxNext, dyNext, wdxNext, wdyNext;
SplashCoord crossprod, dotprod, miter, m;
GBool first, last, closed;
int subpathStart0, subpathStart1, seg, i0, i1, j0, j1, k0, k1;
int left0, left1, left2, right0, right1, right2, join0, join1, join2;
int leftFirst, rightFirst, firstPt;
pathOut = new SplashPath();
if (path->length == 0) {
return pathOut;
}
if (flatten) {
pathIn = flattenPath(path, state->matrix, state->flatness);
if (state->lineDashLength > 0) {
dashPath = makeDashedPath(pathIn);
delete pathIn;
pathIn = dashPath;
if (pathIn->length == 0) {
delete pathIn;
return pathOut;
}
}
} else {
pathIn = path;
}
subpathStart0 = subpathStart1 = 0; // make gcc happy
seg = 0; // make gcc happy
closed = gFalse; // make gcc happy
left0 = left1 = right0 = right1 = join0 = join1 = 0; // make gcc happy
leftFirst = rightFirst = firstPt = 0; // make gcc happy
i0 = 0;
for (i1 = i0;
!(pathIn->flags[i1] & splashPathLast) &&
i1 + 1 < pathIn->length &&
pathIn->pts[i1+1].x == pathIn->pts[i1].x &&
pathIn->pts[i1+1].y == pathIn->pts[i1].y;
++i1) ;
while (i1 < pathIn->length) {
if ((first = pathIn->flags[i0] & splashPathFirst)) {
subpathStart0 = i0;
subpathStart1 = i1;
seg = 0;
closed = pathIn->flags[i0] & splashPathClosed;
}
j0 = i1 + 1;
if (j0 < pathIn->length) {
for (j1 = j0;
!(pathIn->flags[j1] & splashPathLast) &&
j1 + 1 < pathIn->length &&
pathIn->pts[j1+1].x == pathIn->pts[j1].x &&
pathIn->pts[j1+1].y == pathIn->pts[j1].y;
++j1) ;
} else {
j1 = j0;
}
if (pathIn->flags[i1] & splashPathLast) {
if (first && state->lineCap == splashLineCapRound) {
pathOut->moveTo(pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y);
pathOut->curveTo(pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y + bezierCircle2 * w,
pathIn->pts[i0].x + bezierCircle2 * w,
pathIn->pts[i0].y + (SplashCoord)0.5 * w,
pathIn->pts[i0].x,
pathIn->pts[i0].y + (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[i0].x - bezierCircle2 * w,
pathIn->pts[i0].y + (SplashCoord)0.5 * w,
pathIn->pts[i0].x - (SplashCoord)0.5 * w,
pathIn->pts[i0].y + bezierCircle2 * w,
pathIn->pts[i0].x - (SplashCoord)0.5 * w,
pathIn->pts[i0].y);
pathOut->curveTo(pathIn->pts[i0].x - (SplashCoord)0.5 * w,
pathIn->pts[i0].y - bezierCircle2 * w,
pathIn->pts[i0].x - bezierCircle2 * w,
pathIn->pts[i0].y - (SplashCoord)0.5 * w,
pathIn->pts[i0].x,
pathIn->pts[i0].y - (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[i0].x + bezierCircle2 * w,
pathIn->pts[i0].y - (SplashCoord)0.5 * w,
pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y - bezierCircle2 * w,
pathIn->pts[i0].x + (SplashCoord)0.5 * w,
pathIn->pts[i0].y);
pathOut->close();
}
i0 = j0;
i1 = j1;
continue;
}
last = pathIn->flags[j1] & splashPathLast;
if (last) {
k0 = subpathStart1 + 1;
} else {
k0 = j1 + 1;
}
for (k1 = k0;
!(pathIn->flags[k1] & splashPathLast) &&
k1 + 1 < pathIn->length &&
pathIn->pts[k1+1].x == pathIn->pts[k1].x &&
pathIn->pts[k1+1].y == pathIn->pts[k1].y;
++k1) ;
#if USE_FIXEDPOINT
d = splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y,
pathIn->pts[j0].x, pathIn->pts[j0].y);
dx = (pathIn->pts[j0].x - pathIn->pts[i1].x) / d;
dy = (pathIn->pts[j0].y - pathIn->pts[i1].y) / d;
#else
d = (SplashCoord)1 / splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y,
pathIn->pts[j0].x, pathIn->pts[j0].y);
dx = d * (pathIn->pts[j0].x - pathIn->pts[i1].x);
dy = d * (pathIn->pts[j0].y - pathIn->pts[i1].y);
#endif
wdx = (SplashCoord)0.5 * w * dx;
wdy = (SplashCoord)0.5 * w * dy;
pathOut->moveTo(pathIn->pts[i0].x - wdy, pathIn->pts[i0].y + wdx);
if (i0 == subpathStart0) {
firstPt = pathOut->length - 1;
}
if (first && !closed) {
switch (state->lineCap) {
case splashLineCapButt:
pathOut->lineTo(pathIn->pts[i0].x + wdy, pathIn->pts[i0].y - wdx);
break;
case splashLineCapRound:
pathOut->curveTo(pathIn->pts[i0].x - wdy - bezierCircle * wdx,
pathIn->pts[i0].y + wdx - bezierCircle * wdy,
pathIn->pts[i0].x - wdx - bezierCircle * wdy,
pathIn->pts[i0].y - wdy + bezierCircle * wdx,
pathIn->pts[i0].x - wdx,
pathIn->pts[i0].y - wdy);
pathOut->curveTo(pathIn->pts[i0].x - wdx + bezierCircle * wdy,
pathIn->pts[i0].y - wdy - bezierCircle * wdx,
pathIn->pts[i0].x + wdy - bezierCircle * wdx,
pathIn->pts[i0].y - wdx - bezierCircle * wdy,
pathIn->pts[i0].x + wdy,
pathIn->pts[i0].y - wdx);
break;
case splashLineCapProjecting:
pathOut->lineTo(pathIn->pts[i0].x - wdx - wdy,
pathIn->pts[i0].y + wdx - wdy);
pathOut->lineTo(pathIn->pts[i0].x - wdx + wdy,
pathIn->pts[i0].y - wdx - wdy);
pathOut->lineTo(pathIn->pts[i0].x + wdy,
pathIn->pts[i0].y - wdx);
break;
}
} else {
pathOut->lineTo(pathIn->pts[i0].x + wdy, pathIn->pts[i0].y - wdx);
}
left2 = pathOut->length - 1;
pathOut->lineTo(pathIn->pts[j0].x + wdy, pathIn->pts[j0].y - wdx);
if (last && !closed) {
switch (state->lineCap) {
case splashLineCapButt:
pathOut->lineTo(pathIn->pts[j0].x - wdy, pathIn->pts[j0].y + wdx);
break;
case splashLineCapRound:
pathOut->curveTo(pathIn->pts[j0].x + wdy + bezierCircle * wdx,
pathIn->pts[j0].y - wdx + bezierCircle * wdy,
pathIn->pts[j0].x + wdx + bezierCircle * wdy,
pathIn->pts[j0].y + wdy - bezierCircle * wdx,
pathIn->pts[j0].x + wdx,
pathIn->pts[j0].y + wdy);
pathOut->curveTo(pathIn->pts[j0].x + wdx - bezierCircle * wdy,
pathIn->pts[j0].y + wdy + bezierCircle * wdx,
pathIn->pts[j0].x - wdy + bezierCircle * wdx,
pathIn->pts[j0].y + wdx + bezierCircle * wdy,
pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
break;
case splashLineCapProjecting:
pathOut->lineTo(pathIn->pts[j0].x + wdy + wdx,
pathIn->pts[j0].y - wdx + wdy);
pathOut->lineTo(pathIn->pts[j0].x - wdy + wdx,
pathIn->pts[j0].y + wdx + wdy);
pathOut->lineTo(pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
break;
}
} else {
pathOut->lineTo(pathIn->pts[j0].x - wdy, pathIn->pts[j0].y + wdx);
}
right2 = pathOut->length - 1;
pathOut->close(state->strokeAdjust);
join2 = pathOut->length;
if (!last || closed) {
#if USE_FIXEDPOINT
d = splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y,
pathIn->pts[k0].x, pathIn->pts[k0].y);
dxNext = (pathIn->pts[k0].x - pathIn->pts[j1].x) / d;
dyNext = (pathIn->pts[k0].y - pathIn->pts[j1].y) / d;
#else
d = (SplashCoord)1 / splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y,
pathIn->pts[k0].x, pathIn->pts[k0].y);
dxNext = d * (pathIn->pts[k0].x - pathIn->pts[j1].x);
dyNext = d * (pathIn->pts[k0].y - pathIn->pts[j1].y);
#endif
wdxNext = (SplashCoord)0.5 * w * dxNext;
wdyNext = (SplashCoord)0.5 * w * dyNext;
crossprod = dx * dyNext - dy * dxNext;
dotprod = -(dx * dxNext + dy * dyNext);
if (dotprod > 0.9999) {
miter = (state->miterLimit + 1) * (state->miterLimit + 1);
m = 0;
} else {
miter = (SplashCoord)2 / ((SplashCoord)1 - dotprod);
if (miter < 1) {
miter = 1;
}
m = splashSqrt(miter - 1);
}
if (state->lineJoin == splashLineJoinRound) {
pathOut->moveTo(pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y);
pathOut->curveTo(pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y + bezierCircle2 * w,
pathIn->pts[j0].x + bezierCircle2 * w,
pathIn->pts[j0].y + (SplashCoord)0.5 * w,
pathIn->pts[j0].x,
pathIn->pts[j0].y + (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[j0].x - bezierCircle2 * w,
pathIn->pts[j0].y + (SplashCoord)0.5 * w,
pathIn->pts[j0].x - (SplashCoord)0.5 * w,
pathIn->pts[j0].y + bezierCircle2 * w,
pathIn->pts[j0].x - (SplashCoord)0.5 * w,
pathIn->pts[j0].y);
pathOut->curveTo(pathIn->pts[j0].x - (SplashCoord)0.5 * w,
pathIn->pts[j0].y - bezierCircle2 * w,
pathIn->pts[j0].x - bezierCircle2 * w,
pathIn->pts[j0].y - (SplashCoord)0.5 * w,
pathIn->pts[j0].x,
pathIn->pts[j0].y - (SplashCoord)0.5 * w);
pathOut->curveTo(pathIn->pts[j0].x + bezierCircle2 * w,
pathIn->pts[j0].y - (SplashCoord)0.5 * w,
pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y - bezierCircle2 * w,
pathIn->pts[j0].x + (SplashCoord)0.5 * w,
pathIn->pts[j0].y);
} else {
pathOut->moveTo(pathIn->pts[j0].x, pathIn->pts[j0].y);
if (crossprod < 0) {
pathOut->lineTo(pathIn->pts[j0].x - wdyNext,
pathIn->pts[j0].y + wdxNext);
if (state->lineJoin == splashLineJoinMiter &&
splashSqrt(miter) <= state->miterLimit) {
pathOut->lineTo(pathIn->pts[j0].x - wdy + wdx * m,
pathIn->pts[j0].y + wdx + wdy * m);
pathOut->lineTo(pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
} else {
pathOut->lineTo(pathIn->pts[j0].x - wdy,
pathIn->pts[j0].y + wdx);
}
} else {
pathOut->lineTo(pathIn->pts[j0].x + wdy,
pathIn->pts[j0].y - wdx);
if (state->lineJoin == splashLineJoinMiter &&
splashSqrt(miter) <= state->miterLimit) {
pathOut->lineTo(pathIn->pts[j0].x + wdy + wdx * m,
pathIn->pts[j0].y - wdx + wdy * m);
pathOut->lineTo(pathIn->pts[j0].x + wdyNext,
pathIn->pts[j0].y - wdxNext);
} else {
pathOut->lineTo(pathIn->pts[j0].x + wdyNext,
pathIn->pts[j0].y - wdxNext);
}
}
}
pathOut->close();
}
if (state->strokeAdjust) {
if (seg == 0 && !closed) {
if (state->lineCap == splashLineCapButt) {
pathOut->addStrokeAdjustHint(firstPt, left2 + 1,
firstPt, firstPt + 1);
if (last) {
pathOut->addStrokeAdjustHint(firstPt, left2 + 1,
left2 + 1, left2 + 2);
}
} else if (state->lineCap == splashLineCapProjecting) {
if (last) {
pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 2,
firstPt + 1, firstPt + 2);
pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 2,
left2 + 2, left2 + 3);
} else {
pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 1,
firstPt + 1, firstPt + 2);
}
}
}
if (seg >= 1) {
if (seg >= 2) {
pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0);
pathOut->addStrokeAdjustHint(left1, right1, join0, left2);
} else {
pathOut->addStrokeAdjustHint(left1, right1, firstPt, left2);
}
pathOut->addStrokeAdjustHint(left1, right1, right2 + 1, right2 + 1);
}
left0 = left1;
left1 = left2;
right0 = right1;
right1 = right2;
join0 = join1;
join1 = join2;
if (seg == 0) {
leftFirst = left2;
rightFirst = right2;
}
if (last) {
if (seg >= 2) {
pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0);
pathOut->addStrokeAdjustHint(left1, right1,
join0, pathOut->length - 1);
} else {
pathOut->addStrokeAdjustHint(left1, right1,
firstPt, pathOut->length - 1);
}
if (closed) {
pathOut->addStrokeAdjustHint(left1, right1, firstPt, leftFirst);
pathOut->addStrokeAdjustHint(left1, right1,
rightFirst + 1, rightFirst + 1);
pathOut->addStrokeAdjustHint(leftFirst, rightFirst,
left1 + 1, right1);
pathOut->addStrokeAdjustHint(leftFirst, rightFirst,
join1, pathOut->length - 1);
}
if (!closed && seg > 0) {
if (state->lineCap == splashLineCapButt) {
pathOut->addStrokeAdjustHint(left1 - 1, left1 + 1,
left1 + 1, left1 + 2);
} else if (state->lineCap == splashLineCapProjecting) {
pathOut->addStrokeAdjustHint(left1 - 1, left1 + 2,
left1 + 2, left1 + 3);
}
}
}
}
i0 = j0;
i1 = j1;
++seg;
}
if (pathIn != path) {
delete pathIn;
}
return pathOut;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,264
|
inline void Splash::pipeIncX(SplashPipe *pipe) {
++pipe->x;
if (state->softMask) {
++pipe->softMaskPtr;
}
switch (bitmap->mode) {
case splashModeMono1:
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
break;
case splashModeMono8:
++pipe->destColorPtr;
break;
case splashModeRGB8:
case splashModeBGR8:
pipe->destColorPtr += 3;
break;
case splashModeXBGR8:
pipe->destColorPtr += 4;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
pipe->destColorPtr += 4;
break;
case splashModeDeviceN8:
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
#endif
}
if (pipe->destAlphaPtr) {
++pipe->destAlphaPtr;
}
if (pipe->alpha0Ptr) {
++pipe->alpha0Ptr;
}
}
|
DoS
| 0
|
inline void Splash::pipeIncX(SplashPipe *pipe) {
++pipe->x;
if (state->softMask) {
++pipe->softMaskPtr;
}
switch (bitmap->mode) {
case splashModeMono1:
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
break;
case splashModeMono8:
++pipe->destColorPtr;
break;
case splashModeRGB8:
case splashModeBGR8:
pipe->destColorPtr += 3;
break;
case splashModeXBGR8:
pipe->destColorPtr += 4;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
pipe->destColorPtr += 4;
break;
case splashModeDeviceN8:
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
#endif
}
if (pipe->destAlphaPtr) {
++pipe->destAlphaPtr;
}
if (pipe->alpha0Ptr) {
++pipe->alpha0Ptr;
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,265
|
inline void Splash::pipeInit(SplashPipe *pipe, int x, int y,
SplashPattern *pattern, SplashColorPtr cSrc,
Guchar aInput, GBool usesShape,
GBool nonIsolatedGroup,
GBool knockout, Guchar knockoutOpacity) {
pipeSetXY(pipe, x, y);
pipe->pattern = NULL;
if (pattern) {
if (pattern->isStatic()) {
pattern->getColor(x, y, pipe->cSrcVal);
} else {
pipe->pattern = pattern;
}
pipe->cSrc = pipe->cSrcVal;
} else {
pipe->cSrc = cSrc;
}
pipe->aInput = aInput;
pipe->usesShape = usesShape;
pipe->knockout = knockout;
pipe->knockoutOpacity = knockoutOpacity;
if (aInput == 255 && !state->softMask && !usesShape &&
!state->inNonIsolatedGroup && !nonIsolatedGroup) {
pipe->noTransparency = gTrue;
} else {
pipe->noTransparency = gFalse;
}
if (pipe->noTransparency) {
pipe->resultColorCtrl = pipeResultColorNoAlphaBlend[bitmap->mode];
} else if (!state->blendFunc) {
pipe->resultColorCtrl = pipeResultColorAlphaNoBlend[bitmap->mode];
} else {
pipe->resultColorCtrl = pipeResultColorAlphaBlend[bitmap->mode];
}
pipe->nonIsolatedGroup = nonIsolatedGroup;
pipe->run = &Splash::pipeRun;
if (!pipe->pattern && pipe->noTransparency && !state->blendFunc) {
if (bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleMono1;
} else if (bitmap->mode == splashModeMono8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleMono8;
} else if (bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleRGB8;
} else if (bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleXBGR8;
} else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleBGR8;
#if SPLASH_CMYK
} else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleCMYK8;
} else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleDeviceN8;
#endif
}
} else if (!pipe->pattern && !pipe->noTransparency && !state->softMask &&
pipe->usesShape &&
!(state->inNonIsolatedGroup && alpha0Bitmap->alpha) &&
!state->blendFunc && !pipe->nonIsolatedGroup) {
if (bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAAMono1;
} else if (bitmap->mode == splashModeMono8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAAMono8;
} else if (bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAARGB8;
} else if (bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAAXBGR8;
} else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAABGR8;
#if SPLASH_CMYK
} else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAACMYK8;
} else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAADeviceN8;
#endif
}
}
}
|
DoS
| 0
|
inline void Splash::pipeInit(SplashPipe *pipe, int x, int y,
SplashPattern *pattern, SplashColorPtr cSrc,
Guchar aInput, GBool usesShape,
GBool nonIsolatedGroup,
GBool knockout, Guchar knockoutOpacity) {
pipeSetXY(pipe, x, y);
pipe->pattern = NULL;
if (pattern) {
if (pattern->isStatic()) {
pattern->getColor(x, y, pipe->cSrcVal);
} else {
pipe->pattern = pattern;
}
pipe->cSrc = pipe->cSrcVal;
} else {
pipe->cSrc = cSrc;
}
pipe->aInput = aInput;
pipe->usesShape = usesShape;
pipe->knockout = knockout;
pipe->knockoutOpacity = knockoutOpacity;
if (aInput == 255 && !state->softMask && !usesShape &&
!state->inNonIsolatedGroup && !nonIsolatedGroup) {
pipe->noTransparency = gTrue;
} else {
pipe->noTransparency = gFalse;
}
if (pipe->noTransparency) {
pipe->resultColorCtrl = pipeResultColorNoAlphaBlend[bitmap->mode];
} else if (!state->blendFunc) {
pipe->resultColorCtrl = pipeResultColorAlphaNoBlend[bitmap->mode];
} else {
pipe->resultColorCtrl = pipeResultColorAlphaBlend[bitmap->mode];
}
pipe->nonIsolatedGroup = nonIsolatedGroup;
pipe->run = &Splash::pipeRun;
if (!pipe->pattern && pipe->noTransparency && !state->blendFunc) {
if (bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleMono1;
} else if (bitmap->mode == splashModeMono8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleMono8;
} else if (bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleRGB8;
} else if (bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleXBGR8;
} else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleBGR8;
#if SPLASH_CMYK
} else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleCMYK8;
} else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleDeviceN8;
#endif
}
} else if (!pipe->pattern && !pipe->noTransparency && !state->softMask &&
pipe->usesShape &&
!(state->inNonIsolatedGroup && alpha0Bitmap->alpha) &&
!state->blendFunc && !pipe->nonIsolatedGroup) {
if (bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAAMono1;
} else if (bitmap->mode == splashModeMono8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAAMono8;
} else if (bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAARGB8;
} else if (bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAAXBGR8;
} else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAABGR8;
#if SPLASH_CMYK
} else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAACMYK8;
} else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAADeviceN8;
#endif
}
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,266
|
void Splash::pipeRun(SplashPipe *pipe) {
Guchar aSrc, aDest, alphaI, alphaIm1, alpha0, aResult;
SplashColor cSrcNonIso, cDest, cBlend;
SplashColorPtr cSrc;
Guchar cResult0, cResult1, cResult2, cResult3;
int t;
#if SPLASH_CMYK
int cp, mask;
Guchar cResult[SPOT_NCOMPS+4];
#endif
if (pipe->pattern) {
if (!pipe->pattern->getColor(pipe->x, pipe->y, pipe->cSrcVal)) {
pipeIncX(pipe);
return;
}
}
if (pipe->noTransparency && !state->blendFunc) {
switch (bitmap->mode) {
case splashModeMono1:
cResult0 = state->grayTransfer[pipe->cSrc[0]];
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
break;
case splashModeMono8:
*pipe->destColorPtr++ = state->grayTransfer[pipe->cSrc[0]];
break;
case splashModeRGB8:
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
break;
case splashModeXBGR8:
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
*pipe->destColorPtr++ = 255;
break;
case splashModeBGR8:
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
break;
#if SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) :
state->cmykTransferC[pipe->cSrc[0]];
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) :
state->cmykTransferM[pipe->cSrc[1]];
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) :
state->cmykTransferY[pipe->cSrc[2]];
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) :
state->cmykTransferK[pipe->cSrc[3]];
}
pipe->destColorPtr += 4;
break;
case splashModeDeviceN8:
mask = 1;
for (cp = 0; cp < SPOT_NCOMPS + 4; cp ++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = state->deviceNTransfer[cp][pipe->cSrc[cp]];
}
mask <<= 1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
#endif
}
if (pipe->destAlphaPtr) {
*pipe->destAlphaPtr++ = 255;
}
} else {
switch (bitmap->mode) {
case splashModeMono1:
cDest[0] = (*pipe->destColorPtr & pipe->destColorMask) ? 0xff : 0x00;
break;
case splashModeMono8:
cDest[0] = *pipe->destColorPtr;
break;
case splashModeRGB8:
cDest[0] = pipe->destColorPtr[0];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[2];
break;
case splashModeXBGR8:
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
cDest[3] = 255;
break;
case splashModeBGR8:
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
break;
#if SPLASH_CMYK
case splashModeCMYK8:
cDest[0] = pipe->destColorPtr[0];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[2];
cDest[3] = pipe->destColorPtr[3];
break;
case splashModeDeviceN8:
for (cp = 0; cp < SPOT_NCOMPS + 4; cp++)
cDest[cp] = pipe->destColorPtr[cp];
break;
#endif
}
if (pipe->destAlphaPtr) {
aDest = *pipe->destAlphaPtr;
} else {
aDest = 0xff;
}
if (state->softMask) {
if (pipe->usesShape) {
aSrc = div255(div255(pipe->aInput * *pipe->softMaskPtr++) *
pipe->shape);
} else {
aSrc = div255(pipe->aInput * *pipe->softMaskPtr++);
}
} else if (pipe->usesShape) {
aSrc = div255(pipe->aInput * pipe->shape);
} else {
aSrc = pipe->aInput;
}
if (pipe->nonIsolatedGroup) {
if (pipe->shape == 0) {
cSrc = pipe->cSrc;
} else {
t = (aDest * 255) / pipe->shape - aDest;
switch (bitmap->mode) {
#if SPLASH_CMYK
case splashModeDeviceN8:
for (cp = 4; cp < SPOT_NCOMPS + 4; cp++)
cSrcNonIso[cp] = clip255(pipe->cSrc[cp] +
((pipe->cSrc[cp] - cDest[cp]) * t) / 255);
case splashModeCMYK8:
cSrcNonIso[3] = clip255(pipe->cSrc[3] +
((pipe->cSrc[3] - cDest[3]) * t) / 255);
#endif
case splashModeRGB8:
case splashModeXBGR8:
case splashModeBGR8:
cSrcNonIso[2] = clip255(pipe->cSrc[2] +
((pipe->cSrc[2] - cDest[2]) * t) / 255);
cSrcNonIso[1] = clip255(pipe->cSrc[1] +
((pipe->cSrc[1] - cDest[1]) * t) / 255);
case splashModeMono1:
case splashModeMono8:
cSrcNonIso[0] = clip255(pipe->cSrc[0] +
((pipe->cSrc[0] - cDest[0]) * t) / 255);
break;
}
cSrc = cSrcNonIso;
if (pipe->knockout && pipe->shape >= pipe->knockoutOpacity) {
aDest = 0;
}
}
} else {
cSrc = pipe->cSrc;
}
if (state->blendFunc) {
(*state->blendFunc)(cSrc, cDest, cBlend, bitmap->mode);
}
if (pipe->noTransparency) {
alphaI = alphaIm1 = aResult = 255;
} else {
aResult = aSrc + aDest - div255(aSrc * aDest);
if (pipe->alpha0Ptr) {
alpha0 = *pipe->alpha0Ptr++;
alphaI = aResult + alpha0 - div255(aResult * alpha0);
alphaIm1 = alpha0 + aDest - div255(alpha0 * aDest);
} else {
alphaI = aResult;
alphaIm1 = aDest;
}
}
cResult0 = cResult1 = cResult2 = cResult3 = 0; // make gcc happy
switch (pipe->resultColorCtrl) {
case splashPipeResultColorNoAlphaBlendMono:
cResult0 = state->grayTransfer[div255((255 - aDest) * cSrc[0] +
aDest * cBlend[0])];
break;
case splashPipeResultColorNoAlphaBlendRGB:
cResult0 = state->rgbTransferR[div255((255 - aDest) * cSrc[0] +
aDest * cBlend[0])];
cResult1 = state->rgbTransferG[div255((255 - aDest) * cSrc[1] +
aDest * cBlend[1])];
cResult2 = state->rgbTransferB[div255((255 - aDest) * cSrc[2] +
aDest * cBlend[2])];
break;
#if SPLASH_CMYK
case splashPipeResultColorNoAlphaBlendCMYK:
cResult0 = state->cmykTransferC[div255((255 - aDest) * cSrc[0] +
aDest * cBlend[0])];
cResult1 = state->cmykTransferM[div255((255 - aDest) * cSrc[1] +
aDest * cBlend[1])];
cResult2 = state->cmykTransferY[div255((255 - aDest) * cSrc[2] +
aDest * cBlend[2])];
cResult3 = state->cmykTransferK[div255((255 - aDest) * cSrc[3] +
aDest * cBlend[3])];
break;
case splashPipeResultColorNoAlphaBlendDeviceN:
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][div255((255 - aDest) * cSrc[cp] +
aDest * cBlend[cp])];
break;
#endif
case splashPipeResultColorAlphaNoBlendMono:
if (alphaI == 0) {
cResult0 = 0;
} else {
cResult0 = state->grayTransfer[((alphaI - aSrc) * cDest[0] +
aSrc * cSrc[0]) / alphaI];
}
break;
case splashPipeResultColorAlphaNoBlendRGB:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[((alphaI - aSrc) * cDest[0] +
aSrc * cSrc[0]) / alphaI];
cResult1 = state->rgbTransferG[((alphaI - aSrc) * cDest[1] +
aSrc * cSrc[1]) / alphaI];
cResult2 = state->rgbTransferB[((alphaI - aSrc) * cDest[2] +
aSrc * cSrc[2]) / alphaI];
}
break;
#if SPLASH_CMYK
case splashPipeResultColorAlphaNoBlendCMYK:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
cResult3 = 0;
} else {
cResult0 = state->cmykTransferC[((alphaI - aSrc) * cDest[0] +
aSrc * cSrc[0]) / alphaI];
cResult1 = state->cmykTransferM[((alphaI - aSrc) * cDest[1] +
aSrc * cSrc[1]) / alphaI];
cResult2 = state->cmykTransferY[((alphaI - aSrc) * cDest[2] +
aSrc * cSrc[2]) / alphaI];
cResult3 = state->cmykTransferK[((alphaI - aSrc) * cDest[3] +
aSrc * cSrc[3]) / alphaI];
}
break;
case splashPipeResultColorAlphaNoBlendDeviceN:
if (alphaI == 0) {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = 0;
} else {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][((alphaI - aSrc) * cDest[cp] +
aSrc * cSrc[cp]) / alphaI];
}
break;
#endif
case splashPipeResultColorAlphaBlendMono:
if (alphaI == 0) {
cResult0 = 0;
} else {
cResult0 = state->grayTransfer[((alphaI - aSrc) * cDest[0] +
aSrc * ((255 - alphaIm1) * cSrc[0] +
alphaIm1 * cBlend[0]) / 255) /
alphaI];
}
break;
case splashPipeResultColorAlphaBlendRGB:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[((alphaI - aSrc) * cDest[0] +
aSrc * ((255 - alphaIm1) * cSrc[0] +
alphaIm1 * cBlend[0]) / 255) /
alphaI];
cResult1 = state->rgbTransferG[((alphaI - aSrc) * cDest[1] +
aSrc * ((255 - alphaIm1) * cSrc[1] +
alphaIm1 * cBlend[1]) / 255) /
alphaI];
cResult2 = state->rgbTransferB[((alphaI - aSrc) * cDest[2] +
aSrc * ((255 - alphaIm1) * cSrc[2] +
alphaIm1 * cBlend[2]) / 255) /
alphaI];
}
break;
#if SPLASH_CMYK
case splashPipeResultColorAlphaBlendCMYK:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
cResult3 = 0;
} else {
cResult0 = state->cmykTransferC[((alphaI - aSrc) * cDest[0] +
aSrc * ((255 - alphaIm1) * cSrc[0] +
alphaIm1 * cBlend[0]) / 255) /
alphaI];
cResult1 = state->cmykTransferM[((alphaI - aSrc) * cDest[1] +
aSrc * ((255 - alphaIm1) * cSrc[1] +
alphaIm1 * cBlend[1]) / 255) /
alphaI];
cResult2 = state->cmykTransferY[((alphaI - aSrc) * cDest[2] +
aSrc * ((255 - alphaIm1) * cSrc[2] +
alphaIm1 * cBlend[2]) / 255) /
alphaI];
cResult3 = state->cmykTransferK[((alphaI - aSrc) * cDest[3] +
aSrc * ((255 - alphaIm1) * cSrc[3] +
alphaIm1 * cBlend[3]) / 255) /
alphaI];
}
break;
case splashPipeResultColorAlphaBlendDeviceN:
if (alphaI == 0) {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = 0;
} else {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][((alphaI - aSrc) * cDest[cp] +
aSrc * ((255 - alphaIm1) * cSrc[cp] +
alphaIm1 * cBlend[cp]) / 255) /
alphaI];
}
break;
#endif
}
switch (bitmap->mode) {
case splashModeMono1:
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
break;
case splashModeMono8:
*pipe->destColorPtr++ = cResult0;
break;
case splashModeRGB8:
*pipe->destColorPtr++ = cResult0;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult2;
break;
case splashModeXBGR8:
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
*pipe->destColorPtr++ = 255;
break;
case splashModeBGR8:
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[0] + cResult0, 255) :
cResult0;
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[1] + cResult1, 255) :
cResult1;
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[2] + cResult2, 255) :
cResult2;
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[3] + cResult3, 255) :
cResult3;
}
pipe->destColorPtr += 4;
break;
case splashModeDeviceN8:
mask = 1;
for (cp = 0; cp < SPOT_NCOMPS+4; cp++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = cResult[cp];
}
mask <<=1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
#endif
}
if (pipe->destAlphaPtr) {
*pipe->destAlphaPtr++ = aResult;
}
}
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRun(SplashPipe *pipe) {
Guchar aSrc, aDest, alphaI, alphaIm1, alpha0, aResult;
SplashColor cSrcNonIso, cDest, cBlend;
SplashColorPtr cSrc;
Guchar cResult0, cResult1, cResult2, cResult3;
int t;
#if SPLASH_CMYK
int cp, mask;
Guchar cResult[SPOT_NCOMPS+4];
#endif
if (pipe->pattern) {
if (!pipe->pattern->getColor(pipe->x, pipe->y, pipe->cSrcVal)) {
pipeIncX(pipe);
return;
}
}
if (pipe->noTransparency && !state->blendFunc) {
switch (bitmap->mode) {
case splashModeMono1:
cResult0 = state->grayTransfer[pipe->cSrc[0]];
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
break;
case splashModeMono8:
*pipe->destColorPtr++ = state->grayTransfer[pipe->cSrc[0]];
break;
case splashModeRGB8:
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
break;
case splashModeXBGR8:
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
*pipe->destColorPtr++ = 255;
break;
case splashModeBGR8:
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
break;
#if SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) :
state->cmykTransferC[pipe->cSrc[0]];
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) :
state->cmykTransferM[pipe->cSrc[1]];
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) :
state->cmykTransferY[pipe->cSrc[2]];
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) :
state->cmykTransferK[pipe->cSrc[3]];
}
pipe->destColorPtr += 4;
break;
case splashModeDeviceN8:
mask = 1;
for (cp = 0; cp < SPOT_NCOMPS + 4; cp ++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = state->deviceNTransfer[cp][pipe->cSrc[cp]];
}
mask <<= 1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
#endif
}
if (pipe->destAlphaPtr) {
*pipe->destAlphaPtr++ = 255;
}
} else {
switch (bitmap->mode) {
case splashModeMono1:
cDest[0] = (*pipe->destColorPtr & pipe->destColorMask) ? 0xff : 0x00;
break;
case splashModeMono8:
cDest[0] = *pipe->destColorPtr;
break;
case splashModeRGB8:
cDest[0] = pipe->destColorPtr[0];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[2];
break;
case splashModeXBGR8:
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
cDest[3] = 255;
break;
case splashModeBGR8:
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
break;
#if SPLASH_CMYK
case splashModeCMYK8:
cDest[0] = pipe->destColorPtr[0];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[2];
cDest[3] = pipe->destColorPtr[3];
break;
case splashModeDeviceN8:
for (cp = 0; cp < SPOT_NCOMPS + 4; cp++)
cDest[cp] = pipe->destColorPtr[cp];
break;
#endif
}
if (pipe->destAlphaPtr) {
aDest = *pipe->destAlphaPtr;
} else {
aDest = 0xff;
}
if (state->softMask) {
if (pipe->usesShape) {
aSrc = div255(div255(pipe->aInput * *pipe->softMaskPtr++) *
pipe->shape);
} else {
aSrc = div255(pipe->aInput * *pipe->softMaskPtr++);
}
} else if (pipe->usesShape) {
aSrc = div255(pipe->aInput * pipe->shape);
} else {
aSrc = pipe->aInput;
}
if (pipe->nonIsolatedGroup) {
if (pipe->shape == 0) {
cSrc = pipe->cSrc;
} else {
t = (aDest * 255) / pipe->shape - aDest;
switch (bitmap->mode) {
#if SPLASH_CMYK
case splashModeDeviceN8:
for (cp = 4; cp < SPOT_NCOMPS + 4; cp++)
cSrcNonIso[cp] = clip255(pipe->cSrc[cp] +
((pipe->cSrc[cp] - cDest[cp]) * t) / 255);
case splashModeCMYK8:
cSrcNonIso[3] = clip255(pipe->cSrc[3] +
((pipe->cSrc[3] - cDest[3]) * t) / 255);
#endif
case splashModeRGB8:
case splashModeXBGR8:
case splashModeBGR8:
cSrcNonIso[2] = clip255(pipe->cSrc[2] +
((pipe->cSrc[2] - cDest[2]) * t) / 255);
cSrcNonIso[1] = clip255(pipe->cSrc[1] +
((pipe->cSrc[1] - cDest[1]) * t) / 255);
case splashModeMono1:
case splashModeMono8:
cSrcNonIso[0] = clip255(pipe->cSrc[0] +
((pipe->cSrc[0] - cDest[0]) * t) / 255);
break;
}
cSrc = cSrcNonIso;
if (pipe->knockout && pipe->shape >= pipe->knockoutOpacity) {
aDest = 0;
}
}
} else {
cSrc = pipe->cSrc;
}
if (state->blendFunc) {
(*state->blendFunc)(cSrc, cDest, cBlend, bitmap->mode);
}
if (pipe->noTransparency) {
alphaI = alphaIm1 = aResult = 255;
} else {
aResult = aSrc + aDest - div255(aSrc * aDest);
if (pipe->alpha0Ptr) {
alpha0 = *pipe->alpha0Ptr++;
alphaI = aResult + alpha0 - div255(aResult * alpha0);
alphaIm1 = alpha0 + aDest - div255(alpha0 * aDest);
} else {
alphaI = aResult;
alphaIm1 = aDest;
}
}
cResult0 = cResult1 = cResult2 = cResult3 = 0; // make gcc happy
switch (pipe->resultColorCtrl) {
case splashPipeResultColorNoAlphaBlendMono:
cResult0 = state->grayTransfer[div255((255 - aDest) * cSrc[0] +
aDest * cBlend[0])];
break;
case splashPipeResultColorNoAlphaBlendRGB:
cResult0 = state->rgbTransferR[div255((255 - aDest) * cSrc[0] +
aDest * cBlend[0])];
cResult1 = state->rgbTransferG[div255((255 - aDest) * cSrc[1] +
aDest * cBlend[1])];
cResult2 = state->rgbTransferB[div255((255 - aDest) * cSrc[2] +
aDest * cBlend[2])];
break;
#if SPLASH_CMYK
case splashPipeResultColorNoAlphaBlendCMYK:
cResult0 = state->cmykTransferC[div255((255 - aDest) * cSrc[0] +
aDest * cBlend[0])];
cResult1 = state->cmykTransferM[div255((255 - aDest) * cSrc[1] +
aDest * cBlend[1])];
cResult2 = state->cmykTransferY[div255((255 - aDest) * cSrc[2] +
aDest * cBlend[2])];
cResult3 = state->cmykTransferK[div255((255 - aDest) * cSrc[3] +
aDest * cBlend[3])];
break;
case splashPipeResultColorNoAlphaBlendDeviceN:
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][div255((255 - aDest) * cSrc[cp] +
aDest * cBlend[cp])];
break;
#endif
case splashPipeResultColorAlphaNoBlendMono:
if (alphaI == 0) {
cResult0 = 0;
} else {
cResult0 = state->grayTransfer[((alphaI - aSrc) * cDest[0] +
aSrc * cSrc[0]) / alphaI];
}
break;
case splashPipeResultColorAlphaNoBlendRGB:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[((alphaI - aSrc) * cDest[0] +
aSrc * cSrc[0]) / alphaI];
cResult1 = state->rgbTransferG[((alphaI - aSrc) * cDest[1] +
aSrc * cSrc[1]) / alphaI];
cResult2 = state->rgbTransferB[((alphaI - aSrc) * cDest[2] +
aSrc * cSrc[2]) / alphaI];
}
break;
#if SPLASH_CMYK
case splashPipeResultColorAlphaNoBlendCMYK:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
cResult3 = 0;
} else {
cResult0 = state->cmykTransferC[((alphaI - aSrc) * cDest[0] +
aSrc * cSrc[0]) / alphaI];
cResult1 = state->cmykTransferM[((alphaI - aSrc) * cDest[1] +
aSrc * cSrc[1]) / alphaI];
cResult2 = state->cmykTransferY[((alphaI - aSrc) * cDest[2] +
aSrc * cSrc[2]) / alphaI];
cResult3 = state->cmykTransferK[((alphaI - aSrc) * cDest[3] +
aSrc * cSrc[3]) / alphaI];
}
break;
case splashPipeResultColorAlphaNoBlendDeviceN:
if (alphaI == 0) {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = 0;
} else {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][((alphaI - aSrc) * cDest[cp] +
aSrc * cSrc[cp]) / alphaI];
}
break;
#endif
case splashPipeResultColorAlphaBlendMono:
if (alphaI == 0) {
cResult0 = 0;
} else {
cResult0 = state->grayTransfer[((alphaI - aSrc) * cDest[0] +
aSrc * ((255 - alphaIm1) * cSrc[0] +
alphaIm1 * cBlend[0]) / 255) /
alphaI];
}
break;
case splashPipeResultColorAlphaBlendRGB:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[((alphaI - aSrc) * cDest[0] +
aSrc * ((255 - alphaIm1) * cSrc[0] +
alphaIm1 * cBlend[0]) / 255) /
alphaI];
cResult1 = state->rgbTransferG[((alphaI - aSrc) * cDest[1] +
aSrc * ((255 - alphaIm1) * cSrc[1] +
alphaIm1 * cBlend[1]) / 255) /
alphaI];
cResult2 = state->rgbTransferB[((alphaI - aSrc) * cDest[2] +
aSrc * ((255 - alphaIm1) * cSrc[2] +
alphaIm1 * cBlend[2]) / 255) /
alphaI];
}
break;
#if SPLASH_CMYK
case splashPipeResultColorAlphaBlendCMYK:
if (alphaI == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
cResult3 = 0;
} else {
cResult0 = state->cmykTransferC[((alphaI - aSrc) * cDest[0] +
aSrc * ((255 - alphaIm1) * cSrc[0] +
alphaIm1 * cBlend[0]) / 255) /
alphaI];
cResult1 = state->cmykTransferM[((alphaI - aSrc) * cDest[1] +
aSrc * ((255 - alphaIm1) * cSrc[1] +
alphaIm1 * cBlend[1]) / 255) /
alphaI];
cResult2 = state->cmykTransferY[((alphaI - aSrc) * cDest[2] +
aSrc * ((255 - alphaIm1) * cSrc[2] +
alphaIm1 * cBlend[2]) / 255) /
alphaI];
cResult3 = state->cmykTransferK[((alphaI - aSrc) * cDest[3] +
aSrc * ((255 - alphaIm1) * cSrc[3] +
alphaIm1 * cBlend[3]) / 255) /
alphaI];
}
break;
case splashPipeResultColorAlphaBlendDeviceN:
if (alphaI == 0) {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = 0;
} else {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][((alphaI - aSrc) * cDest[cp] +
aSrc * ((255 - alphaIm1) * cSrc[cp] +
alphaIm1 * cBlend[cp]) / 255) /
alphaI];
}
break;
#endif
}
switch (bitmap->mode) {
case splashModeMono1:
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
break;
case splashModeMono8:
*pipe->destColorPtr++ = cResult0;
break;
case splashModeRGB8:
*pipe->destColorPtr++ = cResult0;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult2;
break;
case splashModeXBGR8:
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
*pipe->destColorPtr++ = 255;
break;
case splashModeBGR8:
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[0] + cResult0, 255) :
cResult0;
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[1] + cResult1, 255) :
cResult1;
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[2] + cResult2, 255) :
cResult2;
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[3] + cResult3, 255) :
cResult3;
}
pipe->destColorPtr += 4;
break;
case splashModeDeviceN8:
mask = 1;
for (cp = 0; cp < SPOT_NCOMPS+4; cp++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = cResult[cp];
}
mask <<=1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
#endif
}
if (pipe->destAlphaPtr) {
*pipe->destAlphaPtr++ = aResult;
}
}
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,267
|
void Splash::pipeRunAABGR8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult0, cResult1, cResult2;
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0]) / alpha2)];
cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] +
aSrc * pipe->cSrc[1]) / alpha2)];
cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] +
aSrc * pipe->cSrc[2]) / alpha2)];
}
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunAABGR8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult0, cResult1, cResult2;
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0]) / alpha2)];
cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] +
aSrc * pipe->cSrc[1]) / alpha2)];
cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] +
aSrc * pipe->cSrc[2]) / alpha2)];
}
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,268
|
void Splash::pipeRunAACMYK8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult0, cResult1, cResult2, cResult3;
cDest[0] = pipe->destColorPtr[0];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[2];
cDest[3] = pipe->destColorPtr[3];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
cResult3 = 0;
} else {
cResult0 = state->cmykTransferC[(Guchar)(((alpha2 - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0]) / alpha2)];
cResult1 = state->cmykTransferM[(Guchar)(((alpha2 - aSrc) * cDest[1] +
aSrc * pipe->cSrc[1]) / alpha2)];
cResult2 = state->cmykTransferY[(Guchar)(((alpha2 - aSrc) * cDest[2] +
aSrc * pipe->cSrc[2]) / alpha2)];
cResult3 = state->cmykTransferK[(Guchar)(((alpha2 - aSrc) * cDest[3] +
aSrc * pipe->cSrc[3]) / alpha2)];
}
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[0] + cResult0, 255) :
cResult0;
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[1] + cResult1, 255) :
cResult1;
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[2] + cResult2, 255) :
cResult2;
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[3] + cResult3, 255) :
cResult3;
}
pipe->destColorPtr += 4;
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunAACMYK8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult0, cResult1, cResult2, cResult3;
cDest[0] = pipe->destColorPtr[0];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[2];
cDest[3] = pipe->destColorPtr[3];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
cResult3 = 0;
} else {
cResult0 = state->cmykTransferC[(Guchar)(((alpha2 - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0]) / alpha2)];
cResult1 = state->cmykTransferM[(Guchar)(((alpha2 - aSrc) * cDest[1] +
aSrc * pipe->cSrc[1]) / alpha2)];
cResult2 = state->cmykTransferY[(Guchar)(((alpha2 - aSrc) * cDest[2] +
aSrc * pipe->cSrc[2]) / alpha2)];
cResult3 = state->cmykTransferK[(Guchar)(((alpha2 - aSrc) * cDest[3] +
aSrc * pipe->cSrc[3]) / alpha2)];
}
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[0] + cResult0, 255) :
cResult0;
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[1] + cResult1, 255) :
cResult1;
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[2] + cResult2, 255) :
cResult2;
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive && pipe->shape != 0) ?
std::min<int>(pipe->destColorPtr[3] + cResult3, 255) :
cResult3;
}
pipe->destColorPtr += 4;
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,269
|
void Splash::pipeRunAADeviceN8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult[SPOT_NCOMPS+4];
int cp, mask;
for (cp=0; cp < SPOT_NCOMPS+4; cp++)
cDest[cp] = pipe->destColorPtr[cp];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
for (cp=0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = 0;
} else {
for (cp=0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][(Guchar)(((alpha2 - aSrc) * cDest[cp] +
aSrc * pipe->cSrc[cp]) / alpha2)];
}
mask = 1;
for (cp=0; cp < SPOT_NCOMPS+4; cp++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = cResult[cp];
}
mask <<= 1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunAADeviceN8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult[SPOT_NCOMPS+4];
int cp, mask;
for (cp=0; cp < SPOT_NCOMPS+4; cp++)
cDest[cp] = pipe->destColorPtr[cp];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
for (cp=0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = 0;
} else {
for (cp=0; cp < SPOT_NCOMPS+4; cp++)
cResult[cp] = state->deviceNTransfer[cp][(Guchar)(((alpha2 - aSrc) * cDest[cp] +
aSrc * pipe->cSrc[cp]) / alpha2)];
}
mask = 1;
for (cp=0; cp < SPOT_NCOMPS+4; cp++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = cResult[cp];
}
mask <<= 1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,270
|
void Splash::pipeRunAAMono1(SplashPipe *pipe) {
Guchar aSrc;
SplashColor cDest;
Guchar cResult0;
cDest[0] = (*pipe->destColorPtr & pipe->destColorMask) ? 0xff : 0x00;
aSrc = div255(pipe->aInput * pipe->shape);
cResult0 = state->grayTransfer[(Guchar)div255((0xff - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0])];
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunAAMono1(SplashPipe *pipe) {
Guchar aSrc;
SplashColor cDest;
Guchar cResult0;
cDest[0] = (*pipe->destColorPtr & pipe->destColorMask) ? 0xff : 0x00;
aSrc = div255(pipe->aInput * pipe->shape);
cResult0 = state->grayTransfer[(Guchar)div255((0xff - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0])];
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,271
|
void Splash::pipeRunAAXBGR8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult0, cResult1, cResult2;
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0]) / alpha2)];
cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] +
aSrc * pipe->cSrc[1]) / alpha2)];
cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] +
aSrc * pipe->cSrc[2]) / alpha2)];
}
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
*pipe->destColorPtr++ = 255;
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunAAXBGR8(SplashPipe *pipe) {
Guchar aSrc, aDest, alpha2, aResult;
SplashColor cDest;
Guchar cResult0, cResult1, cResult2;
cDest[0] = pipe->destColorPtr[2];
cDest[1] = pipe->destColorPtr[1];
cDest[2] = pipe->destColorPtr[0];
aDest = *pipe->destAlphaPtr;
aSrc = div255(pipe->aInput * pipe->shape);
aResult = aSrc + aDest - div255(aSrc * aDest);
alpha2 = aResult;
if (alpha2 == 0) {
cResult0 = 0;
cResult1 = 0;
cResult2 = 0;
} else {
cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] +
aSrc * pipe->cSrc[0]) / alpha2)];
cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] +
aSrc * pipe->cSrc[1]) / alpha2)];
cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] +
aSrc * pipe->cSrc[2]) / alpha2)];
}
*pipe->destColorPtr++ = cResult2;
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
*pipe->destColorPtr++ = 255;
*pipe->destAlphaPtr++ = aResult;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,272
|
void Splash::pipeRunSimpleBGR8(SplashPipe *pipe) {
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunSimpleBGR8(SplashPipe *pipe) {
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,273
|
void Splash::pipeRunSimpleCMYK8(SplashPipe *pipe) {
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) :
state->cmykTransferC[pipe->cSrc[0]];
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) :
state->cmykTransferM[pipe->cSrc[1]];
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) :
state->cmykTransferY[pipe->cSrc[2]];
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) :
state->cmykTransferK[pipe->cSrc[3]];
}
pipe->destColorPtr += 4;
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunSimpleCMYK8(SplashPipe *pipe) {
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) :
state->cmykTransferC[pipe->cSrc[0]];
}
if (state->overprintMask & 2) {
pipe->destColorPtr[1] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) :
state->cmykTransferM[pipe->cSrc[1]];
}
if (state->overprintMask & 4) {
pipe->destColorPtr[2] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) :
state->cmykTransferY[pipe->cSrc[2]];
}
if (state->overprintMask & 8) {
pipe->destColorPtr[3] = (state->overprintAdditive) ?
std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) :
state->cmykTransferK[pipe->cSrc[3]];
}
pipe->destColorPtr += 4;
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,274
|
void Splash::pipeRunSimpleDeviceN8(SplashPipe *pipe) {
int mask = 1;
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = state->deviceNTransfer[cp][pipe->cSrc[cp]];
}
mask <<=1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunSimpleDeviceN8(SplashPipe *pipe) {
int mask = 1;
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) {
if (state->overprintMask & mask) {
pipe->destColorPtr[cp] = state->deviceNTransfer[cp][pipe->cSrc[cp]];
}
mask <<=1;
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,275
|
void Splash::pipeRunSimpleMono1(SplashPipe *pipe) {
Guchar cResult0;
cResult0 = state->grayTransfer[pipe->cSrc[0]];
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunSimpleMono1(SplashPipe *pipe) {
Guchar cResult0;
cResult0 = state->grayTransfer[pipe->cSrc[0]];
if (state->screen->test(pipe->x, pipe->y, cResult0)) {
*pipe->destColorPtr |= pipe->destColorMask;
} else {
*pipe->destColorPtr &= ~pipe->destColorMask;
}
if (!(pipe->destColorMask >>= 1)) {
pipe->destColorMask = 0x80;
++pipe->destColorPtr;
}
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,276
|
void Splash::pipeRunSimpleMono8(SplashPipe *pipe) {
*pipe->destColorPtr++ = state->grayTransfer[pipe->cSrc[0]];
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
DoS
| 0
|
void Splash::pipeRunSimpleMono8(SplashPipe *pipe) {
*pipe->destColorPtr++ = state->grayTransfer[pipe->cSrc[0]];
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,277
|
inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) {
pipe->x = x;
pipe->y = y;
if (state->softMask) {
pipe->softMaskPtr =
&state->softMask->data[y * state->softMask->rowSize + x];
}
switch (bitmap->mode) {
case splashModeMono1:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (x >> 3)];
pipe->destColorMask = 0x80 >> (x & 7);
break;
case splashModeMono8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + x];
break;
case splashModeRGB8:
case splashModeBGR8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x];
break;
case splashModeXBGR8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
break;
#if SPLASH_CMYK
case splashModeCMYK8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
break;
case splashModeDeviceN8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (SPOT_NCOMPS + 4) * x];
break;
#endif
}
if (bitmap->alpha) {
pipe->destAlphaPtr = &bitmap->alpha[y * bitmap->width + x];
} else {
pipe->destAlphaPtr = NULL;
}
if (state->inNonIsolatedGroup && alpha0Bitmap->alpha) {
pipe->alpha0Ptr =
&alpha0Bitmap->alpha[(alpha0Y + y) * alpha0Bitmap->width +
(alpha0X + x)];
} else {
pipe->alpha0Ptr = NULL;
}
}
|
DoS
| 0
|
inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) {
pipe->x = x;
pipe->y = y;
if (state->softMask) {
pipe->softMaskPtr =
&state->softMask->data[y * state->softMask->rowSize + x];
}
switch (bitmap->mode) {
case splashModeMono1:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (x >> 3)];
pipe->destColorMask = 0x80 >> (x & 7);
break;
case splashModeMono8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + x];
break;
case splashModeRGB8:
case splashModeBGR8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x];
break;
case splashModeXBGR8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
break;
#if SPLASH_CMYK
case splashModeCMYK8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
break;
case splashModeDeviceN8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (SPOT_NCOMPS + 4) * x];
break;
#endif
}
if (bitmap->alpha) {
pipe->destAlphaPtr = &bitmap->alpha[y * bitmap->width + x];
} else {
pipe->destAlphaPtr = NULL;
}
if (state->inNonIsolatedGroup && alpha0Bitmap->alpha) {
pipe->alpha0Ptr =
&alpha0Bitmap->alpha[(alpha0Y + y) * alpha0Bitmap->width +
(alpha0X + x)];
} else {
pipe->alpha0Ptr = NULL;
}
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,278
|
SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, int nComps,
GBool srcAlpha, int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight, GBool interpolate) {
SplashBitmap *dest;
dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, gTrue, bitmap->getSeparationList());
if (dest->getDataPtr() != NULL) {
if (scaledHeight < srcHeight) {
if (scaledWidth < srcWidth) {
scaleImageYdXd(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
scaleImageYdXu(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
}
} else {
if (scaledWidth < srcWidth) {
scaleImageYuXd(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
if (isImageInterpolationRequired(srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate)) {
scaleImageYuXuBilinear(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
scaleImageYuXu(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
}
}
}
} else {
delete dest;
dest = NULL;
}
return dest;
}
|
DoS
| 0
|
SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, int nComps,
GBool srcAlpha, int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight, GBool interpolate) {
SplashBitmap *dest;
dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, gTrue, bitmap->getSeparationList());
if (dest->getDataPtr() != NULL) {
if (scaledHeight < srcHeight) {
if (scaledWidth < srcWidth) {
scaleImageYdXd(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
scaleImageYdXu(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
}
} else {
if (scaledWidth < srcWidth) {
scaleImageYuXd(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
if (isImageInterpolationRequired(srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate)) {
scaleImageYuXuBilinear(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
scaleImageYuXu(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
}
}
}
} else {
delete dest;
dest = NULL;
}
return dest;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,279
|
SplashBitmap *Splash::scaleMask(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight) {
SplashBitmap *dest;
dest = new SplashBitmap(scaledWidth, scaledHeight, 1, splashModeMono8,
gFalse);
if (scaledHeight < srcHeight) {
if (scaledWidth < srcWidth) {
scaleMaskYdXd(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
} else {
scaleMaskYdXu(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
}
} else {
if (scaledWidth < srcWidth) {
scaleMaskYuXd(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
} else {
scaleMaskYuXu(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
}
}
return dest;
}
|
DoS
| 0
|
SplashBitmap *Splash::scaleMask(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight) {
SplashBitmap *dest;
dest = new SplashBitmap(scaledWidth, scaledHeight, 1, splashModeMono8,
gFalse);
if (scaledHeight < srcHeight) {
if (scaledWidth < srcWidth) {
scaleMaskYdXd(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
} else {
scaleMaskYdXu(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
}
} else {
if (scaledWidth < srcWidth) {
scaleMaskYuXd(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
} else {
scaleMaskYuXu(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight, dest);
}
}
return dest;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,280
|
void Splash::scaleMaskYdXd(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint *pixBuf;
Guint pix;
Guchar *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1;
int i, j;
yp = srcHeight / scaledHeight;
yq = srcHeight % scaledHeight;
xp = srcWidth / scaledWidth;
xq = srcWidth % scaledWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
pixBuf = (Guint *)gmallocn(srcWidth, sizeof(int));
yt = 0;
destPtr = dest->data;
for (y = 0; y < scaledHeight; ++y) {
if ((yt += yq) >= scaledHeight) {
yt -= scaledHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
memset(pixBuf, 0, srcWidth * sizeof(int));
for (i = 0; i < yStep; ++i) {
(*src)(srcData, lineBuf);
for (j = 0; j < srcWidth; ++j) {
pixBuf[j] += lineBuf[j];
}
}
xt = 0;
d0 = (255 << 23) / (yStep * xp);
d1 = (255 << 23) / (yStep * (xp + 1));
xx = 0;
for (x = 0; x < scaledWidth; ++x) {
if ((xt += xq) >= scaledWidth) {
xt -= scaledWidth;
xStep = xp + 1;
d = d1;
} else {
xStep = xp;
d = d0;
}
pix = 0;
for (i = 0; i < xStep; ++i) {
pix += pixBuf[xx++];
}
pix = (pix * d) >> 23;
*destPtr++ = (Guchar)pix;
}
}
gfree(pixBuf);
gfree(lineBuf);
}
|
DoS
| 0
|
void Splash::scaleMaskYdXd(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint *pixBuf;
Guint pix;
Guchar *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1;
int i, j;
yp = srcHeight / scaledHeight;
yq = srcHeight % scaledHeight;
xp = srcWidth / scaledWidth;
xq = srcWidth % scaledWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
pixBuf = (Guint *)gmallocn(srcWidth, sizeof(int));
yt = 0;
destPtr = dest->data;
for (y = 0; y < scaledHeight; ++y) {
if ((yt += yq) >= scaledHeight) {
yt -= scaledHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
memset(pixBuf, 0, srcWidth * sizeof(int));
for (i = 0; i < yStep; ++i) {
(*src)(srcData, lineBuf);
for (j = 0; j < srcWidth; ++j) {
pixBuf[j] += lineBuf[j];
}
}
xt = 0;
d0 = (255 << 23) / (yStep * xp);
d1 = (255 << 23) / (yStep * (xp + 1));
xx = 0;
for (x = 0; x < scaledWidth; ++x) {
if ((xt += xq) >= scaledWidth) {
xt -= scaledWidth;
xStep = xp + 1;
d = d1;
} else {
xStep = xp;
d = d0;
}
pix = 0;
for (i = 0; i < xStep; ++i) {
pix += pixBuf[xx++];
}
pix = (pix * d) >> 23;
*destPtr++ = (Guchar)pix;
}
}
gfree(pixBuf);
gfree(lineBuf);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,281
|
void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint pix;
Guchar *destPtr0, *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1;
int i;
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
xp = srcWidth / scaledWidth;
xq = srcWidth % scaledWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
yt = 0;
destPtr0 = dest->data;
for (y = 0; y < srcHeight; ++y) {
if ((yt += yq) >= srcHeight) {
yt -= srcHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
(*src)(srcData, lineBuf);
xt = 0;
d0 = (255 << 23) / xp;
d1 = (255 << 23) / (xp + 1);
xx = 0;
for (x = 0; x < scaledWidth; ++x) {
if ((xt += xq) >= scaledWidth) {
xt -= scaledWidth;
xStep = xp + 1;
d = d1;
} else {
xStep = xp;
d = d0;
}
pix = 0;
for (i = 0; i < xStep; ++i) {
pix += lineBuf[xx++];
}
pix = (pix * d) >> 23;
for (i = 0; i < yStep; ++i) {
destPtr = destPtr0 + i * scaledWidth + x;
*destPtr = (Guchar)pix;
}
}
destPtr0 += yStep * scaledWidth;
}
gfree(lineBuf);
}
|
DoS
| 0
|
void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint pix;
Guchar *destPtr0, *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1;
int i;
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
xp = srcWidth / scaledWidth;
xq = srcWidth % scaledWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
yt = 0;
destPtr0 = dest->data;
for (y = 0; y < srcHeight; ++y) {
if ((yt += yq) >= srcHeight) {
yt -= srcHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
(*src)(srcData, lineBuf);
xt = 0;
d0 = (255 << 23) / xp;
d1 = (255 << 23) / (xp + 1);
xx = 0;
for (x = 0; x < scaledWidth; ++x) {
if ((xt += xq) >= scaledWidth) {
xt -= scaledWidth;
xStep = xp + 1;
d = d1;
} else {
xStep = xp;
d = d0;
}
pix = 0;
for (i = 0; i < xStep; ++i) {
pix += lineBuf[xx++];
}
pix = (pix * d) >> 23;
for (i = 0; i < yStep; ++i) {
destPtr = destPtr0 + i * scaledWidth + x;
*destPtr = (Guchar)pix;
}
}
destPtr0 += yStep * scaledWidth;
}
gfree(lineBuf);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,282
|
void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint pix;
Guchar *destPtr0, *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx;
int i, j;
destPtr0 = dest->data;
if (destPtr0 == NULL) {
error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXu");
return;
}
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
xp = scaledWidth / srcWidth;
xq = scaledWidth % srcWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
yt = 0;
for (y = 0; y < srcHeight; ++y) {
if ((yt += yq) >= srcHeight) {
yt -= srcHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
(*src)(srcData, lineBuf);
xt = 0;
xx = 0;
for (x = 0; x < srcWidth; ++x) {
if ((xt += xq) >= srcWidth) {
xt -= srcWidth;
xStep = xp + 1;
} else {
xStep = xp;
}
pix = lineBuf[x] ? 255 : 0;
for (i = 0; i < yStep; ++i) {
for (j = 0; j < xStep; ++j) {
destPtr = destPtr0 + i * scaledWidth + xx + j;
*destPtr++ = (Guchar)pix;
}
}
xx += xStep;
}
destPtr0 += yStep * scaledWidth;
}
gfree(lineBuf);
}
|
DoS
| 0
|
void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint pix;
Guchar *destPtr0, *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx;
int i, j;
destPtr0 = dest->data;
if (destPtr0 == NULL) {
error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXu");
return;
}
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
xp = scaledWidth / srcWidth;
xq = scaledWidth % srcWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
yt = 0;
for (y = 0; y < srcHeight; ++y) {
if ((yt += yq) >= srcHeight) {
yt -= srcHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
(*src)(srcData, lineBuf);
xt = 0;
xx = 0;
for (x = 0; x < srcWidth; ++x) {
if ((xt += xq) >= srcWidth) {
xt -= srcWidth;
xStep = xp + 1;
} else {
xStep = xp;
}
pix = lineBuf[x] ? 255 : 0;
for (i = 0; i < yStep; ++i) {
for (j = 0; j < xStep; ++j) {
destPtr = destPtr0 + i * scaledWidth + xx + j;
*destPtr++ = (Guchar)pix;
}
}
xx += xStep;
}
destPtr0 += yStep * scaledWidth;
}
gfree(lineBuf);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,283
|
void Splash::setFillOverprint(GBool fop) {
state->fillOverprint = fop;
}
|
DoS
| 0
|
void Splash::setFillOverprint(GBool fop) {
state->fillOverprint = fop;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,284
|
void Splash::setOverprintMask(Guint overprintMask, GBool additive) {
state->overprintMask = overprintMask;
state->overprintAdditive = additive;
}
|
DoS
| 0
|
void Splash::setOverprintMask(Guint overprintMask, GBool additive) {
state->overprintMask = overprintMask;
state->overprintAdditive = additive;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,285
|
void Splash::setOverprintMode(int opm) {
state->overprintMode = opm;
}
|
DoS
| 0
|
void Splash::setOverprintMode(int opm) {
state->overprintMode = opm;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,286
|
void Splash::setStrokeOverprint(GBool gop) {
state->strokeOverprint = gop;
}
|
DoS
| 0
|
void Splash::setStrokeOverprint(GBool gop) {
state->strokeOverprint = gop;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,287
|
void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue,
Guchar *gray) {
state->setTransfer(red, green, blue, gray);
}
|
DoS
| 0
|
void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue,
Guchar *gray) {
state->setTransfer(red, green, blue, gray);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,288
|
SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox,
SplashPattern *pattern) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes;
if (vectorAntialias && aaBuf == NULL) { // should not happen, but to be secure
return splashErrGeneric;
}
if (path->length == 0) {
return splashErrEmptyPath;
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
if (vectorAntialias) {
xPath->aaScale();
}
xPath->sort();
yMinI = state->clip->getYMinI();
yMaxI = state->clip->getYMaxI();
if (vectorAntialias && !inShading) {
yMinI = yMinI * splashAASize;
yMaxI = (yMaxI + 1) * splashAASize - 1;
}
scanner = new SplashXPathScanner(xPath, gFalse, yMinI, yMaxI);
if (vectorAntialias) {
scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI);
} else {
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
}
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) != splashClipAllOutside) {
if (yMinI < state->clip->getYMinI()) {
yMinI = state->clip->getYMinI();
}
if (yMaxI > state->clip->getYMaxI()) {
yMaxI = state->clip->getYMaxI();
}
pipeInit(&pipe, 0, yMinI, pattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), vectorAntialias && !hasBBox, gFalse);
if (vectorAntialias) {
for (y = yMinI; y <= yMaxI; ++y) {
scanner->renderAALine(aaBuf, &x0, &x1, y);
if (clipRes != splashClipAllInside) {
state->clip->clipAALine(aaBuf, &x0, &x1, y);
}
#if splashAASize == 4
if (!hasBBox && y > yMinI && y < yMaxI) {
Guchar *p0, *p1, *p2, *p3;
Guchar c1, c2, c3, c4;
p0 = aaBuf->getDataPtr() + (x0 >> 1);
p1 = p0 + aaBuf->getRowSize();
p2 = p1 + aaBuf->getRowSize();
p3 = p2 + aaBuf->getRowSize();
if (x0 & 1) {
c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f);
} else {
c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4);
}
if ( (c1 & 0x03) == 0x03 && (c2 & 0x03) == 0x03 && (c3 & 0x03) == 0x03 && (c4 & 0x03) == 0x03
&& c1 == c2 && c2 == c3 && c3 == c4 &&
pattern->testPosition(x0 - 1, y) )
{
Guchar shapeCorrection = (x0 & 1) ? 0x0f : 0xf0;
*p0 |= shapeCorrection;
*p1 |= shapeCorrection;
*p2 |= shapeCorrection;
*p3 |= shapeCorrection;
}
p0 = aaBuf->getDataPtr() + (x1 >> 1);
p1 = p0 + aaBuf->getRowSize();
p2 = p1 + aaBuf->getRowSize();
p3 = p2 + aaBuf->getRowSize();
if (x1 & 1) {
c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f);
} else {
c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4);
}
if ( (c1 & 0xc) == 0x0c && (c2 & 0x0c) == 0x0c && (c3 & 0x0c) == 0x0c && (c4 & 0x0c) == 0x0c
&& c1 == c2 && c2 == c3 && c3 == c4 &&
pattern->testPosition(x1 + 1, y) )
{
Guchar shapeCorrection = (x1 & 1) ? 0x0f : 0xf0;
*p0 |= shapeCorrection;
*p1 |= shapeCorrection;
*p2 |= shapeCorrection;
*p3 |= shapeCorrection;
}
}
#endif
drawAALine(&pipe, x0, x1, y);
}
} else {
SplashClipResult clipRes2;
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
}
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
|
DoS
| 0
|
SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox,
SplashPattern *pattern) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes;
if (vectorAntialias && aaBuf == NULL) { // should not happen, but to be secure
return splashErrGeneric;
}
if (path->length == 0) {
return splashErrEmptyPath;
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
if (vectorAntialias) {
xPath->aaScale();
}
xPath->sort();
yMinI = state->clip->getYMinI();
yMaxI = state->clip->getYMaxI();
if (vectorAntialias && !inShading) {
yMinI = yMinI * splashAASize;
yMaxI = (yMaxI + 1) * splashAASize - 1;
}
scanner = new SplashXPathScanner(xPath, gFalse, yMinI, yMaxI);
if (vectorAntialias) {
scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI);
} else {
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
}
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) != splashClipAllOutside) {
if (yMinI < state->clip->getYMinI()) {
yMinI = state->clip->getYMinI();
}
if (yMaxI > state->clip->getYMaxI()) {
yMaxI = state->clip->getYMaxI();
}
pipeInit(&pipe, 0, yMinI, pattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), vectorAntialias && !hasBBox, gFalse);
if (vectorAntialias) {
for (y = yMinI; y <= yMaxI; ++y) {
scanner->renderAALine(aaBuf, &x0, &x1, y);
if (clipRes != splashClipAllInside) {
state->clip->clipAALine(aaBuf, &x0, &x1, y);
}
#if splashAASize == 4
if (!hasBBox && y > yMinI && y < yMaxI) {
Guchar *p0, *p1, *p2, *p3;
Guchar c1, c2, c3, c4;
p0 = aaBuf->getDataPtr() + (x0 >> 1);
p1 = p0 + aaBuf->getRowSize();
p2 = p1 + aaBuf->getRowSize();
p3 = p2 + aaBuf->getRowSize();
if (x0 & 1) {
c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f);
} else {
c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4);
}
if ( (c1 & 0x03) == 0x03 && (c2 & 0x03) == 0x03 && (c3 & 0x03) == 0x03 && (c4 & 0x03) == 0x03
&& c1 == c2 && c2 == c3 && c3 == c4 &&
pattern->testPosition(x0 - 1, y) )
{
Guchar shapeCorrection = (x0 & 1) ? 0x0f : 0xf0;
*p0 |= shapeCorrection;
*p1 |= shapeCorrection;
*p2 |= shapeCorrection;
*p3 |= shapeCorrection;
}
p0 = aaBuf->getDataPtr() + (x1 >> 1);
p1 = p0 + aaBuf->getRowSize();
p2 = p1 + aaBuf->getRowSize();
p3 = p2 + aaBuf->getRowSize();
if (x1 & 1) {
c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f);
} else {
c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4);
}
if ( (c1 & 0xc) == 0x0c && (c2 & 0x0c) == 0x0c && (c3 & 0x0c) == 0x0c && (c4 & 0x0c) == 0x0c
&& c1 == c2 && c2 == c3 && c3 == c4 &&
pattern->testPosition(x1 + 1, y) )
{
Guchar shapeCorrection = (x1 & 1) ? 0x0f : 0xf0;
*p0 |= shapeCorrection;
*p1 |= shapeCorrection;
*p2 |= shapeCorrection;
*p3 |= shapeCorrection;
}
}
#endif
drawAALine(&pipe, x0, x1, y);
}
} else {
SplashClipResult clipRes2;
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
}
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,289
|
void Splash::strokeNarrow(SplashPath *path) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathSeg *seg;
int x0, x1, y0, y1, xa, xb, y;
SplashCoord dxdy;
SplashClipResult clipRes;
int nClipRes[3];
int i;
nClipRes[0] = nClipRes[1] = nClipRes[2] = 0;
xPath = new SplashXPath(path, state->matrix, state->flatness, gFalse);
pipeInit(&pipe, 0, 0, state->strokePattern, NULL,
(Guchar)splashRound(state->strokeAlpha * 255),
gFalse, gFalse);
for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) {
if (seg->y0 <= seg->y1) {
y0 = splashFloor(seg->y0);
y1 = splashFloor(seg->y1);
x0 = splashFloor(seg->x0);
x1 = splashFloor(seg->x1);
} else {
y0 = splashFloor(seg->y1);
y1 = splashFloor(seg->y0);
x0 = splashFloor(seg->x1);
x1 = splashFloor(seg->x0);
}
if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0,
x0 <= x1 ? x1 : x0, y1))
!= splashClipAllOutside) {
if (y0 == y1) {
if (x0 <= x1) {
drawSpan(&pipe, x0, x1, y0, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, x1, x0, y0, clipRes == splashClipAllInside);
}
} else {
dxdy = seg->dxdy;
if (y0 < state->clip->getYMinI()) {
y0 = state->clip->getYMinI();
x0 = splashFloor(seg->x0 + ((SplashCoord)y0 - seg->y0) * dxdy);
}
if (y1 > state->clip->getYMaxI()) {
y1 = state->clip->getYMaxI();
x1 = splashFloor(seg->x0 + ((SplashCoord)y1 - seg->y0) * dxdy);
}
if (x0 <= x1) {
xa = x0;
for (y = y0; y <= y1; ++y) {
if (y < y1) {
xb = splashFloor(seg->x0 +
((SplashCoord)y + 1 - seg->y0) * dxdy);
} else {
xb = x1 + 1;
}
if (xa == xb) {
drawPixel(&pipe, xa, y, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, xa, xb - 1, y, clipRes == splashClipAllInside);
}
xa = xb;
}
} else {
xa = x0;
for (y = y0; y <= y1; ++y) {
if (y < y1) {
xb = splashFloor(seg->x0 +
((SplashCoord)y + 1 - seg->y0) * dxdy);
} else {
xb = x1 - 1;
}
if (xa == xb) {
drawPixel(&pipe, xa, y, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, xb + 1, xa, y, clipRes == splashClipAllInside);
}
xa = xb;
}
}
}
}
++nClipRes[clipRes];
}
if (nClipRes[splashClipPartial] ||
(nClipRes[splashClipAllInside] && nClipRes[splashClipAllOutside])) {
opClipRes = splashClipPartial;
} else if (nClipRes[splashClipAllInside]) {
opClipRes = splashClipAllInside;
} else {
opClipRes = splashClipAllOutside;
}
delete xPath;
}
|
DoS
| 0
|
void Splash::strokeNarrow(SplashPath *path) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathSeg *seg;
int x0, x1, y0, y1, xa, xb, y;
SplashCoord dxdy;
SplashClipResult clipRes;
int nClipRes[3];
int i;
nClipRes[0] = nClipRes[1] = nClipRes[2] = 0;
xPath = new SplashXPath(path, state->matrix, state->flatness, gFalse);
pipeInit(&pipe, 0, 0, state->strokePattern, NULL,
(Guchar)splashRound(state->strokeAlpha * 255),
gFalse, gFalse);
for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) {
if (seg->y0 <= seg->y1) {
y0 = splashFloor(seg->y0);
y1 = splashFloor(seg->y1);
x0 = splashFloor(seg->x0);
x1 = splashFloor(seg->x1);
} else {
y0 = splashFloor(seg->y1);
y1 = splashFloor(seg->y0);
x0 = splashFloor(seg->x1);
x1 = splashFloor(seg->x0);
}
if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0,
x0 <= x1 ? x1 : x0, y1))
!= splashClipAllOutside) {
if (y0 == y1) {
if (x0 <= x1) {
drawSpan(&pipe, x0, x1, y0, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, x1, x0, y0, clipRes == splashClipAllInside);
}
} else {
dxdy = seg->dxdy;
if (y0 < state->clip->getYMinI()) {
y0 = state->clip->getYMinI();
x0 = splashFloor(seg->x0 + ((SplashCoord)y0 - seg->y0) * dxdy);
}
if (y1 > state->clip->getYMaxI()) {
y1 = state->clip->getYMaxI();
x1 = splashFloor(seg->x0 + ((SplashCoord)y1 - seg->y0) * dxdy);
}
if (x0 <= x1) {
xa = x0;
for (y = y0; y <= y1; ++y) {
if (y < y1) {
xb = splashFloor(seg->x0 +
((SplashCoord)y + 1 - seg->y0) * dxdy);
} else {
xb = x1 + 1;
}
if (xa == xb) {
drawPixel(&pipe, xa, y, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, xa, xb - 1, y, clipRes == splashClipAllInside);
}
xa = xb;
}
} else {
xa = x0;
for (y = y0; y <= y1; ++y) {
if (y < y1) {
xb = splashFloor(seg->x0 +
((SplashCoord)y + 1 - seg->y0) * dxdy);
} else {
xb = x1 - 1;
}
if (xa == xb) {
drawPixel(&pipe, xa, y, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, xb + 1, xa, y, clipRes == splashClipAllInside);
}
xa = xb;
}
}
}
}
++nClipRes[clipRes];
}
if (nClipRes[splashClipPartial] ||
(nClipRes[splashClipAllInside] && nClipRes[splashClipAllOutside])) {
opClipRes = splashClipPartial;
} else if (nClipRes[splashClipAllInside]) {
opClipRes = splashClipAllInside;
} else {
opClipRes = splashClipAllOutside;
}
delete xPath;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,290
|
void Splash::vertFlipImage(SplashBitmap *img, int width, int height,
int nComps) {
Guchar *lineBuf;
Guchar *p0, *p1;
int w;
w = width * nComps;
lineBuf = (Guchar *)gmalloc(w);
for (p0 = img->data, p1 = img->data + (height - 1) * w;
p0 < p1;
p0 += w, p1 -= w) {
memcpy(lineBuf, p0, w);
memcpy(p0, p1, w);
memcpy(p1, lineBuf, w);
}
if (img->alpha) {
for (p0 = img->alpha, p1 = img->alpha + (height - 1) * width;
p0 < p1;
p0 += width, p1 -= width) {
memcpy(lineBuf, p0, width);
memcpy(p0, p1, width);
memcpy(p1, lineBuf, width);
}
}
gfree(lineBuf);
}
|
DoS
| 0
|
void Splash::vertFlipImage(SplashBitmap *img, int width, int height,
int nComps) {
Guchar *lineBuf;
Guchar *p0, *p1;
int w;
w = width * nComps;
lineBuf = (Guchar *)gmalloc(w);
for (p0 = img->data, p1 = img->data + (height - 1) * w;
p0 < p1;
p0 += w, p1 -= w) {
memcpy(lineBuf, p0, w);
memcpy(p0, p1, w);
memcpy(p1, lineBuf, w);
}
if (img->alpha) {
for (p0 = img->alpha, p1 = img->alpha + (height - 1) * width;
p0 < p1;
p0 += width, p1 -= width) {
memcpy(lineBuf, p0, width);
memcpy(p0, p1, width);
memcpy(p1, lineBuf, width);
}
}
gfree(lineBuf);
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,291
|
SplashError Splash::xorFill(SplashPath *path, GBool eo) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes, clipRes2;
SplashBlendFunc origBlendFunc;
if (path->length == 0) {
return splashErrEmptyPath;
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
xPath->sort();
scanner = new SplashXPathScanner(xPath, eo, state->clip->getYMinI(),
state->clip->getYMaxI());
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI))
!= splashClipAllOutside) {
if (scanner->hasPartialClip()) {
clipRes = splashClipPartial;
}
origBlendFunc = state->blendFunc;
state->blendFunc = &blendXor;
pipeInit(&pipe, 0, yMinI, state->fillPattern, NULL, 255, gFalse, gFalse);
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
state->blendFunc = origBlendFunc;
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
|
DoS
| 0
|
SplashError Splash::xorFill(SplashPath *path, GBool eo) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes, clipRes2;
SplashBlendFunc origBlendFunc;
if (path->length == 0) {
return splashErrEmptyPath;
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
xPath->sort();
scanner = new SplashXPathScanner(xPath, eo, state->clip->getYMinI(),
state->clip->getYMaxI());
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI))
!= splashClipAllOutside) {
if (scanner->hasPartialClip()) {
clipRes = splashClipPartial;
}
origBlendFunc = state->blendFunc;
state->blendFunc = &blendXor;
pipeInit(&pipe, 0, yMinI, state->fillPattern, NULL, 255, gFalse, gFalse);
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
state->blendFunc = origBlendFunc;
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
|
@@ -2955,7 +2955,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
- error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
@@ -3461,11 +3461,15 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
w = src->getWidth();
h = src->getHeight();
+ p = src->getDataPtr();
+ if (p == NULL) {
+ error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
+ return;
+ }
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
- p = src->getDataPtr();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
@@ -3475,7 +3479,6 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
- p = src->getDataPtr();
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
| null | null | null |
3,292
|
static inline int imgCoordMungeUpper(SplashCoord x) {
return splashCeil(x + 0.5) - 1;
}
|
DoS
| 0
|
static inline int imgCoordMungeUpper(SplashCoord x) {
return splashCeil(x + 0.5) - 1;
}
|
@@ -2954,6 +2954,11 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
// scale the input image
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
+ if (scaledMask->data == NULL) {
+ error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu");
+ delete scaledMask;
+ return;
+ }
// construct the three sections
i = (vy[2] <= vy[3]) ? 2 : 3;
@@ -3381,6 +3386,12 @@ void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData,
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx;
int i, j;
+ destPtr0 = dest->data;
+ if (destPtr0 == NULL) {
+ error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXu");
+ return;
+ }
+
// Bresenham parameters for y scale
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
@@ -3395,7 +3406,6 @@ void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData,
// init y scale Bresenham
yt = 0;
- destPtr0 = dest->data;
for (y = 0; y < srcHeight; ++y) {
// y scale Bresenham
| null | null | null |
3,293
|
ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) {
Object obj1, obj2;
int i;
ok = gFalse;
if (!init(dict)) {
goto err1;
}
if (m != 1) {
error(errSyntaxError, -1, "Exponential function with more than one input");
goto err1;
}
if (dict->lookup("C0", &obj1)->isArray()) {
if (hasRange && obj1.arrayGetLength() != n) {
error(errSyntaxError, -1, "Function's C0 array is wrong length");
goto err2;
}
n = obj1.arrayGetLength();
for (i = 0; i < n; ++i) {
obj1.arrayGet(i, &obj2);
if (!obj2.isNum()) {
error(errSyntaxError, -1, "Illegal value in function C0 array");
goto err3;
}
c0[i] = obj2.getNum();
obj2.free();
}
} else {
if (hasRange && n != 1) {
error(errSyntaxError, -1, "Function's C0 array is wrong length");
goto err2;
}
n = 1;
c0[0] = 0;
}
obj1.free();
if (dict->lookup("C1", &obj1)->isArray()) {
if (obj1.arrayGetLength() != n) {
error(errSyntaxError, -1, "Function's C1 array is wrong length");
goto err2;
}
for (i = 0; i < n; ++i) {
obj1.arrayGet(i, &obj2);
if (!obj2.isNum()) {
error(errSyntaxError, -1, "Illegal value in function C1 array");
goto err3;
}
c1[i] = obj2.getNum();
obj2.free();
}
} else {
if (n != 1) {
error(errSyntaxError, -1, "Function's C1 array is wrong length");
goto err2;
}
c1[0] = 1;
}
obj1.free();
if (!dict->lookup("N", &obj1)->isNum()) {
error(errSyntaxError, -1, "Function has missing or invalid N");
goto err2;
}
e = obj1.getNum();
obj1.free();
isLinear = fabs(e-1.) < 1e-10;
ok = gTrue;
return;
err3:
obj2.free();
err2:
obj1.free();
err1:
return;
}
|
DoS Exec Code Overflow
| 0
|
ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) {
Object obj1, obj2;
int i;
ok = gFalse;
if (!init(dict)) {
goto err1;
}
if (m != 1) {
error(errSyntaxError, -1, "Exponential function with more than one input");
goto err1;
}
if (dict->lookup("C0", &obj1)->isArray()) {
if (hasRange && obj1.arrayGetLength() != n) {
error(errSyntaxError, -1, "Function's C0 array is wrong length");
goto err2;
}
n = obj1.arrayGetLength();
for (i = 0; i < n; ++i) {
obj1.arrayGet(i, &obj2);
if (!obj2.isNum()) {
error(errSyntaxError, -1, "Illegal value in function C0 array");
goto err3;
}
c0[i] = obj2.getNum();
obj2.free();
}
} else {
if (hasRange && n != 1) {
error(errSyntaxError, -1, "Function's C0 array is wrong length");
goto err2;
}
n = 1;
c0[0] = 0;
}
obj1.free();
if (dict->lookup("C1", &obj1)->isArray()) {
if (obj1.arrayGetLength() != n) {
error(errSyntaxError, -1, "Function's C1 array is wrong length");
goto err2;
}
for (i = 0; i < n; ++i) {
obj1.arrayGet(i, &obj2);
if (!obj2.isNum()) {
error(errSyntaxError, -1, "Illegal value in function C1 array");
goto err3;
}
c1[i] = obj2.getNum();
obj2.free();
}
} else {
if (n != 1) {
error(errSyntaxError, -1, "Function's C1 array is wrong length");
goto err2;
}
c1[0] = 1;
}
obj1.free();
if (!dict->lookup("N", &obj1)->isNum()) {
error(errSyntaxError, -1, "Function has missing or invalid N");
goto err2;
}
e = obj1.getNum();
obj1.free();
isLinear = fabs(e-1.) < 1e-10;
ok = gTrue;
return;
err3:
obj2.free();
err2:
obj1.free();
err1:
return;
}
|
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2006, 2008-2010 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006, 2008-2010, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010 Christian Feuers�nger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
@@ -1111,6 +1111,10 @@ void PSStack::copy(int n) {
error(errSyntaxError, -1, "Stack underflow in PostScript function");
return;
}
+ if (unlikely(sp - n > psStackSize)) {
+ error(errSyntaxError, -1, "Stack underflow in PostScript function");
+ return;
+ }
if (!checkOverflow(n)) {
return;
}
|
CWE-119
| null | null |
3,294
|
Function::Function() {
}
|
DoS Exec Code Overflow
| 0
|
Function::Function() {
}
|
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2006, 2008-2010 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006, 2008-2010, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010 Christian Feuers�nger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
@@ -1111,6 +1111,10 @@ void PSStack::copy(int n) {
error(errSyntaxError, -1, "Stack underflow in PostScript function");
return;
}
+ if (unlikely(sp - n > psStackSize)) {
+ error(errSyntaxError, -1, "Stack underflow in PostScript function");
+ return;
+ }
if (!checkOverflow(n)) {
return;
}
|
CWE-119
| null | null |
3,295
|
Function::Function(const Function *func) {
m = func->m;
n = func->n;
memcpy(domain, func->domain, funcMaxInputs * 2 * sizeof(double));
memcpy(range, func->range, funcMaxOutputs * 2 * sizeof(double));
hasRange = func->hasRange;
}
|
DoS Exec Code Overflow
| 0
|
Function::Function(const Function *func) {
m = func->m;
n = func->n;
memcpy(domain, func->domain, funcMaxInputs * 2 * sizeof(double));
memcpy(range, func->range, funcMaxOutputs * 2 * sizeof(double));
hasRange = func->hasRange;
}
|
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2006, 2008-2010 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006, 2008-2010, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010 Christian Feuers�nger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
@@ -1111,6 +1111,10 @@ void PSStack::copy(int n) {
error(errSyntaxError, -1, "Stack underflow in PostScript function");
return;
}
+ if (unlikely(sp - n > psStackSize)) {
+ error(errSyntaxError, -1, "Stack underflow in PostScript function");
+ return;
+ }
if (!checkOverflow(n)) {
return;
}
|
CWE-119
| null | null |
3,296
|
IdentityFunction::IdentityFunction() {
int i;
m = funcMaxInputs;
n = funcMaxOutputs;
for (i = 0; i < funcMaxInputs; ++i) {
domain[i][0] = 0;
domain[i][1] = 1;
}
hasRange = gFalse;
}
|
DoS Exec Code Overflow
| 0
|
IdentityFunction::IdentityFunction() {
int i;
m = funcMaxInputs;
n = funcMaxOutputs;
for (i = 0; i < funcMaxInputs; ++i) {
domain[i][0] = 0;
domain[i][1] = 1;
}
hasRange = gFalse;
}
|
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2006, 2008-2010 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006, 2008-2010, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010 Christian Feuers�nger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
@@ -1111,6 +1111,10 @@ void PSStack::copy(int n) {
error(errSyntaxError, -1, "Stack underflow in PostScript function");
return;
}
+ if (unlikely(sp - n > psStackSize)) {
+ error(errSyntaxError, -1, "Stack underflow in PostScript function");
+ return;
+ }
if (!checkOverflow(n)) {
return;
}
|
CWE-119
| null | null |
3,297
|
PSStack() {sp = psStackSize; }
|
DoS Exec Code Overflow
| 0
|
PSStack() {sp = psStackSize; }
|
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2006, 2008-2010 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006, 2008-2010, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010 Christian Feuers�nger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
@@ -1111,6 +1111,10 @@ void PSStack::copy(int n) {
error(errSyntaxError, -1, "Stack underflow in PostScript function");
return;
}
+ if (unlikely(sp - n > psStackSize)) {
+ error(errSyntaxError, -1, "Stack underflow in PostScript function");
+ return;
+ }
if (!checkOverflow(n)) {
return;
}
|
CWE-119
| null | null |
3,298
|
int CCITTFaxStream::lookChar() {
int code1, code2, code3;
int b1i, blackPixels, i, bits;
GBool gotEOL;
if (buf != EOF) {
return buf;
}
if (outputBits == 0) {
if (eof) {
return EOF;
}
err = gFalse;
if (nextLine2D) {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
for (; i < columns + 2; ++i) {
refLine[i] = columns;
}
codingLine[0] = 0;
a0i = 0;
b1i = 0;
blackPixels = 0;
while (codingLine[a0i] < columns && !err) {
code1 = getTwoDimCode();
switch (code1) {
case twoDimPass:
if (likely(b1i + 1 < columns + 2)) {
addPixels(refLine[b1i + 1], blackPixels);
if (refLine[b1i + 1] < columns) {
b1i += 2;
}
}
break;
case twoDimHoriz:
code1 = code2 = 0;
if (blackPixels) {
do {
code1 += code3 = getBlackCode();
} while (code3 >= 64);
do {
code2 += code3 = getWhiteCode();
} while (code3 >= 64);
} else {
do {
code1 += code3 = getWhiteCode();
} while (code3 >= 64);
do {
code2 += code3 = getBlackCode();
} while (code3 >= 64);
}
addPixels(codingLine[a0i] + code1, blackPixels);
if (codingLine[a0i] < columns) {
addPixels(codingLine[a0i] + code2, blackPixels ^ 1);
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
break;
case twoDimVertR3:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i] + 3, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertR2:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i] + 2, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertR1:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i] + 1, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVert0:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i], blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertL3:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixelsNeg(refLine[b1i] - 3, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
if (b1i > 0) {
--b1i;
} else {
++b1i;
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertL2:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixelsNeg(refLine[b1i] - 2, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
if (b1i > 0) {
--b1i;
} else {
++b1i;
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertL1:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixelsNeg(refLine[b1i] - 1, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
if (b1i > 0) {
--b1i;
} else {
++b1i;
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case EOF:
addPixels(columns, 0);
eof = gTrue;
break;
default:
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
addPixels(columns, 0);
err = gTrue;
break;
}
}
} else {
codingLine[0] = 0;
a0i = 0;
blackPixels = 0;
while (codingLine[a0i] < columns) {
code1 = 0;
if (blackPixels) {
do {
code1 += code3 = getBlackCode();
} while (code3 >= 64);
} else {
do {
code1 += code3 = getWhiteCode();
} while (code3 >= 64);
}
addPixels(codingLine[a0i] + code1, blackPixels);
blackPixels ^= 1;
}
}
gotEOL = gFalse;
if (!endOfBlock && row == rows - 1) {
eof = gTrue;
} else if (endOfLine || !byteAlign) {
code1 = lookBits(12);
if (endOfLine) {
while (code1 != EOF && code1 != 0x001) {
eatBits(1);
code1 = lookBits(12);
}
} else {
while (code1 == 0) {
eatBits(1);
code1 = lookBits(12);
}
}
if (code1 == 0x001) {
eatBits(12);
gotEOL = gTrue;
}
}
if (byteAlign && !gotEOL) {
inputBits &= ~7;
}
if (lookBits(1) == EOF) {
eof = gTrue;
}
if (!eof && encoding > 0) {
nextLine2D = !lookBits(1);
eatBits(1);
}
if (endOfBlock && !endOfLine && byteAlign) {
code1 = lookBits(24);
if (code1 == 0x001001) {
eatBits(12);
gotEOL = gTrue;
}
}
if (endOfBlock && gotEOL) {
code1 = lookBits(12);
if (code1 == 0x001) {
eatBits(12);
if (encoding > 0) {
lookBits(1);
eatBits(1);
}
if (encoding >= 0) {
for (i = 0; i < 4; ++i) {
code1 = lookBits(12);
if (code1 != 0x001) {
error(errSyntaxError, getPos(),
"Bad RTC code in CCITTFax stream");
}
eatBits(12);
if (encoding > 0) {
lookBits(1);
eatBits(1);
}
}
}
eof = gTrue;
}
} else if (err && endOfLine) {
while (1) {
code1 = lookBits(13);
if (code1 == EOF) {
eof = gTrue;
return EOF;
}
if ((code1 >> 1) == 0x001) {
break;
}
eatBits(1);
}
eatBits(12);
if (encoding > 0) {
eatBits(1);
nextLine2D = !(code1 & 1);
}
}
if (codingLine[0] > 0) {
outputBits = codingLine[a0i = 0];
} else {
outputBits = codingLine[a0i = 1];
}
++row;
}
if (outputBits >= 8) {
buf = (a0i & 1) ? 0x00 : 0xff;
outputBits -= 8;
if (outputBits == 0 && codingLine[a0i] < columns) {
++a0i;
outputBits = codingLine[a0i] - codingLine[a0i - 1];
}
} else {
bits = 8;
buf = 0;
do {
if (outputBits > bits) {
buf <<= bits;
if (!(a0i & 1)) {
buf |= 0xff >> (8 - bits);
}
outputBits -= bits;
bits = 0;
} else {
buf <<= outputBits;
if (!(a0i & 1)) {
buf |= 0xff >> (8 - outputBits);
}
bits -= outputBits;
outputBits = 0;
if (codingLine[a0i] < columns) {
++a0i;
if (unlikely(a0i > columns)) {
error(errSyntaxError, getPos(),
"Bad bits {0:04x} in CCITTFax stream", bits);
err = gTrue;
break;
}
outputBits = codingLine[a0i] - codingLine[a0i - 1];
} else if (bits > 0) {
buf <<= bits;
bits = 0;
}
}
} while (bits);
}
if (black) {
buf ^= 0xff;
}
return buf;
}
|
DoS Exec Code Overflow
| 0
|
int CCITTFaxStream::lookChar() {
int code1, code2, code3;
int b1i, blackPixels, i, bits;
GBool gotEOL;
if (buf != EOF) {
return buf;
}
if (outputBits == 0) {
if (eof) {
return EOF;
}
err = gFalse;
if (nextLine2D) {
for (i = 0; i < columns && codingLine[i] < columns; ++i) {
refLine[i] = codingLine[i];
}
for (; i < columns + 2; ++i) {
refLine[i] = columns;
}
codingLine[0] = 0;
a0i = 0;
b1i = 0;
blackPixels = 0;
while (codingLine[a0i] < columns && !err) {
code1 = getTwoDimCode();
switch (code1) {
case twoDimPass:
if (likely(b1i + 1 < columns + 2)) {
addPixels(refLine[b1i + 1], blackPixels);
if (refLine[b1i + 1] < columns) {
b1i += 2;
}
}
break;
case twoDimHoriz:
code1 = code2 = 0;
if (blackPixels) {
do {
code1 += code3 = getBlackCode();
} while (code3 >= 64);
do {
code2 += code3 = getWhiteCode();
} while (code3 >= 64);
} else {
do {
code1 += code3 = getWhiteCode();
} while (code3 >= 64);
do {
code2 += code3 = getBlackCode();
} while (code3 >= 64);
}
addPixels(codingLine[a0i] + code1, blackPixels);
if (codingLine[a0i] < columns) {
addPixels(codingLine[a0i] + code2, blackPixels ^ 1);
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
break;
case twoDimVertR3:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i] + 3, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertR2:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i] + 2, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertR1:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i] + 1, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVert0:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixels(refLine[b1i], blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
++b1i;
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertL3:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixelsNeg(refLine[b1i] - 3, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
if (b1i > 0) {
--b1i;
} else {
++b1i;
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertL2:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixelsNeg(refLine[b1i] - 2, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
if (b1i > 0) {
--b1i;
} else {
++b1i;
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case twoDimVertL1:
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
addPixelsNeg(refLine[b1i] - 1, blackPixels);
blackPixels ^= 1;
if (codingLine[a0i] < columns) {
if (b1i > 0) {
--b1i;
} else {
++b1i;
}
while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
b1i += 2;
if (unlikely(b1i > columns + 1)) {
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
err = gTrue;
break;
}
}
}
break;
case EOF:
addPixels(columns, 0);
eof = gTrue;
break;
default:
error(errSyntaxError, getPos(),
"Bad 2D code {0:04x} in CCITTFax stream", code1);
addPixels(columns, 0);
err = gTrue;
break;
}
}
} else {
codingLine[0] = 0;
a0i = 0;
blackPixels = 0;
while (codingLine[a0i] < columns) {
code1 = 0;
if (blackPixels) {
do {
code1 += code3 = getBlackCode();
} while (code3 >= 64);
} else {
do {
code1 += code3 = getWhiteCode();
} while (code3 >= 64);
}
addPixels(codingLine[a0i] + code1, blackPixels);
blackPixels ^= 1;
}
}
gotEOL = gFalse;
if (!endOfBlock && row == rows - 1) {
eof = gTrue;
} else if (endOfLine || !byteAlign) {
code1 = lookBits(12);
if (endOfLine) {
while (code1 != EOF && code1 != 0x001) {
eatBits(1);
code1 = lookBits(12);
}
} else {
while (code1 == 0) {
eatBits(1);
code1 = lookBits(12);
}
}
if (code1 == 0x001) {
eatBits(12);
gotEOL = gTrue;
}
}
if (byteAlign && !gotEOL) {
inputBits &= ~7;
}
if (lookBits(1) == EOF) {
eof = gTrue;
}
if (!eof && encoding > 0) {
nextLine2D = !lookBits(1);
eatBits(1);
}
if (endOfBlock && !endOfLine && byteAlign) {
code1 = lookBits(24);
if (code1 == 0x001001) {
eatBits(12);
gotEOL = gTrue;
}
}
if (endOfBlock && gotEOL) {
code1 = lookBits(12);
if (code1 == 0x001) {
eatBits(12);
if (encoding > 0) {
lookBits(1);
eatBits(1);
}
if (encoding >= 0) {
for (i = 0; i < 4; ++i) {
code1 = lookBits(12);
if (code1 != 0x001) {
error(errSyntaxError, getPos(),
"Bad RTC code in CCITTFax stream");
}
eatBits(12);
if (encoding > 0) {
lookBits(1);
eatBits(1);
}
}
}
eof = gTrue;
}
} else if (err && endOfLine) {
while (1) {
code1 = lookBits(13);
if (code1 == EOF) {
eof = gTrue;
return EOF;
}
if ((code1 >> 1) == 0x001) {
break;
}
eatBits(1);
}
eatBits(12);
if (encoding > 0) {
eatBits(1);
nextLine2D = !(code1 & 1);
}
}
if (codingLine[0] > 0) {
outputBits = codingLine[a0i = 0];
} else {
outputBits = codingLine[a0i = 1];
}
++row;
}
if (outputBits >= 8) {
buf = (a0i & 1) ? 0x00 : 0xff;
outputBits -= 8;
if (outputBits == 0 && codingLine[a0i] < columns) {
++a0i;
outputBits = codingLine[a0i] - codingLine[a0i - 1];
}
} else {
bits = 8;
buf = 0;
do {
if (outputBits > bits) {
buf <<= bits;
if (!(a0i & 1)) {
buf |= 0xff >> (8 - bits);
}
outputBits -= bits;
bits = 0;
} else {
buf <<= outputBits;
if (!(a0i & 1)) {
buf |= 0xff >> (8 - outputBits);
}
bits -= outputBits;
outputBits = 0;
if (codingLine[a0i] < columns) {
++a0i;
if (unlikely(a0i > columns)) {
error(errSyntaxError, getPos(),
"Bad bits {0:04x} in CCITTFax stream", bits);
err = gTrue;
break;
}
outputBits = codingLine[a0i] - codingLine[a0i - 1];
} else if (bits > 0) {
buf <<= bits;
bits = 0;
}
}
} while (bits);
}
if (black) {
buf ^= 0xff;
}
return buf;
}
|
@@ -2387,7 +2387,8 @@ GBool CCITTFaxStream::isBinary(GBool last) {
// clip [-256,511] --> [0,255]
#define dctClipOffset 256
-static Guchar dctClip[768];
+#define dctClipLength 768
+static Guchar dctClip[dctClipLength];
static int dctClipInit = 0;
// zig zag decode map
@@ -3343,7 +3344,12 @@ void DCTStream::transformDataUnit(Gushort *quantTable,
// convert to 8-bit integers
for (i = 0; i < 64; ++i) {
- dataOut[i] = dctClip[dctClipOffset + 128 + ((dataIn[i] + 8) >> 4)];
+ const int ix = dctClipOffset + 128 + ((dataIn[i] + 8) >> 4);
+ if (unlikely(ix < 0 || ix >= dctClipLength)) {
+ dataOut[i] = 0;
+ } else {
+ dataOut[i] = dctClip[ix];
+ }
}
}
|
CWE-119
| null | null |
3,299
|
void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
SplashCoord *mat, GBool glyphMode) {
SplashBitmap *scaledMask;
SplashClipResult clipRes, clipRes2;
SplashPipe pipe;
int scaledWidth, scaledHeight, t0, t1;
SplashCoord r00, r01, r10, r11, det, ir00, ir01, ir10, ir11;
SplashCoord vx[4], vy[4];
int xMin, yMin, xMax, yMax;
ImageSection section[3];
int nSections;
int y, xa, xb, x, i, xx, yy;
vx[0] = mat[4]; vy[0] = mat[5];
vx[1] = mat[2] + mat[4]; vy[1] = mat[3] + mat[5];
vx[2] = mat[0] + mat[2] + mat[4]; vy[2] = mat[1] + mat[3] + mat[5];
vx[3] = mat[0] + mat[4]; vy[3] = mat[1] + mat[5];
xMin = imgCoordMungeLowerC(vx[0], glyphMode);
xMax = imgCoordMungeUpperC(vx[0], glyphMode);
yMin = imgCoordMungeLowerC(vy[0], glyphMode);
yMax = imgCoordMungeUpperC(vy[0], glyphMode);
for (i = 1; i < 4; ++i) {
t0 = imgCoordMungeLowerC(vx[i], glyphMode);
if (t0 < xMin) {
xMin = t0;
}
t0 = imgCoordMungeUpperC(vx[i], glyphMode);
if (t0 > xMax) {
xMax = t0;
}
t1 = imgCoordMungeLowerC(vy[i], glyphMode);
if (t1 < yMin) {
yMin = t1;
}
t1 = imgCoordMungeUpperC(vy[i], glyphMode);
if (t1 > yMax) {
yMax = t1;
}
}
clipRes = state->clip->testRect(xMin, yMin, xMax - 1, yMax - 1);
opClipRes = clipRes;
if (clipRes == splashClipAllOutside) {
return;
}
if (mat[0] >= 0) {
t0 = imgCoordMungeUpperC(mat[0] + mat[4], glyphMode) -
imgCoordMungeLowerC(mat[4], glyphMode);
} else {
t0 = imgCoordMungeUpperC(mat[4], glyphMode) -
imgCoordMungeLowerC(mat[0] + mat[4], glyphMode);
}
if (mat[1] >= 0) {
t1 = imgCoordMungeUpperC(mat[1] + mat[5], glyphMode) -
imgCoordMungeLowerC(mat[5], glyphMode);
} else {
t1 = imgCoordMungeUpperC(mat[5], glyphMode) -
imgCoordMungeLowerC(mat[1] + mat[5], glyphMode);
}
scaledWidth = t0 > t1 ? t0 : t1;
if (mat[2] >= 0) {
t0 = imgCoordMungeUpperC(mat[2] + mat[4], glyphMode) -
imgCoordMungeLowerC(mat[4], glyphMode);
} else {
t0 = imgCoordMungeUpperC(mat[4], glyphMode) -
imgCoordMungeLowerC(mat[2] + mat[4], glyphMode);
}
if (mat[3] >= 0) {
t1 = imgCoordMungeUpperC(mat[3] + mat[5], glyphMode) -
imgCoordMungeLowerC(mat[5], glyphMode);
} else {
t1 = imgCoordMungeUpperC(mat[5], glyphMode) -
imgCoordMungeLowerC(mat[3] + mat[5], glyphMode);
}
scaledHeight = t0 > t1 ? t0 : t1;
if (scaledWidth == 0) {
scaledWidth = 1;
}
if (scaledHeight == 0) {
scaledHeight = 1;
}
r00 = mat[0] / scaledWidth;
r01 = mat[1] / scaledWidth;
r10 = mat[2] / scaledHeight;
r11 = mat[3] / scaledHeight;
det = r00 * r11 - r01 * r10;
if (splashAbs(det) < 1e-6) {
return;
}
ir00 = r11 / det;
ir01 = -r01 / det;
ir10 = -r10 / det;
ir11 = r00 / det;
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
i = (vy[2] <= vy[3]) ? 2 : 3;
if (vy[1] <= vy[i]) {
i = 1;
}
if (vy[0] < vy[i] || (i != 3 && vy[0] == vy[i])) {
i = 0;
}
if (vy[i] == vy[(i+1) & 3]) {
section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode);
section[0].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1;
if (vx[i] < vx[(i+1) & 3]) {
section[0].ia0 = i;
section[0].ia1 = (i+3) & 3;
section[0].ib0 = (i+1) & 3;
section[0].ib1 = (i+2) & 3;
} else {
section[0].ia0 = (i+1) & 3;
section[0].ia1 = (i+2) & 3;
section[0].ib0 = i;
section[0].ib1 = (i+3) & 3;
}
nSections = 1;
} else {
section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode);
section[2].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1;
section[0].ia0 = section[0].ib0 = i;
section[2].ia1 = section[2].ib1 = (i+2) & 3;
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[0].ia1 = section[2].ia0 = (i+1) & 3;
section[0].ib1 = section[2].ib0 = (i+3) & 3;
} else {
section[0].ia1 = section[2].ia0 = (i+3) & 3;
section[0].ib1 = section[2].ib0 = (i+1) & 3;
}
if (vy[(i+1) & 3] < vy[(i+3) & 3]) {
section[1].y0 = imgCoordMungeLowerC(vy[(i+1) & 3], glyphMode);
section[2].y0 = imgCoordMungeUpperC(vy[(i+3) & 3], glyphMode);
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[1].ia0 = (i+1) & 3;
section[1].ia1 = (i+2) & 3;
section[1].ib0 = i;
section[1].ib1 = (i+3) & 3;
} else {
section[1].ia0 = i;
section[1].ia1 = (i+3) & 3;
section[1].ib0 = (i+1) & 3;
section[1].ib1 = (i+2) & 3;
}
} else {
section[1].y0 = imgCoordMungeLowerC(vy[(i+3) & 3], glyphMode);
section[2].y0 = imgCoordMungeUpperC(vy[(i+1) & 3], glyphMode);
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[1].ia0 = i;
section[1].ia1 = (i+1) & 3;
section[1].ib0 = (i+3) & 3;
section[1].ib1 = (i+2) & 3;
} else {
section[1].ia0 = (i+3) & 3;
section[1].ia1 = (i+2) & 3;
section[1].ib0 = i;
section[1].ib1 = (i+1) & 3;
}
}
section[0].y1 = section[1].y0 - 1;
section[1].y1 = section[2].y0 - 1;
nSections = 3;
}
for (i = 0; i < nSections; ++i) {
section[i].xa0 = vx[section[i].ia0];
section[i].ya0 = vy[section[i].ia0];
section[i].xa1 = vx[section[i].ia1];
section[i].ya1 = vy[section[i].ia1];
section[i].xb0 = vx[section[i].ib0];
section[i].yb0 = vy[section[i].ib0];
section[i].xb1 = vx[section[i].ib1];
section[i].yb1 = vy[section[i].ib1];
section[i].dxdya = (section[i].xa1 - section[i].xa0) /
(section[i].ya1 - section[i].ya0);
section[i].dxdyb = (section[i].xb1 - section[i].xb0) /
(section[i].yb1 - section[i].yb0);
}
pipeInit(&pipe, 0, 0, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
if (vectorAntialias) {
drawAAPixelInit();
}
if (nSections == 1) {
if (section[0].y0 == section[0].y1) {
++section[0].y1;
clipRes = opClipRes = splashClipPartial;
}
} else {
if (section[0].y0 == section[2].y1) {
++section[1].y1;
clipRes = opClipRes = splashClipPartial;
}
}
for (i = 0; i < nSections; ++i) {
for (y = section[i].y0; y <= section[i].y1; ++y) {
xa = imgCoordMungeLowerC(section[i].xa0 +
((SplashCoord)y + 0.5 - section[i].ya0) *
section[i].dxdya,
glyphMode);
xb = imgCoordMungeUpperC(section[i].xb0 +
((SplashCoord)y + 0.5 - section[i].yb0) *
section[i].dxdyb,
glyphMode);
if (xa == xb) {
++xb;
}
if (clipRes != splashClipAllInside) {
clipRes2 = state->clip->testSpan(xa, xb - 1, y);
} else {
clipRes2 = clipRes;
}
for (x = xa; x < xb; ++x) {
xx = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir00 +
((SplashCoord)y + 0.5 - mat[5]) * ir10);
yy = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir01 +
((SplashCoord)y + 0.5 - mat[5]) * ir11);
if (xx < 0) {
xx = 0;
} else if (xx >= scaledWidth) {
xx = scaledWidth - 1;
}
if (yy < 0) {
yy = 0;
} else if (yy >= scaledHeight) {
yy = scaledHeight - 1;
}
pipe.shape = scaledMask->data[yy * scaledWidth + xx];
if (vectorAntialias && clipRes2 != splashClipAllInside) {
drawAAPixel(&pipe, x, y);
} else {
drawPixel(&pipe, x, y, clipRes2 == splashClipAllInside);
}
}
}
}
delete scaledMask;
}
|
DoS Exec Code Overflow
| 0
|
void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
SplashCoord *mat, GBool glyphMode) {
SplashBitmap *scaledMask;
SplashClipResult clipRes, clipRes2;
SplashPipe pipe;
int scaledWidth, scaledHeight, t0, t1;
SplashCoord r00, r01, r10, r11, det, ir00, ir01, ir10, ir11;
SplashCoord vx[4], vy[4];
int xMin, yMin, xMax, yMax;
ImageSection section[3];
int nSections;
int y, xa, xb, x, i, xx, yy;
vx[0] = mat[4]; vy[0] = mat[5];
vx[1] = mat[2] + mat[4]; vy[1] = mat[3] + mat[5];
vx[2] = mat[0] + mat[2] + mat[4]; vy[2] = mat[1] + mat[3] + mat[5];
vx[3] = mat[0] + mat[4]; vy[3] = mat[1] + mat[5];
xMin = imgCoordMungeLowerC(vx[0], glyphMode);
xMax = imgCoordMungeUpperC(vx[0], glyphMode);
yMin = imgCoordMungeLowerC(vy[0], glyphMode);
yMax = imgCoordMungeUpperC(vy[0], glyphMode);
for (i = 1; i < 4; ++i) {
t0 = imgCoordMungeLowerC(vx[i], glyphMode);
if (t0 < xMin) {
xMin = t0;
}
t0 = imgCoordMungeUpperC(vx[i], glyphMode);
if (t0 > xMax) {
xMax = t0;
}
t1 = imgCoordMungeLowerC(vy[i], glyphMode);
if (t1 < yMin) {
yMin = t1;
}
t1 = imgCoordMungeUpperC(vy[i], glyphMode);
if (t1 > yMax) {
yMax = t1;
}
}
clipRes = state->clip->testRect(xMin, yMin, xMax - 1, yMax - 1);
opClipRes = clipRes;
if (clipRes == splashClipAllOutside) {
return;
}
if (mat[0] >= 0) {
t0 = imgCoordMungeUpperC(mat[0] + mat[4], glyphMode) -
imgCoordMungeLowerC(mat[4], glyphMode);
} else {
t0 = imgCoordMungeUpperC(mat[4], glyphMode) -
imgCoordMungeLowerC(mat[0] + mat[4], glyphMode);
}
if (mat[1] >= 0) {
t1 = imgCoordMungeUpperC(mat[1] + mat[5], glyphMode) -
imgCoordMungeLowerC(mat[5], glyphMode);
} else {
t1 = imgCoordMungeUpperC(mat[5], glyphMode) -
imgCoordMungeLowerC(mat[1] + mat[5], glyphMode);
}
scaledWidth = t0 > t1 ? t0 : t1;
if (mat[2] >= 0) {
t0 = imgCoordMungeUpperC(mat[2] + mat[4], glyphMode) -
imgCoordMungeLowerC(mat[4], glyphMode);
} else {
t0 = imgCoordMungeUpperC(mat[4], glyphMode) -
imgCoordMungeLowerC(mat[2] + mat[4], glyphMode);
}
if (mat[3] >= 0) {
t1 = imgCoordMungeUpperC(mat[3] + mat[5], glyphMode) -
imgCoordMungeLowerC(mat[5], glyphMode);
} else {
t1 = imgCoordMungeUpperC(mat[5], glyphMode) -
imgCoordMungeLowerC(mat[3] + mat[5], glyphMode);
}
scaledHeight = t0 > t1 ? t0 : t1;
if (scaledWidth == 0) {
scaledWidth = 1;
}
if (scaledHeight == 0) {
scaledHeight = 1;
}
r00 = mat[0] / scaledWidth;
r01 = mat[1] / scaledWidth;
r10 = mat[2] / scaledHeight;
r11 = mat[3] / scaledHeight;
det = r00 * r11 - r01 * r10;
if (splashAbs(det) < 1e-6) {
return;
}
ir00 = r11 / det;
ir01 = -r01 / det;
ir10 = -r10 / det;
ir11 = r00 / det;
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
i = (vy[2] <= vy[3]) ? 2 : 3;
if (vy[1] <= vy[i]) {
i = 1;
}
if (vy[0] < vy[i] || (i != 3 && vy[0] == vy[i])) {
i = 0;
}
if (vy[i] == vy[(i+1) & 3]) {
section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode);
section[0].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1;
if (vx[i] < vx[(i+1) & 3]) {
section[0].ia0 = i;
section[0].ia1 = (i+3) & 3;
section[0].ib0 = (i+1) & 3;
section[0].ib1 = (i+2) & 3;
} else {
section[0].ia0 = (i+1) & 3;
section[0].ia1 = (i+2) & 3;
section[0].ib0 = i;
section[0].ib1 = (i+3) & 3;
}
nSections = 1;
} else {
section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode);
section[2].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1;
section[0].ia0 = section[0].ib0 = i;
section[2].ia1 = section[2].ib1 = (i+2) & 3;
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[0].ia1 = section[2].ia0 = (i+1) & 3;
section[0].ib1 = section[2].ib0 = (i+3) & 3;
} else {
section[0].ia1 = section[2].ia0 = (i+3) & 3;
section[0].ib1 = section[2].ib0 = (i+1) & 3;
}
if (vy[(i+1) & 3] < vy[(i+3) & 3]) {
section[1].y0 = imgCoordMungeLowerC(vy[(i+1) & 3], glyphMode);
section[2].y0 = imgCoordMungeUpperC(vy[(i+3) & 3], glyphMode);
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[1].ia0 = (i+1) & 3;
section[1].ia1 = (i+2) & 3;
section[1].ib0 = i;
section[1].ib1 = (i+3) & 3;
} else {
section[1].ia0 = i;
section[1].ia1 = (i+3) & 3;
section[1].ib0 = (i+1) & 3;
section[1].ib1 = (i+2) & 3;
}
} else {
section[1].y0 = imgCoordMungeLowerC(vy[(i+3) & 3], glyphMode);
section[2].y0 = imgCoordMungeUpperC(vy[(i+1) & 3], glyphMode);
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[1].ia0 = i;
section[1].ia1 = (i+1) & 3;
section[1].ib0 = (i+3) & 3;
section[1].ib1 = (i+2) & 3;
} else {
section[1].ia0 = (i+3) & 3;
section[1].ia1 = (i+2) & 3;
section[1].ib0 = i;
section[1].ib1 = (i+1) & 3;
}
}
section[0].y1 = section[1].y0 - 1;
section[1].y1 = section[2].y0 - 1;
nSections = 3;
}
for (i = 0; i < nSections; ++i) {
section[i].xa0 = vx[section[i].ia0];
section[i].ya0 = vy[section[i].ia0];
section[i].xa1 = vx[section[i].ia1];
section[i].ya1 = vy[section[i].ia1];
section[i].xb0 = vx[section[i].ib0];
section[i].yb0 = vy[section[i].ib0];
section[i].xb1 = vx[section[i].ib1];
section[i].yb1 = vy[section[i].ib1];
section[i].dxdya = (section[i].xa1 - section[i].xa0) /
(section[i].ya1 - section[i].ya0);
section[i].dxdyb = (section[i].xb1 - section[i].xb0) /
(section[i].yb1 - section[i].yb0);
}
pipeInit(&pipe, 0, 0, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
if (vectorAntialias) {
drawAAPixelInit();
}
if (nSections == 1) {
if (section[0].y0 == section[0].y1) {
++section[0].y1;
clipRes = opClipRes = splashClipPartial;
}
} else {
if (section[0].y0 == section[2].y1) {
++section[1].y1;
clipRes = opClipRes = splashClipPartial;
}
}
for (i = 0; i < nSections; ++i) {
for (y = section[i].y0; y <= section[i].y1; ++y) {
xa = imgCoordMungeLowerC(section[i].xa0 +
((SplashCoord)y + 0.5 - section[i].ya0) *
section[i].dxdya,
glyphMode);
xb = imgCoordMungeUpperC(section[i].xb0 +
((SplashCoord)y + 0.5 - section[i].yb0) *
section[i].dxdyb,
glyphMode);
if (xa == xb) {
++xb;
}
if (clipRes != splashClipAllInside) {
clipRes2 = state->clip->testSpan(xa, xb - 1, y);
} else {
clipRes2 = clipRes;
}
for (x = xa; x < xb; ++x) {
xx = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir00 +
((SplashCoord)y + 0.5 - mat[5]) * ir10);
yy = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir01 +
((SplashCoord)y + 0.5 - mat[5]) * ir11);
if (xx < 0) {
xx = 0;
} else if (xx >= scaledWidth) {
xx = scaledWidth - 1;
}
if (yy < 0) {
yy = 0;
} else if (yy >= scaledHeight) {
yy = scaledHeight - 1;
}
pipe.shape = scaledMask->data[yy * scaledWidth + xx];
if (vectorAntialias && clipRes2 != splashClipAllInside) {
drawAAPixel(&pipe, x, y);
} else {
drawPixel(&pipe, x, y, clipRes2 == splashClipAllInside);
}
}
}
}
delete scaledMask;
}
|
@@ -2252,11 +2252,14 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) {
lineDashStartOn = gTrue;
lineDashStartIdx = 0;
if (lineDashStartPhase > 0) {
- while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) {
+ while (lineDashStartIdx < state->lineDashLength && lineDashStartPhase >= state->lineDash[lineDashStartIdx]) {
lineDashStartOn = !lineDashStartOn;
lineDashStartPhase -= state->lineDash[lineDashStartIdx];
++lineDashStartIdx;
}
+ if (unlikely(lineDashStartIdx == state->lineDashLength)) {
+ return new SplashPath();
+ }
}
dPath = new SplashPath();
|
CWE-119
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.