**************************************************************************/
#include "config.h"
+
#include "tbm_bufmgr.h"
#include "tbm_bufmgr_int.h"
#include "tbm_surface_internal.h"
int
tbm_surface_query_formats(uint32_t **formats, uint32_t *num)
{
+ TBM_TRACE_SURFACE("\n");
+
if (!tbm_surface_internal_query_supported_formats(formats, num))
- return TBM_SURFACE_ERROR_INVALID_OPERATION;
+ return tbm_get_last_error();
return TBM_SURFACE_ERROR_NONE;
}
tbm_surface_h
tbm_surface_create(int width, int height, tbm_format format)
{
+ TBM_TRACE_SURFACE("width(%d) height(%d)\n", width, height);
+
+ _tbm_set_last_result(TBM_ERROR_NONE);
+
if (!(width > 0) || !(height > 0)) {
#ifdef HAVE_CAPI_0_1_1
set_last_result(TBM_SURFACE_ERROR_INVALID_PARAMETER);
#endif
+ _tbm_set_last_result(TBM_ERROR_INVALID_PARAMETER);
return NULL;
}
#endif
return NULL;
}
+
#ifdef HAVE_CAPI_0_1_1
set_last_result(TBM_SURFACE_ERROR_NONE);
#endif
+
return surf;
}
int
tbm_surface_destroy(tbm_surface_h surface)
{
- if (!surface)
- return TBM_SURFACE_ERROR_INVALID_PARAMETER;
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
+
+ TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
tbm_surface_internal_destroy(surface);
- return TBM_SURFACE_ERROR_NONE;
+ return tbm_get_last_error();
}
int
tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info)
{
- TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
+
+ TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
TBM_RETURN_VAL_IF_FAIL(info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
int ret = 0;
ret = tbm_surface_internal_get_info(surface, opt, info, 1);
if (ret == 0)
- return TBM_SURFACE_ERROR_INVALID_OPERATION;
+ return tbm_get_last_error();
return TBM_SURFACE_ERROR_NONE;
}
int
tbm_surface_unmap(tbm_surface_h surface)
{
- TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
+
+ TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
tbm_surface_internal_unmap(surface);
- return TBM_SURFACE_ERROR_NONE;
+ return tbm_get_last_error();
}
int
tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info)
{
- TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
+
+ TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
TBM_RETURN_VAL_IF_FAIL(info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
int ret = 0;
ret = tbm_surface_internal_get_info(surface, 0, info, 0);
if (ret == 0)
- return TBM_SURFACE_ERROR_INVALID_OPERATION;
+ return tbm_get_last_error();
return TBM_SURFACE_ERROR_NONE;
}
int
tbm_surface_get_width(tbm_surface_h surface)
{
- TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
+
+ int width = 0;
+
+ _tbm_set_last_result(TBM_ERROR_NONE);
+
+ if (!surface) {
+#ifdef HAVE_CAPI_0_1_1
+ set_last_result(TBM_SURFACE_ERROR_INVALID_PARAMETER);
+#endif
+ _tbm_set_last_result(TBM_ERROR_INVALID_PARAMETER);
+ return TBM_SURFACE_ERROR_INVALID_PARAMETER;
+ }
+
+ width = tbm_surface_internal_get_width(surface);
+ if (tbm_get_last_error() != TBM_ERROR_NONE) {
+#ifdef HAVE_CAPI_0_1_1
+ set_last_result(TBM_SURFACE_ERROR_INVALID_PARAMETER);
+#endif
+ return TBM_SURFACE_ERROR_INVALID_PARAMETER;
+ }
- return tbm_surface_internal_get_width(surface);
+#ifdef HAVE_CAPI_0_1_1
+ set_last_result(TBM_SURFACE_ERROR_NONE);
+#endif
+
+ return width;
}
int
tbm_surface_get_height(tbm_surface_h surface)
{
- TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
+
+ int height = 0;
+
+ _tbm_set_last_result(TBM_ERROR_NONE);
+
+ if (!surface) {
+#ifdef HAVE_CAPI_0_1_1
+ set_last_result(TBM_SURFACE_ERROR_INVALID_PARAMETER);
+#endif
+ _tbm_set_last_result(TBM_ERROR_INVALID_PARAMETER);
+ return TBM_SURFACE_ERROR_INVALID_PARAMETER;
+ }
- return tbm_surface_internal_get_height(surface);
+ height = tbm_surface_internal_get_height(surface);
+ if (tbm_get_last_error() != TBM_ERROR_NONE) {
+#ifdef HAVE_CAPI_0_1_1
+ set_last_result(TBM_SURFACE_ERROR_INVALID_PARAMETER);
+#endif
+ return TBM_SURFACE_ERROR_INVALID_PARAMETER;
+ }
+
+#ifdef HAVE_CAPI_0_1_1
+ set_last_result(TBM_SURFACE_ERROR_NONE);
+#endif
+
+ return height;
}
tbm_format
tbm_surface_get_format(tbm_surface_h surface)
{
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
+
+ _tbm_set_last_result(TBM_ERROR_NONE);
+
if (!surface) {
#ifdef HAVE_CAPI_0_1_1
set_last_result(TBM_SURFACE_ERROR_INVALID_PARAMETER);
#endif
+ _tbm_set_last_result(TBM_ERROR_INVALID_PARAMETER);
return 0;
}
+
#ifdef HAVE_CAPI_0_1_1
set_last_result(TBM_SURFACE_ERROR_NONE);
#endif
+
return tbm_surface_internal_get_format(surface);
}