cleanup
This commit is contained in:
parent
4861a9175d
commit
53511decbb
40
pdf.js
40
pdf.js
@ -4208,27 +4208,15 @@ var CanvasGraphics = (function() {
|
|||||||
},
|
},
|
||||||
getShadingPattern: function(pattern, dict) {
|
getShadingPattern: function(pattern, dict) {
|
||||||
var matrix = dict.get("Matrix");
|
var matrix = dict.get("Matrix");
|
||||||
/*
|
|
||||||
var inv = [0,0,0,0,0,0];
|
|
||||||
var det = 1 / (matrix[0] * matrix[3] - matrix[1] * matrix[2]);
|
|
||||||
inv[0] = matrix[3] * det;
|
|
||||||
inv[1] = -matrix[1] * det;
|
|
||||||
inv[2] = -matrix[2] * det;
|
|
||||||
inv[3] = matrix[0] * det;
|
|
||||||
inv[4] = det * (matrix[2] * matrix[5] - matrix[3] * matrix[4]);
|
|
||||||
inv[5] = det * (matrix[1] * matrix[4] - matrix[0] * matrix[5]);
|
|
||||||
|
|
||||||
this.transform.apply(this, matrix);
|
|
||||||
//var shading = this.getShading(pattern.get("Shading"));
|
|
||||||
*/ return this.getShading(pattern.get("Shading"));
|
|
||||||
|
|
||||||
/* this.ctx.fillStyle = shading;
|
this.save();
|
||||||
|
this.transform.apply(this, matrix);
|
||||||
|
var shading = this.getShading(pattern.get("Shading"));
|
||||||
|
this.restore();
|
||||||
|
|
||||||
// HACK to get the gradient to show at the right location. If
|
TODO('store transform so it can be applied before every fill');
|
||||||
// removed, the gradient will show at the pre-transform coordinates.
|
return shading;
|
||||||
this.ctx.fillRect(0,0,0,0);
|
},
|
||||||
this.transform.apply(this, inv);
|
|
||||||
*/ },
|
|
||||||
getTilingPattern: function(pattern, dict, color) {
|
getTilingPattern: function(pattern, dict, color) {
|
||||||
function multiply(m, tm) {
|
function multiply(m, tm) {
|
||||||
var a = m[0] * tm[0] + m[1] * tm[2];
|
var a = m[0] * tm[0] + m[1] * tm[2];
|
||||||
@ -4264,7 +4252,7 @@ var CanvasGraphics = (function() {
|
|||||||
|
|
||||||
// TODO: hack to avoid OOM, remove then pattern code is fixed
|
// TODO: hack to avoid OOM, remove then pattern code is fixed
|
||||||
if (Math.abs(width) > 8192 || Math.abs(height) > 8192)
|
if (Math.abs(width) > 8192 || Math.abs(height) > 8192)
|
||||||
return this.makeCssRgb(0, 0, 0);
|
return 'hotpink';
|
||||||
|
|
||||||
var tmpCanvas = new this.ScratchCanvas(width, height);
|
var tmpCanvas = new this.ScratchCanvas(width, height);
|
||||||
|
|
||||||
@ -4273,16 +4261,17 @@ var CanvasGraphics = (function() {
|
|||||||
var savedCtx = ctx;
|
var savedCtx = ctx;
|
||||||
this.ctx = tmpCtx;
|
this.ctx = tmpCtx;
|
||||||
|
|
||||||
|
var fillColor, strokeColor;
|
||||||
var paintType = dict.get('PaintType');
|
var paintType = dict.get('PaintType');
|
||||||
switch (paintType) {
|
switch (paintType) {
|
||||||
case PAINT_TYPE_COLORED:
|
case PAINT_TYPE_COLORED:
|
||||||
// should go to default for color space
|
tmpCtx.fillStyle = savedCtx.fillStyle;
|
||||||
tmpCtx.fillStyle = this.makeCssRgb(1, 1, 1);
|
tmpCtx.strokeStyle = savedCtx.strokeStyle;
|
||||||
tmpCtx.strokeStyle = this.makeCssRgb(0, 0, 0);
|
|
||||||
break;
|
break;
|
||||||
case PAINT_TYPE_UNCOLORED:
|
case PAINT_TYPE_UNCOLORED:
|
||||||
tmpCtx.fillStyle = this.makeCssRgb.apply(this, color);
|
color = this.makeCssRgb.apply(this, color);
|
||||||
tmpCtx.strokeStyle = this.makeCssRgb.apply(this, color);
|
tmpCtx.fillStyle = color;
|
||||||
|
tmpCtx.strokeStyle = color;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error('Unsupported paint type');
|
error('Unsupported paint type');
|
||||||
@ -4316,7 +4305,6 @@ var CanvasGraphics = (function() {
|
|||||||
this.ctx = savedCtx;
|
this.ctx = savedCtx;
|
||||||
this.restore();
|
this.restore();
|
||||||
|
|
||||||
TODO('Inverse pattern is painted');
|
|
||||||
return this.ctx.createPattern(tmpCanvas, 'repeat');
|
return this.ctx.createPattern(tmpCanvas, 'repeat');
|
||||||
},
|
},
|
||||||
setStrokeGray: function(gray) {
|
setStrokeGray: function(gray) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user