mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-17 03:06:41 -07:00
refactor(vips): remove debug statement, add comments
This commit is contained in:
parent
b6bc20df55
commit
6702817185
1 changed files with 5 additions and 6 deletions
11
vips.go
11
vips.go
|
|
@ -76,12 +76,12 @@ func Initialize() {
|
||||||
C.vips_cache_set_max_mem(maxCacheMem)
|
C.vips_cache_set_max_mem(maxCacheMem)
|
||||||
C.vips_cache_set_max(maxCacheSize)
|
C.vips_cache_set_max(maxCacheSize)
|
||||||
|
|
||||||
// Explicit concurrency limit to avoid thread-unsafe issues.
|
// Define a custom libvips thread concurrency limit (this may generate thread-unsafe issues)
|
||||||
// See: https://github.com/jcupitt/libvips/issues/261#issuecomment-92850414
|
// See: https://github.com/jcupitt/libvips/issues/261#issuecomment-92850414
|
||||||
if os.Getenv("VIPS_CONCURRENCY") == "" {
|
if os.Getenv("VIPS_CONCURRENCY") == "" {
|
||||||
C.vips_concurrency_set(1)
|
C.vips_concurrency_set(1)
|
||||||
}
|
}
|
||||||
|
// Enable libvips cache tracing
|
||||||
if os.Getenv("VIPS_TRACE") != "" {
|
if os.Getenv("VIPS_TRACE") != "" {
|
||||||
C.vips_enable_cache_set_trace()
|
C.vips_enable_cache_set_trace()
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +234,6 @@ func vipsSave(image *C.struct__VipsImage, o vipsSaveOptions) ([]byte, error) {
|
||||||
err = C.vips_webpsave_bridge(image, &ptr, &length, 1, C.int(o.Quality), 0)
|
err = C.vips_webpsave_bridge(image, &ptr, &length, 1, C.int(o.Quality), 0)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
debug("Save JPEG options: Q: %s", o.Quality)
|
|
||||||
err = C.vips_jpegsave_bridge(image, &ptr, &length, 1, C.int(o.Quality), 0)
|
err = C.vips_jpegsave_bridge(image, &ptr, &length, 1, C.int(o.Quality), 0)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -306,10 +305,10 @@ func vipsEmbed(input *C.struct__VipsImage, left, top, width, height, extend int)
|
||||||
|
|
||||||
func vipsAffine(input *C.struct__VipsImage, residual float64, i Interpolator) (*C.struct__VipsImage, error) {
|
func vipsAffine(input *C.struct__VipsImage, residual float64, i Interpolator) (*C.struct__VipsImage, error) {
|
||||||
var image *C.struct__VipsImage
|
var image *C.struct__VipsImage
|
||||||
istring := C.CString(i.String())
|
cstring := C.CString(i.String())
|
||||||
interpolator := C.vips_interpolate_new(istring)
|
interpolator := C.vips_interpolate_new(cstring)
|
||||||
|
|
||||||
defer C.free(unsafe.Pointer(istring))
|
defer C.free(unsafe.Pointer(cstring))
|
||||||
defer C.g_object_unref(C.gpointer(input))
|
defer C.g_object_unref(C.gpointer(input))
|
||||||
defer C.g_object_unref(C.gpointer(interpolator))
|
defer C.g_object_unref(C.gpointer(interpolator))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue