1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package org.robolectric.shadows;
import static android.os.Build.VERSION_CODES.O;
import static android.os.Build.VERSION_CODES.S;
import android.graphics.RenderEffect;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.nativeruntime.DefaultNativeRuntimeLoader;
import org.robolectric.nativeruntime.RenderEffectNatives;
import org.robolectric.shadows.ShadowNativeRenderEffect.Picker;
import org.robolectric.versioning.AndroidVersions.U;
/** Shadow for {@link RenderEffect} that is backed by native code */
@Implements(
value = RenderEffect.class,
minSdk = O,
shadowPicker = Picker.class,
callNativeMethodsByDefault = true)
public class ShadowNativeRenderEffect {
static {
DefaultNativeRuntimeLoader.injectAndLoad();
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeCreateOffsetEffect(float offsetX, float offsetY, long nativeInput) {
return RenderEffectNatives.nativeCreateOffsetEffect(offsetX, offsetY, nativeInput);
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeCreateBlurEffect(
float radiusX, float radiusY, long nativeInput, int edgeTreatment) {
return RenderEffectNatives.nativeCreateBlurEffect(radiusX, radiusY, nativeInput, edgeTreatment);
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeCreateBitmapEffect(
long bitmapHandle,
float srcLeft,
float srcTop,
float srcRight,
float srcBottom,
float dstLeft,
float dstTop,
float dstRight,
float dstBottom) {
return RenderEffectNatives.nativeCreateBitmapEffect(
bitmapHandle, srcLeft, srcTop, srcRight, srcBottom, dstLeft, dstTop, dstRight, dstBottom);
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeCreateColorFilterEffect(long colorFilter, long nativeInput) {
return RenderEffectNatives.nativeCreateColorFilterEffect(colorFilter, nativeInput);
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeCreateBlendModeEffect(long dst, long src, int blendmode) {
return RenderEffectNatives.nativeCreateBlendModeEffect(dst, src, blendmode);
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeCreateChainEffect(long outer, long inner) {
return RenderEffectNatives.nativeCreateChainEffect(outer, inner);
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeCreateShaderEffect(long shader) {
return RenderEffectNatives.nativeCreateShaderEffect(shader);
}
@Implementation(minSdk = S, maxSdk = U.SDK_INT)
protected static long nativeGetFinalizer() {
return RenderEffectNatives.nativeGetFinalizer();
}
/** Shadow picker for {@link RenderEffect}. */
public static final class Picker extends GraphicsShadowPicker<Object> {
public Picker() {
super(null, ShadowNativeRenderEffect.class);
}
}
}
|