-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
ShadowThreadedRenderer.java
37 lines (31 loc) · 1.12 KB
/
ShadowThreadedRenderer.java
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
package org.robolectric.shadows;
import static android.os.Build.VERSION_CODES.O;
import static android.os.Build.VERSION_CODES.P;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadow.api.Shadow;
@Implements(
className = "android.view.ThreadedRenderer",
isInAndroidSdk = false,
looseSignatures = true,
minSdk = O,
maxSdk = P)
public class ShadowThreadedRenderer {
@Implementation
protected static Bitmap createHardwareBitmap(
/*RenderNode*/ Object node, /*int*/ Object width, /*int*/ Object height) {
return createHardwareBitmap((int) width, (int) height);
}
private static Bitmap createHardwareBitmap(int width, int height) {
Bitmap bitmap = Bitmap.createBitmap(width, height, Config.HARDWARE);
ShadowBitmap shadowBitmap = Shadow.extract(bitmap);
shadowBitmap.setMutable(false);
return bitmap;
}
@Implementation
protected static long nCreateTextureLayer(long nativeProxy) {
return ShadowVirtualRefBasePtr.put(nativeProxy);
}
}