Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #756 from tipa/glide-additions
Browse files Browse the repository at this point in the history
Add DontAnimate & DontTransform to RequestOptions & RequestBuilder
  • Loading branch information
moljac authored Jun 29, 2023
2 parents 32cfc73 + 07ea1c7 commit 70755d4
Showing 1 changed file with 79 additions and 71 deletions.
150 changes: 79 additions & 71 deletions source/com.github.bumptech.glide/glide/Additions/Additions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ public partial class RequestBuilder
public virtual RequestBuilder Decode(Class resourceClass) => (RequestBuilder)Decode_T(resourceClass);

public virtual RequestBuilder DisallowHardwareConfig() => (RequestBuilder)DisallowHardwareConfig_T();

public virtual RequestBuilder Downsample(DownsampleStrategy strategy) => (RequestBuilder)Downsample_T(strategy);

public virtual RequestBuilder DontAnimate(RequestBuilder strategy) => (RequestBuilder)DontAnimate_T(strategy);

public virtual RequestBuilder DontTransform(RequestBuilder strategy) => (RequestBuilder)DontTransform_T(strategy);

public virtual RequestBuilder EncodeFormat(Bitmap.CompressFormat format) => (RequestBuilder)EncodeFormat_T(format);

public virtual RequestBuilder EncodeQuality(int quality) => (RequestBuilder)EncodeQuality_T(quality);

public virtual RequestBuilder Error(Drawable drawable) => (RequestBuilder)Error_T(drawable);

public virtual RequestBuilder Error(int resourceId) => (RequestBuilder)Error_T(resourceId);
Expand All @@ -57,7 +61,7 @@ public partial class RequestBuilder
public virtual RequestBuilder Frame(long frameTimeMicros) => (RequestBuilder)Frame_T(frameTimeMicros);

public virtual RequestBuilder Lock() => (RequestBuilder)Lock_T();

public virtual RequestBuilder OptionalCenterCrop() => (RequestBuilder)OptionalCenterCrop_T();

public virtual RequestBuilder OptionalCenterInside() => (RequestBuilder)OptionalCenterInside_T();
Expand All @@ -77,7 +81,7 @@ public partial class RequestBuilder
public virtual RequestBuilder Placeholder(Drawable drawable) => (RequestBuilder)Placeholder_T(drawable);

public virtual RequestBuilder Placeholder(int resourceId) => (RequestBuilder)Placeholder_T(resourceId);

public virtual RequestBuilder Set(Option option, Object value) => (RequestBuilder)Set_T(option, value);

public virtual RequestBuilder SetDiskCacheStrategy(DiskCacheStrategy strategy) => (RequestBuilder)DiskCacheStrategy_T(strategy);
Expand Down Expand Up @@ -118,66 +122,66 @@ public partial class AssetFileDescriptorLocalUriFetcher
}

public partial class FileDescriptorAssetPathFetcher
{
{
protected override void Close(Object data) => Close((ParcelFileDescriptor)data);

protected override Object LoadResource(AssetManager assetManager, string path) => LoadResource_T(assetManager, path);
}

public partial class FileDescriptorLocalUriFetcher
{
protected override void Close(Object data) => Close((ParcelFileDescriptor)data);
public partial class FileDescriptorLocalUriFetcher
{
protected override void Close(Object data) => Close((ParcelFileDescriptor)data);

protected override Object LoadResource(Uri uri, ContentResolver contentResolver) => LoadResource_T(uri, contentResolver);
}

public partial class StreamAssetPathFetcher
{
protected override void Close(Object data)
{
protected override void Close(Object data)
{
var stream = InputStreamInvoker.FromJniHandle(((InputStream)data).Handle, JniHandleOwnership.DoNotTransfer);

Close(stream);
}

protected override Object LoadResource(AssetManager assetManager, string path)
{
var handle = InputStreamAdapter.ToLocalJniHandle(LoadResource_T(assetManager, path));

try
{
return new Object(handle, JniHandleOwnership.TransferLocalRef);
}
finally
{
JNIEnv.DeleteLocalRef(handle);
}
}
}
{
var handle = InputStreamAdapter.ToLocalJniHandle(LoadResource_T(assetManager, path));

try
{
return new Object(handle, JniHandleOwnership.TransferLocalRef);
}
finally
{
JNIEnv.DeleteLocalRef(handle);
}
}
}

public partial class StreamLocalUriFetcher
{
protected override void Close(Object data)
{
protected override void Close(Object data)
{
var stream = InputStreamInvoker.FromJniHandle(((InputStream)data).Handle, JniHandleOwnership.DoNotTransfer);

Close(stream);
}

protected override Object LoadResource(Uri uri, ContentResolver contentResolver)
{
var handle = InputStreamAdapter.ToLocalJniHandle(LoadResource_T(uri, contentResolver));

try
{
return new Object(handle, JniHandleOwnership.TransferLocalRef);
}
finally
{
JNIEnv.DeleteLocalRef(handle);
}
}
}
{
var handle = InputStreamAdapter.ToLocalJniHandle(LoadResource_T(uri, contentResolver));

try
{
return new Object(handle, JniHandleOwnership.TransferLocalRef);
}
finally
{
JNIEnv.DeleteLocalRef(handle);
}
}
}
}

namespace Bumptech.Glide.Load.Engine.Executor
Expand All @@ -196,32 +200,32 @@ public partial class GlideExecutor

namespace Bumptech.Glide.Load.Model
{
public partial class AssetUriLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
public partial class AssetUriLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
BuildLoadData((Uri)model, width, height, options);

public virtual bool Handles(Object model) => Handles((Uri)model);
}

public partial class ByteArrayLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
BuildLoadData(model?.ToArray<byte>(), width, height, options);

public virtual bool Handles(Object model) => Handles(model?.ToArray<byte>());
}

public partial class StringLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
public partial class StringLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
BuildLoadData(model?.ToString(), width, height, options);

public virtual bool Handles(Object model) => Handles(model?.ToString());
}
public partial class FileLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
BuildLoadData((File)model, width, height, options);

public virtual bool Handles(Object model) => Handles((File)model);
Expand All @@ -236,16 +240,16 @@ public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int he
}

public partial class UriLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
BuildLoadData((Uri)model, width, height, options);

public virtual bool Handles(Object model) => Handles((Uri)model);
}

public partial class UrlUriLoader
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
{
public virtual ModelLoaderLoadData BuildLoadData(Object model, int width, int height, Options options) =>
BuildLoadData((Uri)model, width, height, options);

public virtual bool Handles(Object model) => Handles((Uri)model);
Expand Down Expand Up @@ -280,40 +284,40 @@ public bool Handles(Object source, Options options)
namespace Bumptech.Glide.Load.Resource.Gif
{
public partial class GifDrawableEncoder
{
{
public virtual unsafe bool Encode(Object data, global::Java.IO.File file, global::Bumptech.Glide.Load.Options options)
=> Encode((IResource)data, file, options);
}
}

namespace Bumptech.Glide.Load.Resource.Bitmap
{
public partial class BitmapDrawableEncoder
{
public virtual bool Encode(Object data, Java.IO.File file, Options options) => Encode((IResource)data, file, options);
public partial class BitmapDrawableEncoder
{
public virtual bool Encode(Object data, Java.IO.File file, Options options) => Encode((IResource)data, file, options);
}

public partial class BitmapEncoder
{
public virtual bool Encode(Object data, Java.IO.File file, Options options) => Encode((IResource)data, file, options);
{
public virtual bool Encode(Object data, Java.IO.File file, Options options) => Encode((IResource)data, file, options);
}

public partial class StreamBitmapDecoder : IResourceDecoder
{
IResource IResourceDecoder.Decode(Object source, int width, int height, Options options)
{
var stream = InputStreamInvoker.FromJniHandle(source.Handle, JniHandleOwnership.DoNotTransfer);
{
IResource IResourceDecoder.Decode(Object source, int width, int height, Options options)
{
var stream = InputStreamInvoker.FromJniHandle(source.Handle, JniHandleOwnership.DoNotTransfer);

return Decode(stream, width, height, options);
}
return Decode(stream, width, height, options);
}

bool IResourceDecoder.Handles(Object source, Options options)
{
var stream = InputStreamInvoker.FromJniHandle(source.Handle, JniHandleOwnership.DoNotTransfer);
bool IResourceDecoder.Handles(Object source, Options options)
{
var stream = InputStreamInvoker.FromJniHandle(source.Handle, JniHandleOwnership.DoNotTransfer);

return Handles(stream, options);
}
}
return Handles(stream, options);
}
}
}

namespace Bumptech.Glide.Request
Expand All @@ -336,12 +340,16 @@ public partial class RequestOptions

public virtual RequestOptions DisallowHardwareConfig() => (RequestOptions)DisallowHardwareConfig_T();

public virtual RequestOptions DontAnimate() => (RequestOptions)DontAnimate_T();

public virtual RequestOptions DontTransform() => (RequestOptions)DontTransform_T();

public virtual RequestOptions Downsample(DownsampleStrategy strategy) => (RequestOptions)Downsample_T(strategy);

public virtual RequestOptions EncodeFormat(Bitmap.CompressFormat format) => (RequestOptions)EncodeFormat_T(format);

public virtual RequestOptions EncodeQuality(int quality) => (RequestOptions)EncodeQuality_T(quality);

public virtual RequestBuilder Error(Drawable drawable) => (RequestBuilder)Error_T(drawable);

public virtual RequestOptions Error(int resourceId) => (RequestOptions)Error_T(resourceId);
Expand Down

0 comments on commit 70755d4

Please sign in to comment.