summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-01-23 22:12:39 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-23 22:12:39 -0800
commit582a3944f704d7fde660126ef92cf4736c734ac2 (patch)
treedbe4327fe1e38f0f242987e461e0a52b4a5820b4
parent77ddb0262094e0d30d50572e7b1a76d7b5977f46 (diff)
parent033f63a1a5e8f768a72a11561fe70957eb44fa3e (diff)
downloadframeworks_base-582a3944f704d7fde660126ef92cf4736c734ac2.zip
frameworks_base-582a3944f704d7fde660126ef92cf4736c734ac2.tar.gz
frameworks_base-582a3944f704d7fde660126ef92cf4736c734ac2.tar.bz2
Merge "Fix a regression in the wallpaper drawing." into honeycomb
-rw-r--r--core/java/com/android/internal/service/wallpaper/ImageWallpaper.java49
1 files changed, 26 insertions, 23 deletions
diff --git a/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java b/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
index d49902e..78688ee 100644
--- a/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
+++ b/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
@@ -187,33 +187,36 @@ public class ImageWallpaper extends WallpaperService {
}
SurfaceHolder sh = getSurfaceHolder();
+ final Rect frame = sh.getSurfaceFrame();
+ final Drawable background = mBackground;
+ final int dw = frame.width();
+ final int dh = frame.height();
+ final int bw = background != null ? background.getIntrinsicWidth() : 0;
+ final int bh = background != null ? background.getIntrinsicHeight() : 0;
+ final int availw = dw - bw;
+ final int availh = dh - bh;
+ int xPixels = availw < 0 ? (int)(availw * mXOffset + .5f) : (availw / 2);
+ int yPixels = availh < 0 ? (int)(availh * mYOffset + .5f) : (availh / 2);
+
+ mOffsetsChanged = false;
+ if (!mRedrawNeeded
+ && xPixels == mLastXTranslation && yPixels == mLastYTranslation) {
+ if (DEBUG) {
+ Log.d(TAG, "Suppressed drawFrame since the image has not "
+ + "actually moved an integral number of pixels.");
+ }
+ return;
+ }
+ mRedrawNeeded = false;
+ mLastXTranslation = xPixels;
+ mLastYTranslation = yPixels;
+
Canvas c = sh.lockCanvas();
if (c != null) {
try {
- final Rect frame = sh.getSurfaceFrame();
- final Drawable background = mBackground;
- final int dw = frame.width();
- final int dh = frame.height();
- final int bw = background != null ? background.getIntrinsicWidth() : 0;
- final int bh = background != null ? background.getIntrinsicHeight() : 0;
- final int availw = dw-bw;
- final int availh = dh-bh;
- int xPixels = availw < 0 ? (int)(availw*mXOffset+.5f) : (availw/2);
- int yPixels = availh < 0 ? (int)(availh*mYOffset+.5f) : (availh/2);
-
- mOffsetsChanged = false;
- if (!mRedrawNeeded) {
- if (xPixels == mLastXTranslation && yPixels == mLastYTranslation) {
- if (DEBUG) {
- Log.d(TAG, "Suppressed drawFrame since the image has not "
- + "actually moved an integral number of pixels.");
- }
- return;
- }
+ if (DEBUG) {
+ Log.d(TAG, "Redrawing: xPixels=" + xPixels + ", yPixels=" + yPixels);
}
- mRedrawNeeded = false;
- mLastXTranslation = xPixels;
- mLastYTranslation = yPixels;
c.translate(xPixels, yPixels);
if (availw < 0 || availh < 0) {