1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Merge remote-tracking branch 'upstream/master' into style

Conflicts:
	src/image.js
	src/pattern.js
This commit is contained in:
Kalervo Kujala 2011-12-09 00:28:31 +02:00
commit cd01302de8
11 changed files with 78 additions and 52 deletions

View file

@ -183,7 +183,11 @@ Shadings.Dummy = (function DummyClosure() {
})();
var TilingPattern = (function TilingPatternClosure() {
var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2;
var PaintType = {
COLORED: 1,
UNCOLORED: 2
};
var MAX_PATTERN_SIZE = 512;
function TilingPattern(IR, color, ctx, objs) {
var IRQueue = IR[2];
@ -209,13 +213,13 @@ var TilingPattern = (function TilingPatternClosure() {
var width = botRight[0] - topLeft[0];
var height = botRight[1] - topLeft[1];
// TODO: hack to avoid OOM, we would idealy compute the tiling
// TODO: hack to avoid OOM, we would ideally compute the tiling
// pattern to be only as large as the acual size in device space
// This could be computed with .mozCurrentTransform, but still
// needs to be implemented
while (Math.abs(width) > 512 || Math.abs(height) > 512) {
width = 512;
height = 512;
while (Math.abs(width) > MAX_PATTERN_SIZE ||
Math.abs(height) > MAX_PATTERN_SIZE) {
width = height = MAX_PATTERN_SIZE;
}
var tmpCanvas = new ScratchCanvas(width, height);
@ -225,11 +229,11 @@ var TilingPattern = (function TilingPatternClosure() {
var graphics = new CanvasGraphics(tmpCtx, objs);
switch (paintType) {
case PAINT_TYPE_COLORED:
case PaintType.COLORED:
tmpCtx.fillStyle = ctx.fillStyle;
tmpCtx.strokeStyle = ctx.strokeStyle;
break;
case PAINT_TYPE_UNCOLORED:
case PaintType.UNCOLORED:
color = Util.makeCssRgb.apply(this, color);
tmpCtx.fillStyle = color;
tmpCtx.strokeStyle = color;