~3v1n0/unity/overlay-border-scale

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/QuicklistMenuItemSeparator.cpp

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "CairoTexture.h"
23
23
#include "QuicklistMenuItemSeparator.h"
24
24
 
25
 
using unity::texture_from_cairo_graphics;
 
25
namespace unity
 
26
{
26
27
 
27
28
QuicklistMenuItemSeparator::QuicklistMenuItemSeparator(DbusmenuMenuitem* item,
28
29
                                                       NUX_FILE_LINE_DECL) :
30
31
                    NUX_FILE_LINE_PARAM)
31
32
{
32
33
  _name = "QuicklistMenuItemSeparator";
33
 
  SetMinimumHeight(5);
34
 
  SetBaseSize(64, 5);
35
 
  //_normalTexture = NULL;
 
34
  SetMinimumHeight(7);
 
35
  SetBaseSize(64, 7);
 
36
 
36
37
  _color      = nux::Color(1.0f, 1.0f, 1.0f, 0.5f);
37
38
  _premultiplied_color = nux::Color(0.5f, 0.5f, 0.5f, 0.5f);
38
39
  _item_type  = MENUITEM_TYPE_SEPARATOR;
46
47
                    NUX_FILE_LINE_PARAM)
47
48
{
48
49
  _name = "QuicklistMenuItemSeparator";
49
 
  SetMinimumHeight(5);
50
 
  SetBaseSize(64, 5);
 
50
  SetMinimumHeight(7);
 
51
  SetBaseSize(64, 7);
51
52
  //_normalTexture = NULL;
52
53
  _color      = nux::Color(1.0f, 1.0f, 1.0f, 0.5f);
53
54
  _premultiplied_color = nux::Color(0.5f, 0.5f, 0.5f, 0.5f);
145
146
QuicklistMenuItemSeparator::UpdateTexture()
146
147
{
147
148
  int width  = GetBaseWidth();
 
149
  int height  = GetBaseHeight();
148
150
 
149
 
  _cairoGraphics = new nux::CairoGraphics(CAIRO_FORMAT_ARGB32,
150
 
                                          GetBaseWidth(),
151
 
                                          GetBaseHeight());
 
151
  _cairoGraphics = new nux::CairoGraphics(CAIRO_FORMAT_ARGB32, width, height);
152
152
  cairo_t* cr = _cairoGraphics->GetContext();
153
153
 
154
154
  cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
156
156
  cairo_paint(cr);
157
157
  cairo_set_source_rgba(cr, _color.red, _color.green, _color.blue, _color.alpha);
158
158
  cairo_set_line_width(cr, 1.0f);
159
 
  cairo_move_to(cr, 0.5f, 2.5f);
160
 
  cairo_line_to(cr, width - 0.5f, 2.5f);
 
159
  cairo_move_to(cr, 0.0f, 3.5f);
 
160
  cairo_line_to(cr, width, 3.5f);
161
161
  cairo_stroke(cr);
162
162
 
163
163
  if (_normalTexture[0])
165
165
 
166
166
  _normalTexture[0] = texture_from_cairo_graphics(*_cairoGraphics);
167
167
 
 
168
  cairo_destroy(cr);
168
169
  delete _cairoGraphics;
169
170
}
170
171
 
175
176
 
176
177
  return 0;
177
178
}
 
179
 
 
180
}