~fginther/unity/100-scopes-search-tests

« back to all changes in this revision

Viewing changes to unity-shared/IconRenderer.cpp

  • Committer: Nick Dedekind
  • Date: 2013-03-12 13:31:41 UTC
  • mfrom: (3008.2.200 trunk)
  • Revision ID: nicholas.dedekind@gmail.com-20130312133141-qrq3x3ighapfd36f
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
648
648
nux::BaseTexture* IconRenderer::RenderCharToTexture(char label, int width, int height, nux::Color const& bg_color)
649
649
{
650
650
  nux::BaseTexture*     texture  = NULL;
651
 
  nux::CairoGraphics*   cg       = new nux::CairoGraphics(CAIRO_FORMAT_ARGB32,
652
 
                                                          width,
653
 
                                                          height);
654
 
  cairo_t*              cr       = cg->GetContext();
 
651
  nux::CairoGraphics    cg(CAIRO_FORMAT_ARGB32, width, height);
 
652
  cairo_t*              cr       = cg.GetInternalContext();
655
653
  PangoLayout*          layout   = NULL;
656
654
  PangoFontDescription* desc     = NULL;
657
655
  GtkSettings*          settings = gtk_settings_get_default();  // not ref'ed
669
667
  cairo_paint(cr);
670
668
  cairo_scale(cr, 1.0f, 1.0f);
671
669
  cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
672
 
  cg->DrawRoundedRectangle(cr, 1.0f, label_x, label_y, label_radius, label_w, label_h);
 
670
  cg.DrawRoundedRectangle(cr, 1.0f, label_x, label_y, label_radius, label_w, label_h);
673
671
  cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.75f);
674
672
  cairo_fill_preserve(cr);
675
673
  cairo_set_source_rgba(cr, bg_color.red, bg_color.green, bg_color.blue, 0.20f);
695
693
  cairo_move_to(cr, x, y);
696
694
  pango_cairo_show_layout(cr, layout);
697
695
 
698
 
  nux::NBitmapData* bitmap = cg->GetBitmap();
 
696
  nux::NBitmapData* bitmap = cg.GetBitmap();
699
697
  texture = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
700
698
  texture->Update(bitmap);
701
699
  delete bitmap;
702
 
  delete cg;
703
700
  g_object_unref(layout);
704
701
  pango_font_description_free(desc);
705
702
  g_free(fontName);