1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

covers from native plugins (in progress)

This commit is contained in:
Nikolay Pultsin 2012-03-27 16:15:33 +01:00
parent 5518e9ef78
commit 79a06410ae
2 changed files with 6 additions and 9 deletions

View file

@ -287,6 +287,6 @@ JNIEXPORT jboolean JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPl
} }
extern "C" extern "C"
JNIEXPORT jobject JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPlugin_readCoverInternal(JNIEnv* env, jobject thiz, jobject file) { JNIEXPORT void JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPlugin_readCoverInternal(JNIEnv* env, jobject thiz, jobject file, jobjectArray box) {
return 0; // TODO: implement
} }

View file

@ -29,8 +29,6 @@ import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.library.Book; import org.geometerplus.fbreader.library.Book;
public class NativeFormatPlugin extends FormatPlugin { public class NativeFormatPlugin extends FormatPlugin {
private static Object ourCoversLock = new Object();
// No free method because all plugins' instances are freed by // No free method because all plugins' instances are freed by
// PluginCollection::deleteInstance method (C++) // PluginCollection::deleteInstance method (C++)
@ -74,15 +72,14 @@ public class NativeFormatPlugin extends FormatPlugin {
@Override @Override
public ZLSingleImage getRealImage() { public ZLSingleImage getRealImage() {
// Synchronized block is needed because we use temporary storage files final ZLImage[] box = new ZLImage[1];
synchronized (ourCoversLock) { readCoverInternal(file, box);
return (ZLSingleImage)readCoverInternal(file); return (ZLSingleImage)box[0];
}
} }
}; };
} }
protected native ZLImage readCoverInternal(ZLFile file); protected native void readCoverInternal(ZLFile file, ZLImage[] box);
/* /*
public static ZLImage createImage(String mimeType, String fileName, int offset, int length) { public static ZLImage createImage(String mimeType, String fileName, int offset, int length) {