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

Side by Side Diff: remoting/webapp/me2mom/client_session.js

Issue 7633045: Fix scaling calculation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Session class that handles creation and teardown of a remoting session. 7 * Session class that handles creation and teardown of a remoting session.
8 * 8 *
9 * This abstracts a <embed> element and controls the plugin which does the 9 * This abstracts a <embed> element and controls the plugin which does the
10 * actual remoting work. There should be no UI code inside this class. It 10 * actual remoting work. There should be no UI code inside this class. It
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 376 }
377 377
378 // Make sure both width and height are multiples of two. 378 // Make sure both width and height are multiples of two.
379 var width = window.innerWidth; 379 var width = window.innerWidth;
380 var height = window.innerHeight; 380 var height = window.innerHeight;
381 if (width % 2 == 1) 381 if (width % 2 == 1)
382 --width; 382 --width;
383 if (height % 2 == 1) 383 if (height % 2 == 1)
384 --height; 384 --height;
385 385
386 var scale = 1.0; 386 var scaleFitHeight = 1.0 * height / this.plugin.desktopHeight;
387 if (width < height) 387 var scaleFitWidth = 1.0 * width / this.plugin.desktopWidth;
388 scale = 1.0 * height / this.plugin.desktopHeight; 388 var scale = Math.min(scaleFitHeight, scaleFitWidth);
389 else
390 scale = 1.0 * width / this.plugin.desktopWidth;
391
392 if (scale > 1.0) { 389 if (scale > 1.0) {
393 remoting.debug.log('scale up is not supported'); 390 remoting.debug.log('scale up is not supported');
Wez 2011/08/13 01:38:51 Don't we need to be sure to re-set things to 1:1 h
Lambros 2011/08/13 02:13:30 Done.
394 return; 391 return;
395 } 392 }
396 393
397 this.plugin.width = this.plugin.desktopWidth * scale; 394 this.plugin.width = this.plugin.desktopWidth * scale;
398 this.plugin.height = this.plugin.desktopHeight * scale; 395 this.plugin.height = this.plugin.desktopHeight * scale;
399 } else { 396 } else {
400 remoting.debug.log('scale to fit is turned off.'); 397 remoting.debug.log('scale to fit is turned off.');
401 this.plugin.width = this.plugin.desktopWidth; 398 this.plugin.width = this.plugin.desktopWidth;
402 this.plugin.height = this.plugin.desktopHeight; 399 this.plugin.height = this.plugin.desktopHeight;
403 } 400 }
(...skipping 12 matching lines...) Expand all
416 'video_bandwidth': this.plugin.videoBandwidth, 413 'video_bandwidth': this.plugin.videoBandwidth,
417 'capture_latency': this.plugin.videoCaptureLatency, 414 'capture_latency': this.plugin.videoCaptureLatency,
418 'encode_latency': this.plugin.videoEncodeLatency, 415 'encode_latency': this.plugin.videoEncodeLatency,
419 'decode_latency': this.plugin.videoDecodeLatency, 416 'decode_latency': this.plugin.videoDecodeLatency,
420 'render_latency': this.plugin.videoRenderLatency, 417 'render_latency': this.plugin.videoRenderLatency,
421 'roundtrip_latency': this.plugin.roundTripLatency 418 'roundtrip_latency': this.plugin.roundTripLatency
422 }; 419 };
423 }; 420 };
424 421
425 }()); 422 }());
OLDNEW
« 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