Update freebitmap and rename some c func

This commit is contained in:
vCaesar 2017-06-29 23:06:25 +08:00
parent fd894c06cb
commit 44578aad48
2 changed files with 7 additions and 6 deletions

View File

@ -77,7 +77,7 @@ MMPoint aFindBitmap(MMBitmapRef bit_map, MMRect rect){
return point; return point;
} }
MMBitmapRef aOpenBitmap(char *path, uint16_t ttype){ MMBitmapRef bitmap_open(char *path, uint16_t ttype){
// MMImageType type; // MMImageType type;
MMBitmapRef bitmap; MMBitmapRef bitmap;
@ -89,7 +89,7 @@ MMBitmapRef aOpenBitmap(char *path, uint16_t ttype){
} }
char *aSaveBitmap(MMBitmapRef bitmap, char *path, uint16_t type){ char *bitmap_save(MMBitmapRef bitmap, char *path, uint16_t type){
if (saveMMBitmapToFile(bitmap, path, (MMImageType) type) != 0) { if (saveMMBitmapToFile(bitmap, path, (MMImageType) type) != 0) {
return "Could not save image to file."; return "Could not save image to file.";
}else{ }else{

View File

@ -589,7 +589,7 @@ func OpenBitmap(args ...interface{}) C.MMBitmapRef {
// fmt.Println("err:::", e) // fmt.Println("err:::", e)
mtype = 1 mtype = 1
}) })
bit := C.aOpenBitmap(path, mtype) bit := C.bitmap_open(path, mtype)
defer C.free(unsafe.Pointer(path)) defer C.free(unsafe.Pointer(path))
// fmt.Println("opening...", bit) // fmt.Println("opening...", bit)
return bit return bit
@ -607,7 +607,7 @@ func SaveBitmap(args ...interface{}) string {
}) })
path := C.CString(args[1].(string)) path := C.CString(args[1].(string))
savebit := C.aSaveBitmap(args[0].(C.MMBitmapRef), path, mtype) savebit := C.bitmap_save(args[0].(C.MMBitmapRef), path, mtype)
// fmt.Println("saved...", savebit) // fmt.Println("saved...", savebit)
// return bit // return bit
defer C.free(unsafe.Pointer(path)) defer C.free(unsafe.Pointer(path))
@ -662,8 +662,9 @@ func Convert(args ...interface{}) {
} }
// FreeBitmap free and dealloc bitmap // FreeBitmap free and dealloc bitmap
func FreeBitmap(ref C.MMBitmapRef) { func FreeBitmap(bitmap C.MMBitmapRef) {
C.destroyMMBitmap(ref) // C.destroyMMBitmap(bitmap)
C.bitmap_dealloc(bitmap)
} }
// ReadBitmap returns false and sets error if |bitmap| is NULL // ReadBitmap returns false and sets error if |bitmap| is NULL