Merge pull request #7977 from Snuffleupagus/paintedViewport-regression
Ensure that we use the *correct* `paintedViewport` in `PDFPageView.cssTransform`, to avoid visual glitches on quick rotations (PR 7738 follow-up)
This commit is contained in:
commit
857e360a42
@ -97,7 +97,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
this.renderer = options.renderer || RendererType.CANVAS;
|
||||
|
||||
this.paintTask = null;
|
||||
this.paintedViewport = null;
|
||||
this.paintedViewportMap = new WeakMap();
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
this.resume = null;
|
||||
this.error = null;
|
||||
@ -170,6 +170,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
}
|
||||
|
||||
if (this.canvas && !currentZoomLayerNode) {
|
||||
this.paintedViewportMap.delete(this.canvas);
|
||||
// Zeroing the width and height causes Firefox to release graphics
|
||||
// resources immediately, which can greatly reduce memory consumption.
|
||||
this.canvas.width = 0;
|
||||
@ -177,11 +178,9 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
delete this.canvas;
|
||||
}
|
||||
if (this.svg) {
|
||||
this.paintedViewportMap.delete(this.svg);
|
||||
delete this.svg;
|
||||
}
|
||||
if (!currentZoomLayerNode) {
|
||||
this.paintedViewport = null;
|
||||
}
|
||||
|
||||
this.loadingIconDiv = document.createElement('div');
|
||||
this.loadingIconDiv.className = 'loadingIcon';
|
||||
@ -281,7 +280,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
Math.floor(height) + 'px';
|
||||
// The canvas may have been originally rotated, rotate relative to that.
|
||||
var relativeRotation = this.viewport.rotation -
|
||||
this.paintedViewport.rotation;
|
||||
this.paintedViewportMap.get(target).rotation;
|
||||
var absRotation = Math.abs(relativeRotation);
|
||||
var scaleX = 1, scaleY = 1;
|
||||
if (absRotation === 90 || absRotation === 270) {
|
||||
@ -434,9 +433,10 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
}
|
||||
|
||||
if (self.zoomLayer) {
|
||||
var zoomLayerCanvas = self.zoomLayer.firstChild;
|
||||
self.paintedViewportMap.delete(zoomLayerCanvas);
|
||||
// Zeroing the width and height causes Firefox to release graphics
|
||||
// resources immediately, which can greatly reduce memory consumption.
|
||||
var zoomLayerCanvas = self.zoomLayer.firstChild;
|
||||
zoomLayerCanvas.width = 0;
|
||||
zoomLayerCanvas.height = 0;
|
||||
|
||||
@ -578,7 +578,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
canvas.style.width = roundToDivide(viewport.width, sfx[1]) + 'px';
|
||||
canvas.style.height = roundToDivide(viewport.height, sfy[1]) + 'px';
|
||||
// Add the viewport so it's known what it was originally drawn with.
|
||||
this.paintedViewport = viewport;
|
||||
this.paintedViewportMap.set(canvas, viewport);
|
||||
|
||||
// Rendering area
|
||||
var transform = !outputScale.scaled ? null :
|
||||
@ -643,7 +643,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) {
|
||||
ensureNotCancelled();
|
||||
self.svg = svg;
|
||||
self.paintedViewport = actualSizeViewport;
|
||||
self.paintedViewportMap.set(svg, actualSizeViewport);
|
||||
|
||||
svg.style.width = wrapper.style.width;
|
||||
svg.style.height = wrapper.style.height;
|
||||
|
Loading…
x
Reference in New Issue
Block a user