本文整理汇总了C++中SkImageDecoder::setDynamicCon方法的典型用法代码示例。如果您正苦于以下问题:C++ SkImageDecoder::setDynamicCon方法的具体用法?C++ SkImageDecoder::setDynamicCon怎么用?C++ SkImageDecoder::setDynamicCon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkImageDecoder
的用法示例。
在下文中一共展示了SkImageDecoder::setDynamicCon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doDecode
static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding, jobject options) {
int sampleSize = 1;
int preferSize = 0;
int postproc = 0;
int postprocflag = 0;
#ifdef MTK_IMAGE_DC_SUPPORT
void* dc;
bool dcflag = false;
jint* pdynamicCon = NULL;
jintArray dynamicCon;
jsize size = 0;
#endif
SkImageDecoder::Mode decodeMode = SkImageDecoder::kDecodePixels_Mode;
SkColorType prefColorType = kN32_SkColorType;
bool doDither = true;
bool isMutable = false;
float scale = 1.0f;
bool preferQualityOverSpeed = false;
bool requireUnpremultiplied = false;
jobject javaBitmap = NULL;
if (options != NULL) {
sampleSize = env->GetIntField(options, gOptions_sampleSizeFieldID);
if (optionsJustBounds(env, options)) {
decodeMode = SkImageDecoder::kDecodeBounds_Mode;
}
// initialize these, in case we fail later on
env->SetIntField(options, gOptions_widthFieldID, -1);
env->SetIntField(options, gOptions_heightFieldID, -1);
env->SetObjectField(options, gOptions_mimeFieldID, 0);
jobject jconfig = env->GetObjectField(options, gOptions_configFieldID);
prefColorType = GraphicsJNI::getNativeBitmapColorType(env, jconfig);
isMutable = env->GetBooleanField(options, gOptions_mutableFieldID);
doDither = env->GetBooleanField(options, gOptions_ditherFieldID);
preferQualityOverSpeed = env->GetBooleanField(options,
gOptions_preferQualityOverSpeedFieldID);
requireUnpremultiplied = !env->GetBooleanField(options, gOptions_premultipliedFieldID);
javaBitmap = env->GetObjectField(options, gOptions_bitmapFieldID);
postproc = env->GetBooleanField(options, gOptions_postprocFieldID);
postprocflag = env->GetIntField(options, gOptions_postprocflagFieldID);
#ifdef MTK_IMAGE_DC_SUPPORT
dcflag = env->GetBooleanField(options, gOptions_dynamicConflagFieldID);
dynamicCon = (jintArray)env->GetObjectField(options, gOptions_dynamicConFieldID);
//pdynamicCon = (unsigned int*)env->GetIntArrayElements(dynamicCon, 0);
pdynamicCon = env->GetIntArrayElements(dynamicCon, NULL);
size = env->GetArrayLength(dynamicCon);
//for (int i=0; i<size; i++)
//{
//ALOGD("pdynamicCon[%d]=%d", i, pdynamicCon[i]);
//}
//ALOGD("BitmapFactory.cpp postproc=%d, postprocflag=%d", postproc, postprocflag);
//ALOGD("BitmapFactory.cpp dcflag=%d", dcflag);
//ALOGD("BitmapFactory.cpp dynamicCon=%p", dynamicCon);
//ALOGD("BitmapFactory.cpp size=%d", size);
#endif
if (env->GetBooleanField(options, gOptions_scaledFieldID)) {
const int density = env->GetIntField(options, gOptions_densityFieldID);
const int targetDensity = env->GetIntField(options, gOptions_targetDensityFieldID);
const int screenDensity = env->GetIntField(options, gOptions_screenDensityFieldID);
if (density != 0 && targetDensity != 0 && density != screenDensity) {
scale = (float) targetDensity / density;
}
}
}
const bool willScale = scale != 1.0f;
SkImageDecoder* decoder = SkImageDecoder::Factory(stream);
if (decoder == NULL) {
return nullObjectReturn("SkImageDecoder::Factory returned null");
}
decoder->setSampleSize(sampleSize);
decoder->setDitherImage(doDither);
decoder->setPreferQualityOverSpeed(preferQualityOverSpeed);
decoder->setRequireUnpremultipliedColors(requireUnpremultiplied);
decoder->setPreferSize(preferSize);
decoder->setPostProcFlag((postproc | (postprocflag << 4)));
#ifdef MTK_IMAGE_DC_SUPPORT
if (dcflag == true) {
dc= (void*)pdynamicCon;
int len = (int)size;
decoder->setDynamicCon(dc, len);
} else {
dc = NULL;
decoder->setDynamicCon(dc, 0);
}
// (env)->ReleaseIntArrayElements(dynamicCon, pdynamicCon, 0);
#endif
//.........这里部分代码省略.........