hostsupport/hostopenvg/src/riApi.cpp
branchbug235_bringup_0
changeset 69 3f914c77c2e9
parent 56 40cc73c24bf8
equal deleted inserted replaced
68:8d4efe9fa1cf 69:3f914c77c2e9
  2000             throw e;
  2000             throw e;
  2001         }
  2001         }
  2002          
  2002          
  2003         //Drawable drawable(Color::formatToDescriptor(VG_A_8), curr->getWidth(), curr->getHeight(), curr->getNumSamples(), 1);    //TODO 0 mask bits (mask buffer is not used)
  2003         //Drawable drawable(Color::formatToDescriptor(VG_A_8), curr->getWidth(), curr->getHeight(), curr->getNumSamples(), 1);    //TODO 0 mask bits (mask buffer is not used)
  2004 
  2004 
  2005         Rasterizer& rasterizer = context->m_rasterizer;
  2005         OpenVGRI::Rasterizer& rasterizer = context->m_rasterizer;
  2006         rasterizer.clear();
  2006         rasterizer.clear();
  2007 
  2007 
  2008         rasterizer.setScissoring(context->m_scissoring ? true : false);
  2008         rasterizer.setScissoring(context->m_scissoring ? true : false);
  2009         if(context->m_scissoring)
  2009         if(context->m_scissoring)
  2010             rasterizer.setScissor(context->m_scissor);	//throws bad_alloc
  2010             rasterizer.setScissor(context->m_scissor);	//throws bad_alloc
  2445     //set up rendering surface and mask buffer
  2445     //set up rendering surface and mask buffer
  2446     Drawable* drawable = context->getCurrentDrawable();
  2446     Drawable* drawable = context->getCurrentDrawable();
  2447     if(!drawable)
  2447     if(!drawable)
  2448         return false;   //no EGL surface is current at the moment
  2448         return false;   //no EGL surface is current at the moment
  2449 
  2449 
  2450     Rasterizer& rasterizer = context->m_rasterizer;
  2450     OpenVGRI::Rasterizer& rasterizer = context->m_rasterizer;
  2451     rasterizer.clear();
  2451     rasterizer.clear();
  2452 
  2452 
  2453     if(context->m_scissoring)
  2453     if(context->m_scissoring)
  2454     {
  2454     {
  2455         rasterizer.setScissor(context->m_scissor);	//throws bad_alloc
  2455         rasterizer.setScissor(context->m_scissor);	//throws bad_alloc
  3096     p0 *= 1.0f/p0.z;
  3096     p0 *= 1.0f/p0.z;
  3097     p1 *= 1.0f/p1.z;
  3097     p1 *= 1.0f/p1.z;
  3098     p2 *= 1.0f/p2.z;
  3098     p2 *= 1.0f/p2.z;
  3099     p3 *= 1.0f/p3.z;
  3099     p3 *= 1.0f/p3.z;
  3100 
  3100 
  3101     Rasterizer& rasterizer = context->m_rasterizer;
  3101     OpenVGRI::Rasterizer& rasterizer = context->m_rasterizer;
  3102     rasterizer.clear();
  3102     rasterizer.clear();
  3103 
  3103 
  3104     rasterizer.setScissoring(context->m_scissoring ? true : false);
  3104     rasterizer.setScissoring(context->m_scissoring ? true : false);
  3105     if(context->m_scissoring)
  3105     if(context->m_scissoring)
  3106         rasterizer.setScissor(context->m_scissor);	//throws bad_alloc
  3106         rasterizer.setScissor(context->m_scissor);	//throws bad_alloc
  3810     int stride;
  3810     int stride;
  3811 
  3811 
  3812     eglvgGetImageDescriptor( image, desc, width, height, stride );
  3812     eglvgGetImageDescriptor( image, desc, width, height, stride );
  3813     // There is some error.
  3813     // There is some error.
  3814     // EGLImage is null or EGLImage target is EGL_VG_PARENT_IMAGE_KHR.
  3814     // EGLImage is null or EGLImage target is EGL_VG_PARENT_IMAGE_KHR.
  3815     RI_IF_ERROR(!width || !height || !stride, VG_ILLEGAL_ARGUMENT_ERROR, NULL);
  3815     RI_IF_ERROR(!width || !height || !stride, VG_ILLEGAL_ARGUMENT_ERROR, VG_INVALID_HANDLE);
  3816     // Data is created in EGLImage class.
  3816     // Data is created in EGLImage class.
  3817     data = (OpenVGRI::RIuint8*)eglvgGetImageData( image );    
  3817     data = (OpenVGRI::RIuint8*)eglvgGetImageData( image );    
  3818     // Create VGImage
  3818     // Create VGImage
  3819     // allowedQuality = VG_IMAGE_QUALITY_NONANTIALIASED | VG_IMAGE_QUALITY_FASTER | VG_IMAGE_QUALITY_BETTER
  3819     // allowedQuality = VG_IMAGE_QUALITY_NONANTIALIASED | VG_IMAGE_QUALITY_FASTER | VG_IMAGE_QUALITY_BETTER
  3820     ret = vgCreateImage( desc.vgFormat, width, height, VG_IMAGE_QUALITY_NONANTIALIASED );
  3820     ret = vgCreateImage( desc.vgFormat, width, height, VG_IMAGE_QUALITY_NONANTIALIASED );
  3821     // If VGImage is not created raise error and return null
  3821     // If VGImage is not created raise error and return null
  3822     RI_IF_ERROR(!ret, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR, NULL);
  3822     RI_IF_ERROR(!ret, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR, VG_INVALID_HANDLE);
  3823     // Set data for VGImage.
  3823     // Set data for VGImage.
  3824     // This will copy that data-object.
  3824     // This will copy that data-object.
  3825     vgImageSubData( ret, 
  3825     vgImageSubData( ret, 
  3826                     data, 
  3826                     data, 
  3827                     stride, 
  3827                     stride,