1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program EGL Module
3e5c31af7Sopenharmony_ci * ---------------------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief OpenVG render utils.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "teglVGRenderUtil.hpp"
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#if defined(DEQP_SUPPORT_VG)
27e5c31af7Sopenharmony_ci#	include <VG/openvg.h>
28e5c31af7Sopenharmony_ci#endif
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_ciusing std::vector;
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_cinamespace deqp
33e5c31af7Sopenharmony_ci{
34e5c31af7Sopenharmony_cinamespace egl
35e5c31af7Sopenharmony_ci{
36e5c31af7Sopenharmony_cinamespace vg
37e5c31af7Sopenharmony_ci{
38e5c31af7Sopenharmony_ci
39e5c31af7Sopenharmony_ci#if defined(DEQP_SUPPORT_VG)
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_civoid clear (int x, int y, int width, int height, const tcu::Vec4& color)
42e5c31af7Sopenharmony_ci{
43e5c31af7Sopenharmony_ci	vgSetfv(VG_CLEAR_COLOR, 4, color.getPtr());
44e5c31af7Sopenharmony_ci	vgClear(x, y, width, height);
45e5c31af7Sopenharmony_ci	TCU_CHECK(vgGetError() == VG_NO_ERROR);
46e5c31af7Sopenharmony_ci}
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_civoid readPixels (tcu::Surface& dst, int x, int y, int width, int height)
49e5c31af7Sopenharmony_ci{
50e5c31af7Sopenharmony_ci	dst.setSize(width, height);
51e5c31af7Sopenharmony_ci	vgReadPixels(dst.getAccess().getDataPtr(), width*4, VG_sRGBA_8888, 0, 0, width, height);
52e5c31af7Sopenharmony_ci}
53e5c31af7Sopenharmony_ci
54e5c31af7Sopenharmony_civoid finish (void)
55e5c31af7Sopenharmony_ci{
56e5c31af7Sopenharmony_ci	vgFinish();
57e5c31af7Sopenharmony_ci}
58e5c31af7Sopenharmony_ci
59e5c31af7Sopenharmony_ci#else // DEQP_SUPPORT_VG
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_civoid clear (int x, int y, int width, int height, const tcu::Vec4& color)
62e5c31af7Sopenharmony_ci{
63e5c31af7Sopenharmony_ci	DE_UNREF(x && y && width && height);
64e5c31af7Sopenharmony_ci	DE_UNREF(color);
65e5c31af7Sopenharmony_ci	TCU_THROW(NotSupportedError, "OpenVG is not supported");
66e5c31af7Sopenharmony_ci}
67e5c31af7Sopenharmony_ci
68e5c31af7Sopenharmony_civoid readPixels (tcu::Surface& dst, int x, int y, int width, int height)
69e5c31af7Sopenharmony_ci{
70e5c31af7Sopenharmony_ci	DE_UNREF(x && y && width && height);
71e5c31af7Sopenharmony_ci	DE_UNREF(dst);
72e5c31af7Sopenharmony_ci	TCU_THROW(NotSupportedError, "OpenVG is not supported");
73e5c31af7Sopenharmony_ci}
74e5c31af7Sopenharmony_ci
75e5c31af7Sopenharmony_civoid finish (void)
76e5c31af7Sopenharmony_ci{
77e5c31af7Sopenharmony_ci	TCU_THROW(NotSupportedError, "OpenVG is not supported");
78e5c31af7Sopenharmony_ci}
79e5c31af7Sopenharmony_ci
80e5c31af7Sopenharmony_ci#endif // DEQP_SUPPORT_VG
81e5c31af7Sopenharmony_ci
82e5c31af7Sopenharmony_ci} // vg
83e5c31af7Sopenharmony_ci} // egl
84e5c31af7Sopenharmony_ci} // deqp
85