| OLD | NEW |
| 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; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 viewportCenter.y = bounds.bottom; | 71 viewportCenter.y = bounds.bottom; |
| 72 } | 72 } |
| 73 | 73 |
| 74 mViewportPosition.set(viewportCenter); | 74 mViewportPosition.set(viewportCenter); |
| 75 } | 75 } |
| 76 | 76 |
| 77 return viewportCenter; | 77 return viewportCenter; |
| 78 } | 78 } |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * Sets the desired center position of the viewport. |
| 82 * |
| 83 * @param newX The new x coordinate value for the desired center position. |
| 84 * @param newY The new y coordinate value for the desired center position. |
| 85 */ |
| 86 public void setViewportPosition(float newX, float newY) { |
| 87 synchronized (mRenderData) { |
| 88 mViewportPosition.set(newX, newY); |
| 89 } |
| 90 } |
| 91 |
| 92 /** |
| 81 * Returns the current size of the viewport. This size includes the offset
calculations for | 93 * Returns the current size of the viewport. This size includes the offset
calculations for |
| 82 * any visible system UI. | 94 * any visible system UI. |
| 83 * | 95 * |
| 84 * @return A point representing the current size of the viewport. | 96 * @return A point representing the current size of the viewport. |
| 85 */ | 97 */ |
| 86 private PointF getViewportSize() { | 98 private PointF getViewportSize() { |
| 87 float adjustedScreenWidth, adjustedScreenHeight; | 99 float adjustedScreenWidth, adjustedScreenHeight; |
| 88 synchronized (mRenderData) { | 100 synchronized (mRenderData) { |
| 89 adjustedScreenWidth = mRenderData.screenWidth - mSystemUiOffsetPixel
s.right; | 101 adjustedScreenWidth = mRenderData.screenWidth - mSystemUiOffsetPixel
s.right; |
| 90 adjustedScreenHeight = mRenderData.screenHeight - mSystemUiOffsetPix
els.bottom; | 102 adjustedScreenHeight = mRenderData.screenHeight - mSystemUiOffsetPix
els.bottom; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // level needed to fit either the width or height. | 256 // level needed to fit either the width or height. |
| 245 float scale = Math.min((float) mRenderData.screenWidth / mRender
Data.imageWidth, | 257 float scale = Math.min((float) mRenderData.screenWidth / mRender
Data.imageWidth, |
| 246 (float) mRenderData.screenHeight / mRende
rData.imageHeight); | 258 (float) mRenderData.screenHeight / mRende
rData.imageHeight); |
| 247 mRenderData.transform.setScale(scale, scale); | 259 mRenderData.transform.setScale(scale, scale); |
| 248 } | 260 } |
| 249 } | 261 } |
| 250 | 262 |
| 251 repositionImage(centerViewport); | 263 repositionImage(centerViewport); |
| 252 } | 264 } |
| 253 } | 265 } |
| OLD | NEW |