1 /**************************************************************************
5 Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
7 Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
8 Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 **************************************************************************/
33 #include "tbm_bufmgr.h"
34 #include "tbm_bufmgr_int.h"
35 #include "tbm_surface_internal.h"
38 tbm_surface_query_formats (uint32_t **formats, uint32_t *num)
40 if (!tbm_surface_internal_query_supported_formats (formats, num))
41 return TBM_SURFACE_ERROR_INVALID_OPERATION;
43 return TBM_SURFACE_ERROR_NONE;
47 tbm_surface_create (int width, int height, tbm_format format)
49 if (!(width > 0) || !(height > 0))
51 #ifdef HAVE_CAPI_0_1_1
52 set_last_result (TBM_SURFACE_ERROR_INVALID_PARAMETER);
57 struct _tbm_surface *surf = NULL;
59 surf = tbm_surface_internal_create_with_flags (width, height, format, TBM_BO_DEFAULT);
62 #ifdef HAVE_CAPI_0_1_1
63 set_last_result (TBM_SURFACE_ERROR_INVALID_OPERATION);
68 #ifdef HAVE_CAPI_0_1_1
69 set_last_result (TBM_SURFACE_ERROR_NONE);
76 tbm_surface_destroy (tbm_surface_h surface)
79 return TBM_SURFACE_ERROR_INVALID_PARAMETER;
81 tbm_surface_internal_destroy (surface);
83 return TBM_SURFACE_ERROR_NONE;
87 tbm_surface_map (tbm_surface_h surface, int opt, tbm_surface_info_s *info)
89 TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
90 TBM_RETURN_VAL_IF_FAIL (info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
94 ret = tbm_surface_internal_get_info (surface, opt, info, 1);
96 return TBM_SURFACE_ERROR_INVALID_OPERATION;
98 return TBM_SURFACE_ERROR_NONE;
102 tbm_surface_unmap (tbm_surface_h surface)
104 TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
106 tbm_surface_internal_unmap(surface);
108 return TBM_SURFACE_ERROR_NONE;
112 tbm_surface_get_info (tbm_surface_h surface, tbm_surface_info_s *info)
114 TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
115 TBM_RETURN_VAL_IF_FAIL (info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
119 ret = tbm_surface_internal_get_info (surface, 0, info, 0);
121 return TBM_SURFACE_ERROR_INVALID_OPERATION;
123 return TBM_SURFACE_ERROR_NONE;
127 tbm_surface_get_width (tbm_surface_h surface)
129 TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
131 return tbm_surface_internal_get_width(surface);
135 tbm_surface_get_height (tbm_surface_h surface)
137 TBM_RETURN_VAL_IF_FAIL (surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
139 return tbm_surface_internal_get_height(surface);
143 tbm_surface_get_format (tbm_surface_h surface)
147 #ifdef HAVE_CAPI_0_1_1
148 set_last_result (TBM_SURFACE_ERROR_INVALID_PARAMETER);
153 #ifdef HAVE_CAPI_0_1_1
154 set_last_result (TBM_SURFACE_ERROR_NONE);
156 return tbm_surface_internal_get_format(surface);