mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Modernize the ShadingIRs
structure, in src/display/pattern_helper.js
, to use standard classes
This patch replaces the old structure with an abstract base-class, which the new ShadingPattern classes then inherit from. The old `createMeshCanvasClosure` can now be removed, since it's not necessary any more with modern JavaScript, and the `createMeshCanvas` function is now instead a method on the new `MeshShadingPattern` class (avoids unnecessary parameter passing).
This commit is contained in:
parent
40939d5955
commit
a984431046
2 changed files with 309 additions and 308 deletions
|
@ -27,7 +27,7 @@ import {
|
|||
Util,
|
||||
warn,
|
||||
} from "../shared/util.js";
|
||||
import { getShadingPatternFromIR, TilingPattern } from "./pattern_helper.js";
|
||||
import { getShadingPattern, TilingPattern } from "./pattern_helper.js";
|
||||
|
||||
// <canvas> contexts store most of the state we need natively.
|
||||
// However, PDF needs a bit more state, which we store here.
|
||||
|
@ -1973,7 +1973,7 @@ const CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
baseTransform
|
||||
);
|
||||
} else {
|
||||
pattern = getShadingPatternFromIR(IR);
|
||||
pattern = getShadingPattern(IR);
|
||||
}
|
||||
return pattern;
|
||||
}
|
||||
|
@ -2007,7 +2007,7 @@ const CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
const ctx = this.ctx;
|
||||
|
||||
this.save();
|
||||
const pattern = getShadingPatternFromIR(patternIR);
|
||||
const pattern = getShadingPattern(patternIR);
|
||||
ctx.fillStyle = pattern.getPattern(ctx, this, true);
|
||||
|
||||
const inv = ctx.mozCurrentTransformInverse;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue