~unity-team/unity/premultiply-the-world

« back to all changes in this revision

Viewing changes to src/PanelMenuView.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2011-02-19 13:41:18 UTC
  • Revision ID: neil.patel@canonical.com-20110219134118-v8k11hf43nof29oh
Make premultiplied blending by default but issue with menuview, seems to paint twice :/

Show diffs side-by-side

added added

removed removed

Lines of Context:
215
215
  int button_width = _padding + _window_buttons->GetContentWidth () + _padding;
216
216
  float factor = 4;
217
217
  button_width /= factor;
 
218
  int  bgs = 0;
218
219
    
219
220
  GfxContext.PushClippingRectangle (geo);
220
221
 
221
222
  /* "Clear" out the background */
222
 
  nux::ROPConfig rop; 
223
 
  rop.Blend = true;
224
 
  rop.SrcBlend = GL_ONE;
225
 
  rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
226
 
 
227
 
  nux::ColorLayer layer (nux::Color (0x00000000), true, rop);
 
223
  nux::ColorLayer layer (nux::Color (0x00000000));
228
224
  gPainter.PushDrawLayer (GfxContext, GetGeometry (), &layer);
 
225
  bgs++;
229
226
 
230
227
  if (_is_own_window)
231
228
  {
234
231
  else if (_is_maximized)
235
232
  {
236
233
    if (!_is_inside && !_last_active_view)
 
234
    {
237
235
      gPainter.PushDrawLayer (GfxContext, GetGeometry (), _title_layer);
 
236
      bgs++;
 
237
    }
238
238
  }
239
239
  else
240
240
  {
281
281
        }
282
282
        _gradient_texture->UnlockRect (0);
283
283
      }
284
 
      guint alpha = 0, src = 0, dest = 0;
285
 
 
286
 
      GfxContext.GetRenderStates ().GetBlend (alpha, src, dest);
287
 
      GfxContext.GetRenderStates ().SetBlend (true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
288
 
 
289
284
      nux::TexCoordXForm texxform0;
290
285
      nux::TexCoordXForm texxform1;
291
286
 
298
293
                             texxform1,
299
294
                             nux::Color::White);
300
295
 
301
 
      GfxContext.GetRenderStates ().SetBlend (alpha, src, dest);
302
296
      // The previous blend is too aggressive on the texture and therefore there
303
297
      // is a slight loss of clarity. This fixes that
304
298
      geo.width = button_width * (factor - 1);
305
299
      gPainter.PushDrawLayer (GfxContext, geo, _title_layer);
 
300
      bgs++;
306
301
      geo = GetGeometry ();  
307
302
    }
308
303
    else
310
305
      gPainter.PushDrawLayer (GfxContext,
311
306
                              geo,
312
307
                              _title_layer);
 
308
      bgs++;
313
309
    }
314
310
  }
315
311
 
316
 
  gPainter.PopBackground ();
 
312
  gPainter.PopBackground (bgs);
317
313
 
318
314
  GfxContext.PopClippingRectangle();
319
315
}
334
330
 
335
331
    if (_is_maximized)
336
332
    {
337
 
      _window_buttons->ProcessDraw (GfxContext, true);
 
333
      _window_buttons->ProcessDraw (GfxContext, force_draw);
338
334
    }
339
335
  }
340
336
 
530
526
  texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_COORD);
531
527
  texxform.SetWrap (nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
532
528
  
533
 
  nux::ROPConfig rop; 
534
 
  rop.Blend = true;
535
 
  rop.SrcBlend = GL_ONE;
536
 
  rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
537
529
  _title_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
538
 
                                        texxform,
539
 
                                        nux::Color::White,
540
 
                                        true, 
541
 
                                        rop);
 
530
                                        texxform);
542
531
 
543
532
  
544
533
  if (_title_tex)