mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 18:25:37 +02:00
Split the existing WebGLUtils
in two classes, a private WebGLUtils
and a public WebGLContext
, and utilize the latter in the API to allow various code to access the methods of WebGLUtils
This patch is one (small) step on the way to reduce the general dependency on a global `PDFJS` object, for PDF.js version `2.0`.
This commit is contained in:
parent
503bc95a2b
commit
59b5e14301
4 changed files with 86 additions and 43 deletions
|
@ -14,7 +14,6 @@
|
|||
*/
|
||||
|
||||
import { FormatError, info, Util } from '../shared/util';
|
||||
import { WebGLUtils } from './webgl';
|
||||
|
||||
var ShadingIRs = {};
|
||||
|
||||
|
@ -145,7 +144,7 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
|
|||
}
|
||||
|
||||
function createMeshCanvas(bounds, combinesScale, coords, colors, figures,
|
||||
backgroundColor, cachedCanvases) {
|
||||
backgroundColor, cachedCanvases, webGLContext) {
|
||||
// we will increase scale on some weird factor to let antialiasing take
|
||||
// care of "rough" edges
|
||||
var EXPECTED_SCALE = 1.1;
|
||||
|
@ -180,10 +179,14 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
|
|||
var paddedHeight = height + BORDER_SIZE * 2;
|
||||
|
||||
var canvas, tmpCanvas, i, ii;
|
||||
if (WebGLUtils.isEnabled) {
|
||||
canvas = WebGLUtils.drawFigures(width, height, backgroundColor,
|
||||
figures, context);
|
||||
|
||||
if (webGLContext.isEnabled) {
|
||||
canvas = webGLContext.drawFigures({
|
||||
width,
|
||||
height,
|
||||
backgroundColor,
|
||||
figures,
|
||||
context,
|
||||
});
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=972126
|
||||
tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight,
|
||||
false);
|
||||
|
@ -253,7 +256,7 @@ ShadingIRs.Mesh = {
|
|||
// might cause OOM.
|
||||
var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords,
|
||||
colors, figures, shadingFill ? null : background,
|
||||
owner.cachedCanvases);
|
||||
owner.cachedCanvases, owner.webGLContext);
|
||||
|
||||
if (!shadingFill) {
|
||||
ctx.setTransform.apply(ctx, owner.baseTransform);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue