#include <mutex>
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
#include <jni.h>
#include <sys/stat.h>
#include "include/core/SkStream.h"
#include "include/private/base/SkTo.h"
#include "src/utils/SkOSPath.h"
#include "tools/ResourceFactory.h"
#include "tools/skqp/src/skqp.h"
Go to the source code of this file.
|
JNIEXPORT void JNICALL | Java_org_skia_skqp_SkQP_nInit (JNIEnv *, jobject, jobject, jstring) |
|
JNIEXPORT jobjectArray JNICALL | Java_org_skia_skqp_SkQP_nExecuteUnitTest (JNIEnv *, jobject, jint) |
|
JNIEXPORT void JNICALL | Java_org_skia_skqp_SkQP_nMakeReport (JNIEnv *, jobject) |
|
static sk_sp< SkData > | open_asset_data (const char *path) |
|
static jobjectArray | make_java_string_array (JNIEnv *env, jint arraySize) |
|
static void | set_string_array_element (JNIEnv *env, jobjectArray a, const char *s, unsigned i) |
|
template<typename T , typename F > |
static jobjectArray | to_java_string_array (JNIEnv *env, const std::vector< T > &array, F stringizeFn) |
|
static std::string | to_string (JNIEnv *env, jstring jString) |
|
static const char * | get_sksl_error_name (const SkQP::SkSLErrorTest &t) |
|
static const char * | get_sksl_error_shader_text (const SkQP::SkSLErrorTest &t) |
|
◆ jassert
#define jassert |
( |
|
env, |
|
|
|
cond, |
|
|
|
ret |
|
) |
| |
Value: do { if (!(cond)) { \
(
env)->ThrowNew((
env)->FindClass(
"java/lang/Exception"), \
__FILE__ ": assert(" #cond ") failed."); \
return ret; } } while (0)
Definition at line 83 of file jni_skqp.cpp.
◆ get_sksl_error_name()
◆ get_sksl_error_shader_text()
◆ Java_org_skia_skqp_SkQP_nExecuteUnitTest()
jobjectArray Java_org_skia_skqp_SkQP_nExecuteUnitTest |
( |
JNIEnv * |
env, |
|
|
jobject |
object, |
|
|
jint |
index |
|
) |
| |
Definition at line 164 of file jni_skqp.cpp.
166 {
167 std::vector<std::string>
errors;
168 {
169 std::lock_guard<std::mutex> lock(
gMutex);
172 }
174 return nullptr;
175 }
177 for (
size_t i = 0;
i <
errors.size(); ++
i) {
179 }
180 return (jobjectArray)
env->NewGlobalRef(array);
181}
const std::vector< UnitTest > & getUnitTests() const
std::vector< std::string > executeTest(UnitTest)
static jobjectArray make_java_string_array(JNIEnv *env, jint arraySize)
#define jassert(env, cond, ret)
static void set_string_array_element(JNIEnv *env, jobjectArray a, const char *s, unsigned i)
◆ Java_org_skia_skqp_SkQP_nInit()
void Java_org_skia_skqp_SkQP_nInit |
( |
JNIEnv * |
env, |
|
|
jobject |
object, |
|
|
jobject |
assetManager, |
|
|
jstring |
dataDir |
|
) |
| |
Definition at line 132 of file jni_skqp.cpp.
133 {
134 jclass SkQP_class =
env->GetObjectClass(
object);
135
136
138
140
142
145
146 std::lock_guard<std::mutex> lock(
gMutex);
148
151
152 constexpr char kStringArrayType[] = "[Ljava/lang/String;";
153 env->SetObjectField(
object,
154 env->GetFieldID(SkQP_class,
"mUnitTests", kStringArrayType),
156 env->SetObjectField(
object,
157 env->GetFieldID(SkQP_class,
"mSkSLErrorTestName", kStringArrayType),
159 env->SetObjectField(
object,
160 env->GetFieldID(SkQP_class,
"mSkSLErrorTestShader", kStringArrayType),
162}
sk_sp< SkData >(* gResourceFactory)(const char *)
const std::vector< SkSLErrorTest > & getSkSLErrorTests() const
void init(SkQPAssetManager *assetManager, const char *reportDirectory)
static const char * GetUnitTestName(UnitTest)
static AndroidAssetManager gAndroidAssetManager
static std::string to_string(JNIEnv *env, jstring jString)
static sk_sp< SkData > open_asset_data(const char *path)
static const char * get_sksl_error_shader_text(const SkQP::SkSLErrorTest &t)
static const char * get_sksl_error_name(const SkQP::SkSLErrorTest &t)
static AAssetManager * sAAssetManager
static jobjectArray to_java_string_array(JNIEnv *env, const std::vector< T > &array, F stringizeFn)
◆ Java_org_skia_skqp_SkQP_nMakeReport()
void Java_org_skia_skqp_SkQP_nMakeReport |
( |
JNIEnv * |
, |
|
|
jobject |
|
|
) |
| |
◆ make_java_string_array()
static jobjectArray make_java_string_array |
( |
JNIEnv * |
env, |
|
|
jint |
arraySize |
|
) |
| |
|
static |
Definition at line 90 of file jni_skqp.cpp.
90 {
91 jclass stringClass =
env->FindClass(
"java/lang/String");
93 jobjectArray jarray =
env->NewObjectArray(arraySize, stringClass,
nullptr);
95 return jarray;
96}
◆ open_asset_data()
static sk_sp< SkData > open_asset_data |
( |
const char * |
path | ) |
|
|
static |
Definition at line 32 of file jni_skqp.cpp.
32 {
38 int ret = AAsset_read(asset,
data->writable_data(),
size);
40 SK_ABORT(
"ERROR: AAsset_read != AAsset_getLength (%s)\n",
path);
41 }
42 }
43 AAsset_close(asset);
44 }
45 }
47}
#define SK_ABORT(message,...)
constexpr size_t SkToSizeT(S x)
constexpr int SkToInt(S x)
static sk_sp< SkData > MakeUninitialized(size_t length)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
std::shared_ptr< const fml::Mapping > data
◆ set_string_array_element()
static void set_string_array_element |
( |
JNIEnv * |
env, |
|
|
jobjectArray |
a, |
|
|
const char * |
s, |
|
|
unsigned |
i |
|
) |
| |
|
static |
Definition at line 98 of file jni_skqp.cpp.
98 {
99 jstring jstr =
env->NewStringUTF(
s);
101 env->SetObjectArrayElement(
a, (jsize)
i, jstr);
102 env->DeleteLocalRef(jstr);
103}
◆ to_java_string_array()
template<typename
T , typename
F >
static jobjectArray to_java_string_array |
( |
JNIEnv * |
env, |
|
|
const std::vector< T > & |
array, |
|
|
F |
stringizeFn |
|
) |
| |
|
static |
Definition at line 106 of file jni_skqp.cpp.
108 {
110 for (
size_t i = 0;
i < array.size(); ++
i) {
112 }
113 return jarray;
114}
◆ to_string()
static std::string to_string |
( |
JNIEnv * |
env, |
|
|
jstring |
jString |
|
) |
| |
|
static |
Definition at line 116 of file jni_skqp.cpp.
116 {
117 const char* utf8String =
env->GetStringUTFChars(jString,
nullptr);
118 jassert(
env, utf8String && utf8String[0],
"");
119 std::string sString(utf8String);
120 env->ReleaseStringUTFChars(jString, utf8String);
121 return sString;
122}
◆ gAndroidAssetManager
AndroidAssetManager gAndroidAssetManager |
|
static |
◆ gMutex
◆ gSkQP
◆ sAAssetManager
AAssetManager* sAAssetManager = nullptr |
|
static |