~azzar1/unity/fix-trash-li-blocking

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