EINA_SAFETY_ON_NULL_RETURN_VAL(tsurface, NULL);
tbm_surface_map(tsurface, TBM_SURF_OPTION_READ, &src_info);
- tbm_surface_unmap(tsurface);
EINA_SAFETY_ON_NULL_RETURN_VAL(src_info.planes[0].ptr, NULL);
new_tsurface = tbm_surface_create(src_info.width, src_info.height, src_info.format);
-
tbm_surface_map(new_tsurface, TBM_SURF_OPTION_WRITE, &dst_info);
- tbm_surface_unmap(new_tsurface);
- EINA_SAFETY_ON_NULL_RETURN_VAL(dst_info.planes[0].ptr, NULL);
+ if (!dst_info.planes[0].ptr)
+ {
+ tbm_surface_unmap(tsurface);
+ return NULL;
+ }
/* copy from src to dst */
#if HAVE_MEMCPY_SWC
memcpy(dst_info.planes[0].ptr, src_info.planes[0].ptr, src_info.planes[0].size);
#endif
+ tbm_surface_unmap(new_tsurface);
+ tbm_surface_unmap(tsurface);
+
return new_tsurface;
}