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