static jobject movie_gifFrameBitmap(JNIEnv* env, jobject movie, int frameIndex) { NPE_CHECK_RETURN_ZERO(env, movie); SkMovie* m = J2Movie(env, movie); int averTimePoint = 0; int frameDuration = 0; int frameCount = m->getGifTotalFrameCount(); if (frameIndex < 0 && frameIndex >= frameCount ) return NULL; m->setCurrFrame(frameIndex); //then we get frameIndex Bitmap (the current frame of movie is frameIndex now) SkBitmap *createdBitmap = m->createGifFrameBitmap(); if (createdBitmap != NULL) { return GraphicsJNI::createBitmap(env, createdBitmap, false, NULL); } else { return NULL; } }
static int movie_gifTotalFrameCount(JNIEnv* env, jobject movie) { NPE_CHECK_RETURN_ZERO(env, movie); SkMovie* m = J2Movie(env, movie); //LOGE("Movie:movie_gifTotalFrameCount: frame count %d", m->getGifTotalFrameCount()); return m->getGifTotalFrameCount(); }