mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Introduce ImageKind constants.
This commit is contained in:
parent
4e1f92a893
commit
42cbb5b440
4 changed files with 21 additions and 15 deletions
|
@ -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,
|
||||
|
@ -166,8 +166,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
(w + h) < SMALL_IMAGE_DIMENSIONS) {
|
||||
var imageObj = new PDFImage(this.xref, resources, image,
|
||||
inline, null, null);
|
||||
// We force the use of 'rgba_32bpp' images here, because we can't
|
||||
// handle any other kind.
|
||||
// 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;
|
||||
|
@ -1321,7 +1321,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;
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals ColorSpace, error, isArray, isStream, JpegStream, Name, Promise,
|
||||
Stream, warn, LegacyPromise */
|
||||
/* globals ColorSpace, error, isArray, ImageKind, isStream, JpegStream, Name,
|
||||
Promise, Stream, warn, LegacyPromise */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -444,9 +444,9 @@ var PDFImage = (function PDFImageClosure() {
|
|||
// complications, we avoid expanding by 1.333x to RGBA form.
|
||||
var kind;
|
||||
if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
|
||||
kind = 'grayscale_1bpp';
|
||||
kind = ImageKind.GRAYSCALE_1BPP;
|
||||
} else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8) {
|
||||
kind = 'rgb_24bpp';
|
||||
kind = ImageKind.RGB_24BPP;
|
||||
}
|
||||
if (kind && !this.smask && !this.mask && !this.needsDecode &&
|
||||
drawWidth === originalWidth && drawHeight === originalHeight) {
|
||||
|
@ -482,7 +482,7 @@ var PDFImage = (function PDFImageClosure() {
|
|||
|
||||
this.undoPreblend(rgbaBuf, drawWidth, actualHeight);
|
||||
|
||||
imgData.kind = 'rgba_32bpp';
|
||||
imgData.kind = ImageKind.RGBA_32BPP;
|
||||
imgData.data = rgbaBuf;
|
||||
return imgData;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue