MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getAlphaType

Function getAlphaType

valdi/src/valdi/android/AndroidBitmap.cpp:18–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18static Valdi::AlphaType getAlphaType([[maybe_unused]] int32_t flags) {
19#if defined(__ANDROID_API__) && __ANDROID_API__ >= 30
20 // TODO(simon): The NDK doc doesn't specify whether we should first
21 // shift and mask or the opposite? I was not able to find a code sample of this.
22 // The shift value is currently 0 so it doesn't matter at the moment but it could
23 // later change.
24 auto alphaType = (flags >> ANDROID_BITMAP_FLAGS_ALPHA_SHIFT) & ANDROID_BITMAP_FLAGS_ALPHA_MASK;
25 if (alphaType == ANDROID_BITMAP_FLAGS_ALPHA_PREMUL) {
26 return Valdi::AlphaTypePremul;
27 } else if (alphaType == ANDROID_BITMAP_FLAGS_ALPHA_OPAQUE) {
28 return Valdi::AlphaTypeOpaque;
29 } else if (alphaType == ANDROID_BITMAP_FLAGS_ALPHA_UNPREMUL) {
30 return Valdi::AlphaTypeUnpremul;
31 }
32
33 return Valdi::AlphaTypeOpaque;
34#else
35 return Valdi::AlphaTypePremul;
36#endif
37}
38
39AndroidBitmap::AndroidBitmap(const JavaObject& bitmap) : _bitmap(bitmap, "Bitmap") {}
40

Callers 1

getInfoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected