~smspillaz/unity/untiy.less-paint-insanity

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/QuicklistMenuItemLabel.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:
26
26
#include "CairoTexture.h"
27
27
#include "QuicklistMenuItemLabel.h"
28
28
 
29
 
using unity::texture_from_cairo_graphics;
 
29
namespace unity
 
30
{
30
31
 
31
32
QuicklistMenuItemLabel::QuicklistMenuItemLabel(DbusmenuMenuitem* item,
32
33
                                               NUX_FILE_LINE_DECL) :
134
135
  else
135
136
  {
136
137
    texture = _normalTexture[0]->GetDeviceTexture();
137
 
    _color = nux::Color(0.8f, 0.8f, 0.8f, 1.0f);
 
138
    _color = nux::color::White * 0.35;
138
139
  }
139
140
 
140
141
  gfxContext.QRP_1Tex(base.x,
165
166
void
166
167
QuicklistMenuItemLabel::UpdateTexture()
167
168
{
168
 
  nux::Color transparent = nux::Color(0.0f, 0.0f, 0.0f, 0.0f);
169
169
  int        width       = GetBaseWidth();
170
170
  int        height      = GetBaseHeight();
171
171
 
176
176
  cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
177
177
  cairo_paint(cr);
178
178
 
179
 
  cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
180
 
  cairo_scale(cr, 1.0f, 1.0f);
181
 
  cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
182
 
  cairo_set_line_width(cr, 1.0f);
183
 
 
184
 
  DrawText(cr, width, height, nux::color::White);
 
179
  DrawText(_cairoGraphics, width, height, nux::color::White);
185
180
 
186
181
  if (_normalTexture[0])
187
182
    _normalTexture[0]->UnReference();
192
187
  cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
193
188
  cairo_paint(cr);
194
189
 
195
 
  cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
196
 
  cairo_scale(cr, 1.0f, 1.0f);
197
 
  cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
198
 
  cairo_set_line_width(cr, 1.0f);
199
 
 
200
 
  _cairoGraphics->DrawRoundedRectangle(cr,
201
 
                                       1.0f,
202
 
                                       0.5f,
203
 
                                       0.5f,
204
 
                                       ITEM_CORNER_RADIUS_ABS,
205
 
                                       width - 1.0f,
206
 
                                       height - 1.0f);
207
 
  cairo_fill(cr);
208
 
 
209
 
  cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
210
 
 
211
 
  DrawText(cr, width, height, transparent);
 
190
  DrawPrelight(_cairoGraphics, width, height, nux::color::White);
 
191
  DrawText(_cairoGraphics, width, height, nux::color::White * 0.0f);
212
192
 
213
193
  if (_prelightTexture[0])
214
194
    _prelightTexture[0]->UnReference();
216
196
  _prelightTexture[0] = texture_from_cairo_graphics(*_cairoGraphics);
217
197
 
218
198
  // finally clean up
 
199
  cairo_destroy(cr);
219
200
  delete _cairoGraphics;
220
201
}
221
202
 
226
207
 
227
208
  return 0;
228
209
}
 
210
 
 
211
} // NAMESPACE