~gordallott/unity/remove-blured-dash-icons

« back to all changes in this revision

Viewing changes to dash/ResultRendererTile.cpp

  • Committer: Gord Allott
  • Date: 2012-05-08 17:24:39 UTC
  • Revision ID: gord.allott@canonical.com-20120508172439-jybgdh44s214io0e
removes the blurred dash icon code

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
  int icon_left_hand_side = geometry.x + (geometry.width - icon_width) / 2;
119
119
  int icon_top_side = geometry.y + padding + (tile_icon_size - icon_height) / 2;
120
120
 
121
 
  if (container->blurred_icon && state == ResultRendererState::RESULT_RENDERER_NORMAL)
122
 
  {
123
 
    GfxContext.QRP_1Tex(icon_left_hand_side - 5 - x_offset,
124
 
                        icon_top_side - 5 - y_offset,
125
 
                        container->blurred_icon->GetWidth(),
126
 
                        container->blurred_icon->GetHeight(),
127
 
                        container->blurred_icon->GetDeviceTexture(),
128
 
                        texxform,
129
 
                        nux::Color(0.15f, 0.15f, 0.15f, 0.15f));
130
 
  }
131
 
 
132
121
  // render highlight if its needed
133
122
  if (container->prelight && state != ResultRendererState::RESULT_RENDERER_NORMAL)
134
123
  {
350
339
 
351
340
    float scale = float(pixbuf_height) / gdk_pixbuf_get_height(pixbuf);
352
341
 
353
 
    //cairo_translate(cr,
354
 
    //                static_cast<int>((width - (pixbuf_width * scale)) * 0.5),
355
 
    //                static_cast<int>((height - (pixbuf_height * scale)) * 0.5));
356
 
 
357
342
    cairo_scale(cr, scale, scale);
358
343
 
359
344
    cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
365
350
 
366
351
}
367
352
 
368
 
nux::BaseTexture* ResultRendererTile::CreateBlurredTextureCallback(std::string const& texid,
369
 
                                                                   int width,
370
 
                                                                   int height,
371
 
                                                                   GdkPixbuf* pixbuf)
372
 
{
373
 
  int pixbuf_width, pixbuf_height;
374
 
  pixbuf_width = gdk_pixbuf_get_width(pixbuf);
375
 
  pixbuf_height = gdk_pixbuf_get_height(pixbuf);
376
 
 
377
 
  nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, width + 10, height + 10);
378
 
  cairo_t* cr = cairo_graphics.GetInternalContext();
379
 
 
380
 
  cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
381
 
  cairo_translate(cr, 5, 5);
382
 
  cairo_paint(cr);
383
 
 
384
 
  float scale;
385
 
  if (pixbuf_width > pixbuf_height)
386
 
    scale = pixbuf_height / static_cast<float>(pixbuf_width);
387
 
  else
388
 
    scale = pixbuf_width / static_cast<float>(pixbuf_height);
389
 
 
390
 
  cairo_translate(cr,
391
 
                  static_cast<int>((width - (pixbuf_width * scale)) * 0.5),
392
 
                  static_cast<int>((height - (pixbuf_height * scale)) * 0.5));
393
 
 
394
 
  cairo_scale(cr, scale, scale);
395
 
 
396
 
  cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
397
 
  gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
398
 
 
399
 
  cairo_paint(cr);
400
 
 
401
 
  cairo_graphics.BlurSurface(4);
402
 
 
403
 
  return texture_from_cairo_graphics(cairo_graphics);
404
 
}
405
 
 
406
 
 
407
353
void ResultRendererTile::IconLoaded(std::string const& texid,
408
354
                                    unsigned size,
409
355
                                    GdkPixbuf* pixbuf,
419
365
    BaseTexturePtr texture(cache.FindTexture(icon_name, style.GetTileIconSize(), style.GetTileIconSize(),
420
366
                           sigc::bind(sigc::mem_fun(this, &ResultRendererTile::CreateTextureCallback), pixbuf)));
421
367
 
422
 
    std::string blur_texid = icon_name + "_blurred";
423
 
    BaseTexturePtr texture_blurred(cache.FindTexture(blur_texid, style.GetTileIconSize(), style.GetTileIconSize(),
424
 
                                   sigc::bind(sigc::mem_fun(this, &ResultRendererTile::CreateBlurredTextureCallback), pixbuf)));
425
 
 
426
368
    BaseTexturePtr texture_prelight(cache.FindTexture("resultview_prelight", texture->GetWidth() + highlight_padding*2, texture->GetHeight() + highlight_padding*2,  sigc::mem_fun(this, &ResultRendererTile::DrawHighlight)));
427
369
 
428
370
    container->icon = texture;
429
 
    container->blurred_icon = texture_blurred;
430
371
    container->prelight = texture_prelight;
431
372
 
432
373
    NeedsRedraw.emit();