blob: 30faaa1dbff4683ba11422f9d1605d4484f23179 [file] [log] [blame]
/*
* Copyright 2021 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <jni.h>
#include "include/core/SkSamplingOptions.h"
#include "include/core/SkTileMode.h"
namespace androidkit {
namespace utils {
// RAII helper for jstring -> cstring conversions
class CString {
public:
CString(JNIEnv* env, const jstring& jstr)
: fEnv(env)
, fJString(jstr)
, fCString(env->GetStringUTFChars(jstr, nullptr))
{}
~CString() {
fEnv->ReleaseStringUTFChars(fJString, fCString);
}
operator const char*() const { return fCString; }
private:
JNIEnv* fEnv;
const jstring& fJString;
const char* fCString;
CString(CString&&) = delete;
CString(const CString&) = delete;
CString& operator=(CString&&) = delete;
CString& operator=(const CString&) = delete;
};
SkSamplingOptions SamplingOptions(jint, jfloat, jfloat);
SkTileMode TileMode(jint);
} // namespace utils
} // namespace androidkit