~brandontschaefer/unity/alt-grave-ordering-fix

« back to all changes in this revision

Viewing changes to dash/LensBar.cpp

  • Committer: Jay Taoko
  • Date: 2012-09-18 11:55:33 UTC
  • mfrom: (2696.3.6 unity.dash-to-preview)
  • mto: This revision was merged to the branch mainline in revision 2719.
  • Revision ID: jay.taoko@canonical.com-20120918115533-ksgl1o12m1wfxy9r
* Merged with Unity trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
  }
105
105
}
106
106
 
107
 
void LensBar::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
 
107
void LensBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
108
108
{
109
109
  nux::Geometry const& base = GetGeometry();
110
110
 
111
 
  gfx_context.PushClippingRectangle(base);
112
 
  nux::GetPainter().PaintBackground(gfx_context, base);
 
111
  graphics_engine.PushClippingRectangle(base);
113
112
 
114
113
  bg_layer_->SetGeometry(base);
115
 
  nux::GetPainter().RenderSinglePaintLayer(gfx_context, base, bg_layer_.get());
 
114
  nux::GetPainter().RenderSinglePaintLayer(graphics_engine, base, bg_layer_.get());
116
115
 
117
 
  gfx_context.PopClippingRectangle();
 
116
  graphics_engine.PopClippingRectangle();
118
117
}
119
118
 
120
 
void LensBar::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw)
 
119
void LensBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
121
120
{
122
121
  nux::Geometry const& base = GetGeometry();
123
122
 
124
 
  gfx_context.PushClippingRectangle(base);
125
 
 
126
 
  if (!IsFullRedraw())
127
 
    nux::GetPainter().PushLayer(gfx_context, bg_layer_->GetGeometry(), bg_layer_.get());
128
 
 
129
 
  layout_->ProcessDraw(gfx_context, force_draw);
130
 
 
131
 
  if (!IsFullRedraw())
132
 
    nux::GetPainter().PopBackground();
 
123
  graphics_engine.PushClippingRectangle(base);
 
124
 
 
125
  int pushed_paint_layers = 0;
 
126
  if(RedirectedAncestor())
 
127
  {
 
128
    {
 
129
      unsigned int alpha = 0, src = 0, dest = 0;
 
130
      graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
 
131
      // This is necessary when doing redirected rendering.
 
132
      // Clean the area below this view before drawing anything.
 
133
      graphics_engine.GetRenderStates().SetBlend(false);
 
134
      graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
 
135
      graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
 
136
    }
 
137
 
 
138
    nux::GetPainter().RenderSinglePaintLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
 
139
    //nux::GetPainter().PushDrawLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
 
140
  }
 
141
  else if (!IsFullRedraw())
 
142
  {
 
143
    ++pushed_paint_layers;
 
144
    nux::GetPainter().PushLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
 
145
  }
 
146
 
 
147
  layout_->ProcessDraw(graphics_engine, true);
 
148
 
 
149
  if (pushed_paint_layers)
 
150
    nux::GetPainter().PopBackground(pushed_paint_layers);
133
151
 
134
152
  for (auto icon: icons_)
135
153
  {
142
160
      // bigger one and clip part of them using the "-1".
143
161
      int y = base.y - 1;
144
162
 
145
 
      nux::GetPainter().Draw2DTriangleColor(gfx_context,
 
163
      nux::GetPainter().Draw2DTriangleColor(graphics_engine,
146
164
                                            middle - size, y,
147
165
                                            middle, y + size,
148
166
                                            middle + size, y,
152
170
    }
153
171
  }
154
172
 
155
 
  gfx_context.PopClippingRectangle();
 
173
  graphics_engine.PopClippingRectangle();
156
174
}
157
175
 
158
176
void LensBar::SetActive(LensBarIcon* activated)