Merge "Use floating point window positions."
This commit is contained in:
committed by
Android (Google) Code Review
commit
1434ab98e6
@@ -8648,6 +8648,7 @@ package android.graphics {
|
||||
method public void setEmpty();
|
||||
method public boolean setIntersect(android.graphics.RectF, android.graphics.RectF);
|
||||
method public void sort();
|
||||
method public java.lang.String toShortString();
|
||||
method public void union(float, float, float, float);
|
||||
method public void union(android.graphics.RectF);
|
||||
method public void union(float, float);
|
||||
@@ -10680,8 +10681,8 @@ package android.media {
|
||||
method public void setOnSeekCompleteListener(android.media.MediaPlayer.OnSeekCompleteListener);
|
||||
method public void setOnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener);
|
||||
method public void setScreenOnWhilePlaying(boolean);
|
||||
method public void setTexture(android.graphics.SurfaceTexture);
|
||||
method public void setSurface(android.view.Surface);
|
||||
method public void setTexture(android.graphics.SurfaceTexture);
|
||||
method public void setVolume(float, float);
|
||||
method public void setWakeMode(android.content.Context, int);
|
||||
method public void start() throws java.lang.IllegalStateException;
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import android.content.res.CompatibilityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.IBinder;
|
||||
import android.os.LocalPowerManager;
|
||||
import android.view.animation.Animation;
|
||||
@@ -165,7 +166,7 @@ public interface WindowManagerPolicy {
|
||||
*
|
||||
* @return Rect The rectangle holding the shown window frame.
|
||||
*/
|
||||
public Rect getShownFrameLw();
|
||||
public RectF getShownFrameLw();
|
||||
|
||||
/**
|
||||
* Retrieve the frame of the display that this window was last
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.graphics;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.FloatMath;
|
||||
@@ -81,7 +83,36 @@ public class RectF implements Parcelable {
|
||||
return "RectF(" + left + ", " + top + ", "
|
||||
+ right + ", " + bottom + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representation of the rectangle in a compact form.
|
||||
*/
|
||||
public String toShortString() {
|
||||
return toShortString(new StringBuilder(32));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representation of the rectangle in a compact form.
|
||||
* @hide
|
||||
*/
|
||||
public String toShortString(StringBuilder sb) {
|
||||
sb.setLength(0);
|
||||
sb.append('['); sb.append(left); sb.append(',');
|
||||
sb.append(top); sb.append("]["); sb.append(right);
|
||||
sb.append(','); sb.append(bottom); sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print short representation to given writer.
|
||||
* @hide
|
||||
*/
|
||||
public void printShortString(PrintWriter pw) {
|
||||
pw.print('['); pw.print(left); pw.print(',');
|
||||
pw.print(top); pw.print("]["); pw.print(right);
|
||||
pw.print(','); pw.print(bottom); pw.print(']');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the rectangle is empty (left >= right or top >= bottom)
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,7 @@ import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -2263,7 +2264,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
// incorrectly think it does cover it when it doesn't. We'll revisit
|
||||
// this later when we re-do the phone status bar.
|
||||
if (mStatusBar != null && mStatusBar.isVisibleLw()) {
|
||||
Rect rect = new Rect(mStatusBar.getShownFrameLw());
|
||||
RectF rect = new RectF(mStatusBar.getShownFrameLw());
|
||||
for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
|
||||
WindowState w = mStatusBarPanels.get(i);
|
||||
if (w.isVisibleLw()) {
|
||||
|
||||
@@ -51,8 +51,8 @@ public class BlackFrame {
|
||||
mTmpMatrix.setTranslate(left, top);
|
||||
mTmpMatrix.postConcat(matrix);
|
||||
mTmpMatrix.getValues(mTmpFloats);
|
||||
surface.setPosition((int)mTmpFloats[Matrix.MTRANS_X],
|
||||
(int)mTmpFloats[Matrix.MTRANS_Y]);
|
||||
surface.setPosition(mTmpFloats[Matrix.MTRANS_X],
|
||||
mTmpFloats[Matrix.MTRANS_Y]);
|
||||
surface.setMatrix(
|
||||
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
|
||||
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
|
||||
|
||||
@@ -273,7 +273,7 @@ class DragState {
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, ">>> OPEN TRANSACTION notifyMoveLw");
|
||||
Surface.openTransaction();
|
||||
try {
|
||||
mSurface.setPosition((int)(x - mThumbOffsetX), (int)(y - mThumbOffsetY));
|
||||
mSurface.setPosition(x - mThumbOffsetX, y - mThumbOffsetY);
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DRAG "
|
||||
+ mSurface + ": pos=(" +
|
||||
(int)(x - mThumbOffsetX) + "," + (int)(y - mThumbOffsetY) + ")");
|
||||
|
||||
@@ -148,8 +148,8 @@ class ScreenRotationAnimation {
|
||||
void setSnapshotTransform(Matrix matrix, float alpha) {
|
||||
if (mSurface != null) {
|
||||
matrix.getValues(mTmpFloats);
|
||||
mSurface.setPosition((int)mTmpFloats[Matrix.MTRANS_X],
|
||||
(int)mTmpFloats[Matrix.MTRANS_Y]);
|
||||
mSurface.setPosition(mTmpFloats[Matrix.MTRANS_X],
|
||||
mTmpFloats[Matrix.MTRANS_Y]);
|
||||
mSurface.setMatrix(
|
||||
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
|
||||
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
|
||||
|
||||
@@ -281,8 +281,8 @@ final class Session extends IWindowSession.Stub
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, ">>> OPEN TRANSACTION performDrag");
|
||||
Surface.openTransaction();
|
||||
try {
|
||||
surface.setPosition((int)(touchX - thumbCenterX),
|
||||
(int)(touchY - thumbCenterY));
|
||||
surface.setPosition(touchX - thumbCenterX,
|
||||
touchY - thumbCenterY);
|
||||
surface.setAlpha(.7071f);
|
||||
surface.setLayer(mService.mDragState.getDragLayerLw());
|
||||
surface.show();
|
||||
|
||||
@@ -8455,8 +8455,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
+ Integer.toHexString(diff));
|
||||
}
|
||||
win.mConfiguration = mCurConfiguration;
|
||||
win.mClient.resized(win.mSurfaceW, win.mSurfaceH, win.mLastContentInsets,
|
||||
win.mLastVisibleInsets, win.mDrawPending,
|
||||
win.mClient.resized((int)win.mSurfaceW, (int)win.mSurfaceH,
|
||||
win.mLastContentInsets, win.mLastVisibleInsets, win.mDrawPending,
|
||||
configChanged ? win.mConfiguration : null);
|
||||
win.mContentInsetsChanged = false;
|
||||
win.mVisibleInsetsChanged = false;
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.content.res.Configuration;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -110,7 +111,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
* are in the screen's coordinate space (WITH the compatibility scale
|
||||
* applied).
|
||||
*/
|
||||
final Rect mShownFrame = new Rect();
|
||||
final RectF mShownFrame = new RectF();
|
||||
|
||||
/**
|
||||
* Set when we have changed the size of the surface, to know that
|
||||
@@ -267,7 +268,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
|
||||
// For debugging, this is the last information given to the surface flinger.
|
||||
boolean mSurfaceShown;
|
||||
int mSurfaceX, mSurfaceY, mSurfaceW, mSurfaceH;
|
||||
float mSurfaceX, mSurfaceY, mSurfaceW, mSurfaceH;
|
||||
int mSurfaceLayer;
|
||||
float mSurfaceAlpha;
|
||||
|
||||
@@ -518,7 +519,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
return mFrame;
|
||||
}
|
||||
|
||||
public Rect getShownFrameLw() {
|
||||
public RectF getShownFrameLw() {
|
||||
return mShownFrame;
|
||||
}
|
||||
|
||||
@@ -1128,8 +1129,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
mDtDx = tmpFloats[Matrix.MSKEW_Y];
|
||||
mDsDy = tmpFloats[Matrix.MSKEW_X];
|
||||
mDtDy = tmpFloats[Matrix.MSCALE_Y];
|
||||
int x = (int)tmpFloats[Matrix.MTRANS_X];
|
||||
int y = (int)tmpFloats[Matrix.MTRANS_Y];
|
||||
float x = tmpFloats[Matrix.MTRANS_X];
|
||||
float y = tmpFloats[Matrix.MTRANS_Y];
|
||||
int w = frame.width();
|
||||
int h = frame.height();
|
||||
mShownFrame.set(x, y, x+w, y+h);
|
||||
|
||||
Reference in New Issue
Block a user