Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: ui/file_manager/gallery/js/image_editor/image_view.js

Issue 399383002: Check the actual size of canvas to update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/image_editor/image_view.js
diff --git a/ui/file_manager/gallery/js/image_editor/image_view.js b/ui/file_manager/gallery/js/image_editor/image_view.js
index 3f49c953e314b3908ffda5508e82babb343da6f9..9223e136f1f8c27696d7807dc59a0a9cd0299666 100644
--- a/ui/file_manager/gallery/js/image_editor/image_view.js
+++ b/ui/file_manager/gallery/js/image_editor/image_view.js
@@ -20,7 +20,6 @@ function ImageView(container, viewport) {
this.document_ = container.ownerDocument;
this.contentGeneration_ = 0;
this.displayedContentGeneration_ = 0;
- this.displayedViewportGeneration_ = 0;
this.imageLoader_ = new ImageUtil.ImageLoader(this.document_);
// We have a separate image loader for prefetch which does not get cancelled
@@ -104,20 +103,16 @@ ImageView.prototype.draw = function() {
return;
var forceRepaint = false;
-
- if (this.displayedViewportGeneration_ !==
- this.viewport_.getCacheGeneration()) {
- this.displayedViewportGeneration_ = this.viewport_.getCacheGeneration();
-
+ var deviceBounds = this.viewport_.getDeviceBounds();
+ if (deviceBounds.width != this.screenImage_.width ||
+ deviceBounds.height != this.screenImage_.height) {
this.setupDeviceBuffer(this.screenImage_);
-
forceRepaint = true;
}
if (forceRepaint ||
this.displayedContentGeneration_ !== this.contentGeneration_) {
this.displayedContentGeneration_ = this.contentGeneration_;
-
ImageUtil.trace.resetTimer('paint');
this.paintDeviceRect(this.contentCanvas_, new Rect(this.contentCanvas_));
ImageUtil.trace.reportTimer('paint');
@@ -182,16 +177,9 @@ ImageView.prototype.getContentRevision = function() {
* @param {Rect} imageRect Rectangle region of the canvas to be rendered.
*/
ImageView.prototype.paintDeviceRect = function(canvas, imageRect) {
- // Check canvas size.
- var deviceBounds = this.viewport_.getDeviceBounds();
- if (this.screenImage_.width != deviceBounds.width ||
- this.screenImage_.height != deviceBounds.height) {
- console.error('The size of canvas is invalid.', (new Error).stack);
- return;
- }
-
// Map the rectangle in full resolution image to the rectangle in the device
// canvas.
+ var deviceBounds = this.viewport_.getDeviceBounds();
var scaleX = deviceBounds.width / canvas.width;
var scaleY = deviceBounds.height / canvas.height;
var deviceRect = new Rect(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698