~unity-team/unity/trunk

« back to all changes in this revision

Viewing changes to plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp

  • Committer: Daniel van Vugt
  • Date: 2012-09-13 10:56:42 UTC
  • mfrom: (2684 unity)
  • mto: This revision was merged to the branch mainline in revision 2698.
  • Revision ID: daniel.van.vugt@canonical.com-20120913105642-9on2ald55h54j1zn
Merge latest lp:unity and fix conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
438
438
 
439
439
bool
440
440
UnityMTGrabHandlesWindow::glDraw(const GLMatrix&            transform,
441
 
#ifdef USE_MODERN_COMPIZ_GL
442
441
                                 const GLWindowPaintAttrib& attrib,
443
 
#else
444
 
                                 GLFragment::Attrib&      fragment,
445
 
#endif
446
442
                                 const CompRegion&          region,
447
443
                                 unsigned int              mask)
448
444
{
449
445
  /* Draw the window on the bottom, we will be drawing the
450
446
   * handles on top */
451
 
#ifdef USE_MODERN_COMPIZ_GL
452
447
  bool status = gWindow->glDraw(transform, attrib, region, mask);
453
 
#else
454
 
  bool status = gWindow->glDraw(transform, fragment, region, mask);
455
 
#endif
456
448
 
457
449
  if (mHandles && mHandles->visible())
458
450
  {
459
451
    unsigned int allowedHandles = unity::MT::getLayoutForMask (window->state (), window->actions ());
460
452
    unsigned int handle = 0;
461
453
 
462
 
    UMTGH_SCREEN (screen);
463
 
 
464
454
    for(unity::MT::TextureLayout layout : mHandles->layout (allowedHandles))
465
455
    {
466
456
      /* We want to set the geometry of the handle to the window
472
462
        GLTexture::MatrixList matl;
473
463
        GLTexture::Matrix     mat = tex->matrix();
474
464
        CompRegion        paintRegion(region);
475
 
#ifdef USE_MODERN_COMPIZ_GL
476
465
        GLWindowPaintAttrib   wAttrib(attrib);
477
 
#endif
478
466
 
479
467
        /* We can reset the window geometry since it will be
480
468
         * re-added later */
481
 
#ifdef USE_MODERN_COMPIZ_GL
482
469
        gWindow->vertexBuffer()->begin();
483
 
#else
484
 
        gWindow->geometry().reset();
485
 
#endif
486
470
 
487
471
        /* Not sure what this does, but it is necessary
488
472
         * (adjusts for scale?) */
498
482
         * dim (so we get a nice render for things like
499
483
         * wobbly etc etc */
500
484
        gWindow->glAddGeometry(matl, reg, paintRegion);
501
 
#ifdef USE_MODERN_COMPIZ_GL
502
 
        gWindow->vertexBuffer()->end();
503
 
        wAttrib.opacity = mHandles->opacity();
504
 
#else
505
 
        /* Did it succeed? */
506
 
        if (gWindow->geometry().vertices)
507
 
        {
508
 
          fragment.setOpacity(mHandles->opacity());
509
 
          /* Texture rendering set-up */
510
 
          us->gScreen->setTexEnvMode(GL_MODULATE);
511
 
#endif
 
485
 
 
486
        if (gWindow->vertexBuffer()->end())
 
487
        {
 
488
          wAttrib.opacity = mHandles->opacity();
 
489
 
512
490
          glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
513
491
          /* Draw the dim texture with all of it's modified
514
492
           * geometry glory */
515
493
          gWindow->glDrawTexture(tex,
516
 
#ifdef USE_MODERN_COMPIZ_GL
517
494
                                 transform, wAttrib,
518
 
#else
519
 
                                 fragment,
520
 
#endif
521
495
                                 mask | PAINT_WINDOW_BLEND_MASK
522
496
                                 | PAINT_WINDOW_TRANSLUCENT_MASK |
523
497
                                 PAINT_WINDOW_TRANSFORMED_MASK);
524
498
          /* Texture rendering tear-down */
525
499
          glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
526
 
#ifndef USE_MODERN_COMPIZ_GL
527
 
          us->gScreen->setTexEnvMode(GL_REPLACE);
528
500
        }
529
 
#endif
530
501
      }
531
502
 
532
503
      handle++;