修正由于图片宽度而导致的错位
This commit is contained in:
1 parent
007330112e
commit
d08598ab71
4 files changed
+14
-1
No files matched your search
@@ -436,6 +436,7 @@ jobject GIF_DecodeStream(JNIEnv* env, jobject is, jint format) {
|
||||
GIF* gif;
|
||||
int slurp, imageCount;
|
||||
int* delays;
|
||||
int realWidth;
|
||||
|
||||
// GIF not
|
||||
sc = getStreamContainer(env, is);
|
||||
@@ -449,6 +450,11 @@ jobject GIF_DecodeStream(JNIEnv* env, jobject is, jint format) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Fix width, for not RGBA, but I will tell others the real width
|
||||
realWidth = gifFile->SWidth;
|
||||
if (format != GL_RGBA)
|
||||
gifFile->SWidth = nextMulOf4(realWidth);
|
||||
|
||||
// Slurp
|
||||
slurp = DGifSlurp(gifFile);
|
||||
// Free container
|
||||
@@ -489,7 +495,7 @@ jobject GIF_DecodeStream(JNIEnv* env, jobject is, jint format) {
|
||||
return NULL;
|
||||
else
|
||||
return (*env)->NewObject(env, gifClazz, constructor, (jint) gif,
|
||||
FORMAT_GIF, gifFile->SWidth, gifFile->SHeight, format,
|
||||
FORMAT_GIF, realWidth, gifFile->SHeight, format,
|
||||
DEFAULT_TYPE, delayArray);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include "image.h"
|
||||
#include "utils.h"
|
||||
|
||||
int nextMulOf4(int x) {
|
||||
return (x + 3) / 4 * 4;
|
||||
}
|
||||
|
||||
byte getVFrowRGB(byte r, byte g, byte b) {
|
||||
byte t = g > b ? g : b;
|
||||
return r > t ? r : t;
|
||||
|
||||
@@ -11,6 +11,8 @@ typedef struct {
|
||||
jbyteArray buffer;
|
||||
} StreamContainer;
|
||||
|
||||
int nextMulOf4(int x);
|
||||
|
||||
void eraseRGB(rgb* pixels, int num, rgb color);
|
||||
void eraseRGBA(rgba* pixels, int num, rgba color);
|
||||
void eraseLUM(lum* pixels, int num, lum color);
|
||||
|
||||
@@ -174,6 +174,7 @@ public final class Utils {
|
||||
}.start();
|
||||
}
|
||||
|
||||
// TODO
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
public static int getDate() {
|
||||
int time = 0;
|
||||
|
||||
Reference in new issue
Block a user