Merge pull request #4336 from nnethercote/rgb24

Special-case 24-bit RGB image-handling
This commit is contained in:
Yury Delendik 2014-03-02 19:53:42 -06:00
commit 9a918572dd
4 changed files with 82 additions and 51 deletions

View file

@ -16,7 +16,7 @@
*/
/* globals assert, assertWellFormed, ColorSpace, Dict, Encodings, error,
ErrorFont, Font, FONT_IDENTITY_MATRIX, fontCharsToUnicode, FontFlags,
info, isArray, isCmd, isDict, isEOF, isName, isNum,
ImageKind, info, isArray, isCmd, isDict, isEOF, isName, isNum,
isStream, isString, JpegStream, Lexer, Metrics, Name, Parser,
Pattern, PDFImage, PDFJS, serifFonts, stdFontMap, symbolsFonts,
getTilingPatternIR, warn, Util, Promise, LegacyPromise,
@ -164,7 +164,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
(w + h) < SMALL_IMAGE_DIMENSIONS) {
var imageObj = new PDFImage(this.xref, resources, image,
inline, null, null);
var imgData = imageObj.createImageData();
// We force the use of RGBA_32BPP images here, because we can't handle
// any other kind.
var imgData = imageObj.createImageData(/* forceRGBA = */ true);
operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
return;
}
@ -187,7 +189,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
PDFImage.buildImage(function(imageObj) {
var imgData = imageObj.createImageData();
var imgData = imageObj.createImageData(/* forceRGBA = */ false);
self.handler.send('obj', [objId, self.pageIndex, 'Image', imgData],
null, [imgData.data.buffer]);
}, self.handler, self.xref, resources, image, inline);
@ -1313,7 +1315,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// replacing queue items
squash(fnArray, j, count * 4, OPS.paintInlineImageXObjectGroup);
argsArray.splice(j, count * 4,
[{width: imgWidth, height: imgHeight, kind: 'rgba_32bpp',
[{width: imgWidth, height: imgHeight, kind: ImageKind.RGBA_32BPP,
data: imgData}, map]);
i = j;
ii = argsArray.length;