示例#1
0
/*******************************************************************************
 * Function Name  : ReleaseView
 * Returns        : true if no error occured
 * Description    : Code in ReleaseView() will be called by the Shell before
 *					changing to a new rendering context.
 *******************************************************************************/
bool OVGFont::ReleaseView()
{
	// Cleanup: destroy OpenVG path and paint
	vgDestroyFont(m_vgPathFont);
	m_vgPathFont = 0;

	vgDestroyFont(m_vgImageFont);
	m_vgPathFont = 0;

	vgDestroyPaint(m_vgFontPaint);
	m_vgFontPaint = 0;
	return true;
}
示例#2
0
void vgft_font_term(VGFT_FONT_T *font)
{
   if (font->ft_face)
      FT_Done_Face(font->ft_face);
   if (font->vg_font)
      vgDestroyFont(font->vg_font);
   memset(font, 0, sizeof(*font));
}
示例#3
0
VCOS_STATUS_T vgft_font_convert_glyphs(VGFT_FONT_T *font, unsigned int char_height, unsigned int dpi_x, unsigned int dpi_y)
{
   FT_UInt glyph_index;
   FT_ULong ch;

   if (FT_Set_Char_Size(font->ft_face, 0, char_height, dpi_x, dpi_y))
   {
      FT_Done_Face(font->ft_face);
      vgDestroyFont(font->vg_font);
      return VCOS_EINVAL;
   }

   ch = FT_Get_First_Char(font->ft_face, &glyph_index);

   while (ch != 0)
   {
      if (FT_Load_Glyph(font->ft_face, glyph_index, FT_LOAD_DEFAULT)) {
         FT_Done_Face(font->ft_face);
         vgDestroyFont(font->vg_font);
         return VCOS_ENOMEM;
      }

      VGPath vg_path;
      FT_Outline *outline = &font->ft_face->glyph->outline;
      if (outline->n_contours != 0) {
         vg_path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
         assert(vg_path != VG_INVALID_HANDLE);

         convert_outline(outline->points, outline->tags, outline->contours, outline->n_contours, outline->n_points);
         vgAppendPathData(vg_path, segments_count, segments, coords);
      } else {
         vg_path = VG_INVALID_HANDLE;
      }

      VGfloat origin[] = { 0.0f, 0.0f };
      VGfloat escapement[] = { float_from_26_6(font->ft_face->glyph->advance.x), float_from_26_6(font->ft_face->glyph->advance.y) };
      vgSetGlyphToPath(font->vg_font, glyph_index, vg_path, VG_FALSE, origin, escapement);

      if (vg_path != VG_INVALID_HANDLE) {
         vgDestroyPath(vg_path);
      }
      ch = FT_Get_Next_Char(font->ft_face, ch, &glyph_index);
   }

   return VCOS_SUCCESS;
}
示例#4
0
void vg_data_free ( void* vg_data_ptr )
{
  // Evidently, this pointer is the FT_Size object to which
  // we attached our data.
  FT_Size size = (FT_Size)vg_data_ptr;
  struct VG_DATA* data = (struct VG_DATA*)size->generic.data;
  if ( data != NULL ) {
    vgDestroyFont( data->font );
    free( data );
  }
}
示例#5
0
文件: vg.c 项目: AbelFlos/RetroArch
static void vg_free(void *data)
{
   vg_t *vg = (vg_t*)data;

   vgDestroyImage(vg->mImage);

   if (vg->mFontsOn)
   {
      vgDestroyFont(vg->mFont);
      vg->font_driver->free(vg->mFontRenderer);
      vgDestroyPaint(vg->mPaintFg);
      vgDestroyPaint(vg->mPaintBg);
   }

   vg->driver->destroy();

   free(vg);
}
示例#6
0
文件: vg.c 项目: mak77/RetroArch
static void vg_free(void *data)
{
   vg_t                    *vg = (vg_t*)data;

   if (!vg)
      return;

   vgDestroyImage(vg->mImage);

   if (vg->mFontsOn)
   {
      vgDestroyFont(vg->mFont);
      vg->font_driver->free(vg->mFontRenderer);
      vgDestroyPaint(vg->mPaintFg);
      vgDestroyPaint(vg->mPaintBg);
   }

   gfx_ctx_free(vg);

   free(vg);
}
示例#7
0
文件: rpi.c 项目: Wyrick/RetroArch
static void rpi_free(void *data)
{
   rpi_t *rpi = (rpi_t*)data;

   vgDestroyImage(rpi->mImage);

#ifdef HAVE_FREETYPE
   if (rpi->mFontsOn)
   {
      vgDestroyFont(rpi->mFont);
      font_renderer_free(rpi->mFontRenderer);
      vgDestroyPaint(rpi->mPaintFg);
      vgDestroyPaint(rpi->mPaintBg);
   }
#endif

   // Release EGL resources
   eglMakeCurrent(rpi->mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
   eglDestroySurface(rpi->mDisplay, rpi->mSurface);
   eglDestroyContext(rpi->mDisplay, rpi->mContext);
   eglTerminate(rpi->mDisplay);

   free(rpi);
}