am 582a3944: Merge "Fix a regression in the wallpaper drawing." into honeycomb

* commit '582a3944f704d7fde660126ef92cf4736c734ac2':
  Fix a regression in the wallpaper drawing.
This commit is contained in:
Dianne Hackborn
2011-01-23 23:38:05 -08:00
committed by Android Git Automerger

View File

@@ -187,9 +187,6 @@ public class ImageWallpaper extends WallpaperService {
} }
SurfaceHolder sh = getSurfaceHolder(); SurfaceHolder sh = getSurfaceHolder();
Canvas c = sh.lockCanvas();
if (c != null) {
try {
final Rect frame = sh.getSurfaceFrame(); final Rect frame = sh.getSurfaceFrame();
final Drawable background = mBackground; final Drawable background = mBackground;
final int dw = frame.width(); final int dw = frame.width();
@@ -202,19 +199,25 @@ public class ImageWallpaper extends WallpaperService {
int yPixels = availh < 0 ? (int)(availh * mYOffset + .5f) : (availh / 2); int yPixels = availh < 0 ? (int)(availh * mYOffset + .5f) : (availh / 2);
mOffsetsChanged = false; mOffsetsChanged = false;
if (!mRedrawNeeded) { if (!mRedrawNeeded
if (xPixels == mLastXTranslation && yPixels == mLastYTranslation) { && xPixels == mLastXTranslation && yPixels == mLastYTranslation) {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "Suppressed drawFrame since the image has not " Log.d(TAG, "Suppressed drawFrame since the image has not "
+ "actually moved an integral number of pixels."); + "actually moved an integral number of pixels.");
} }
return; return;
} }
}
mRedrawNeeded = false; mRedrawNeeded = false;
mLastXTranslation = xPixels; mLastXTranslation = xPixels;
mLastYTranslation = yPixels; mLastYTranslation = yPixels;
Canvas c = sh.lockCanvas();
if (c != null) {
try {
if (DEBUG) {
Log.d(TAG, "Redrawing: xPixels=" + xPixels + ", yPixels=" + yPixels);
}
c.translate(xPixels, yPixels); c.translate(xPixels, yPixels);
if (availw < 0 || availh < 0) { if (availw < 0 || availh < 0) {
c.save(Canvas.CLIP_SAVE_FLAG); c.save(Canvas.CLIP_SAVE_FLAG);