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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/DesktopCanvas.java

Issue 2132883002: [Remoting Android] Placeholder for DesktopView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase ToT and do same fix for GlDisplay Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.chromoting; 5 package org.chromium.chromoting;
6 6
7 import android.graphics.Matrix; 7 import android.graphics.Matrix;
8 import android.graphics.PointF; 8 import android.graphics.PointF;
9 import android.graphics.Rect; 9 import android.graphics.Rect;
10 import android.graphics.RectF; 10 import android.graphics.RectF;
11 11
12 /** 12 /**
13 * This class is responsible for transforming the desktop image matrix. 13 * This class is responsible for transforming the desktop image matrix.
14 */ 14 */
15 public class DesktopCanvas { 15 public class DesktopCanvas {
16 /** 16 /**
17 * Maximum allowed zoom level - see {@link #repositionImageWithZoom()}. 17 * Maximum allowed zoom level - see {@link #repositionImageWithZoom()}.
18 */ 18 */
19 private static final float MAX_ZOOM_FACTOR = 100.0f; 19 private static final float MAX_ZOOM_FACTOR = 100.0f;
20 20
21 private final DesktopViewInterface mViewer; 21 private final AbstractDesktopView mViewer;
22 private final RenderData mRenderData; 22 private final RenderData mRenderData;
23 23
24 /** 24 /**
25 * Represents the desired center of the viewport. This value may not repres ent the actual 25 * Represents the desired center of the viewport. This value may not repres ent the actual
26 * center of the viewport as adjustments are made to ensure as much of the d esktop is visible as 26 * center of the viewport as adjustments are made to ensure as much of the d esktop is visible as
27 * possible. This value needs to be a pair of floats so the desktop image c an be positioned 27 * possible. This value needs to be a pair of floats so the desktop image c an be positioned
28 * with sub-pixel accuracy for smoother panning animations at high zoom leve ls. 28 * with sub-pixel accuracy for smoother panning animations at high zoom leve ls.
29 */ 29 */
30 private PointF mViewportPosition = new PointF(); 30 private PointF mViewportPosition = new PointF();
31 31
32 /** 32 /**
33 * Represents the amount of space, in pixels, used by system UI. 33 * Represents the amount of space, in pixels, used by system UI.
34 */ 34 */
35 private Rect mSystemUiOffsetPixels = new Rect(); 35 private Rect mSystemUiOffsetPixels = new Rect();
36 36
37 public DesktopCanvas(DesktopViewInterface viewer, RenderData renderData) { 37 public DesktopCanvas(AbstractDesktopView viewer, RenderData renderData) {
38 mViewer = viewer; 38 mViewer = viewer;
39 mRenderData = renderData; 39 mRenderData = renderData;
40 } 40 }
41 41
42 /** 42 /**
43 * Shifts the viewport by the passed in deltas (in image coordinates). 43 * Shifts the viewport by the passed in deltas (in image coordinates).
44 * 44 *
45 * @param useScreenCenter Determines whether to use the desired viewport pos ition or the actual 45 * @param useScreenCenter Determines whether to use the desired viewport pos ition or the actual
46 * center of the screen for positioning. 46 * center of the screen for positioning.
47 * @param deltaX The distance (in image coordinates) to move the viewport al ong the x-axis. 47 * @param deltaX The distance (in image coordinates) to move the viewport al ong the x-axis.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // level needed to fit either the width or height. 244 // level needed to fit either the width or height.
245 float scale = Math.min((float) mRenderData.screenWidth / mRender Data.imageWidth, 245 float scale = Math.min((float) mRenderData.screenWidth / mRender Data.imageWidth,
246 (float) mRenderData.screenHeight / mRende rData.imageHeight); 246 (float) mRenderData.screenHeight / mRende rData.imageHeight);
247 mRenderData.transform.setScale(scale, scale); 247 mRenderData.transform.setScale(scale, scale);
248 } 248 }
249 } 249 }
250 250
251 repositionImage(centerViewport); 251 repositionImage(centerViewport);
252 } 252 }
253 } 253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698