From b10aa18b3eda4437668b5453e20f729790b4a437 Mon Sep 17 00:00:00 2001 From: p01 Date: Thu, 3 Apr 2014 13:41:24 +0200 Subject: [PATCH] Use Opaque Canvas where possible --- src/display/api.js | 2 +- web/page_view.js | 2 +- web/text_layer_builder.js | 2 +- web/thumbnail_view.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index 807cce74e..66304ea19 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -688,7 +688,7 @@ var WorkerTransport = (function WorkerTransportClosure() { info('The worker has been disabled.'); } } -//#endif +//#endif // Either workers are disabled, not supported or have thrown an exception. // Thus, we fallback to a faked worker. globalScope.PDFJS.disableWorker = true; diff --git a/web/page_view.js b/web/page_view.js index d961079e4..546ab3fd3 100644 --- a/web/page_view.js +++ b/web/page_view.js @@ -462,7 +462,7 @@ var PageView = function pageView(container, id, scale, this.canvas = canvas; var scale = this.scale; - var ctx = canvas.getContext('2d'); + var ctx = canvas.getContext('2d', {alpha: false}); var outputScale = getOutputScale(ctx); if (USE_ONLY_CSS_ZOOM) { diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js index 40aa8575f..d7d52d390 100644 --- a/web/text_layer_builder.js +++ b/web/text_layer_builder.js @@ -53,7 +53,7 @@ var TextLayerBuilder = function textLayerBuilder(options) { this.renderLayer = function textLayerBuilderRenderLayer() { var textDivs = this.textDivs; var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); + var ctx = canvas.getContext('2d', {alpha: false}); // No point in rendering so many divs as it'd make the browser unusable // even after the divs are rendered diff --git a/web/thumbnail_view.js b/web/thumbnail_view.js index 90d4e89f6..cd3da4b7c 100644 --- a/web/thumbnail_view.js +++ b/web/thumbnail_view.js @@ -111,7 +111,7 @@ var ThumbnailView = function thumbnailView(container, id, defaultViewport) { ring.appendChild(canvas); - var ctx = canvas.getContext('2d'); + var ctx = canvas.getContext('2d', {alpha: false}); ctx.save(); ctx.fillStyle = 'rgb(255, 255, 255)'; ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight);