diff options
Diffstat (limited to 'src/com/android/wallpaper/asset/Asset.java')
-rwxr-xr-x | src/com/android/wallpaper/asset/Asset.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/com/android/wallpaper/asset/Asset.java b/src/com/android/wallpaper/asset/Asset.java index dc4a5e6..0b87084 100755 --- a/src/com/android/wallpaper/asset/Asset.java +++ b/src/com/android/wallpaper/asset/Asset.java @@ -32,6 +32,7 @@ import android.view.View; import android.widget.ImageView; import androidx.annotation.Nullable; +import androidx.annotation.WorkerThread; import com.android.wallpaper.module.BitmapCropper; import com.android.wallpaper.module.InjectorProvider; @@ -82,16 +83,16 @@ public abstract class Asset { /** * Decodes and downscales a bitmap region off the main UI thread. - * * @param rect Rect representing the crop region in terms of the original image's * resolution. * @param targetWidth Width of target view in physical pixels. * @param targetHeight Height of target view in physical pixels. + * @param shouldAdjustForRtl whether the region selected should be adjusted for RTL (that is, + * the crop region will be considered starting from the right) * @param receiver Called with the decoded bitmap region or null if there was an error - * decoding the bitmap region. */ public abstract void decodeBitmapRegion(Rect rect, int targetWidth, int targetHeight, - BitmapReceiver receiver); + boolean shouldAdjustForRtl, BitmapReceiver receiver); /** * Calculates the raw dimensions of the asset at its original resolution off the main UI thread. @@ -127,6 +128,17 @@ public abstract class Asset { } /** + * Returns a Bitmap from the separate low resolution data source (if there is one) or + * {@code null} otherwise. + * This could be an I/O operation so DO NOT CALL ON UI THREAD + */ + @WorkerThread + @Nullable + public Bitmap getLowResBitmap(Context context) { + return null; + } + + /** * Returns whether the asset supports rendering tile regions at varying pixel densities. */ public abstract boolean supportsTiling(); @@ -283,6 +295,7 @@ public abstract class Asset { BitmapCropper bitmapCropper = InjectorProvider.getInjector().getBitmapCropper(); bitmapCropper.cropAndScaleBitmap(this, /* scale= */ 1f, visibleRawWallpaperRect, + WallpaperCropUtils.isRtl(activity), new BitmapCropper.Callback() { @Override public void onBitmapCropped(Bitmap croppedBitmap) { |