mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Allow subpixel anti-aliasing for most of the content.
This commit is contained in:
parent
f096e4ab91
commit
1d8800370a
7 changed files with 111 additions and 55 deletions
|
@ -149,7 +149,7 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
|
|||
}
|
||||
|
||||
function createMeshCanvas(bounds, combinesScale, coords, colors, figures,
|
||||
backgroundColor) {
|
||||
backgroundColor, cachedCanvases) {
|
||||
// we will increase scale on some weird factor to let antialiasing take
|
||||
// care of "rough" edges
|
||||
var EXPECTED_SCALE = 1.1;
|
||||
|
@ -183,11 +183,11 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
|
|||
figures, context);
|
||||
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=972126
|
||||
tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
|
||||
tmpCanvas = cachedCanvases.getCanvas('mesh', width, height, false);
|
||||
tmpCanvas.context.drawImage(canvas, 0, 0);
|
||||
canvas = tmpCanvas.canvas;
|
||||
} else {
|
||||
tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
|
||||
tmpCanvas = cachedCanvases.getCanvas('mesh', width, height, false);
|
||||
var tmpCtx = tmpCanvas.context;
|
||||
|
||||
var data = tmpCtx.createImageData(width, height);
|
||||
|
@ -243,7 +243,8 @@ ShadingIRs.Mesh = {
|
|||
// Rasterizing on the main thread since sending/queue large canvases
|
||||
// might cause OOM.
|
||||
var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords,
|
||||
colors, figures, shadingFill ? null : background);
|
||||
colors, figures, shadingFill ? null : background,
|
||||
owner.cachedCanvases);
|
||||
|
||||
if (!shadingFill) {
|
||||
ctx.setTransform.apply(ctx, owner.baseTransform);
|
||||
|
@ -346,7 +347,8 @@ var TilingPattern = (function TilingPatternClosure() {
|
|||
height = Math.min(Math.ceil(Math.abs(height * combinedScale[1])),
|
||||
MAX_PATTERN_SIZE);
|
||||
|
||||
var tmpCanvas = CachedCanvases.getCanvas('pattern', width, height, true);
|
||||
var tmpCanvas = owner.cachedCanvases.getCanvas('pattern',
|
||||
width, height, true);
|
||||
var tmpCtx = tmpCanvas.context;
|
||||
var graphics = new CanvasGraphics(tmpCtx, commonObjs, objs);
|
||||
graphics.groupLevel = owner.groupLevel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue