~unity-team/nux/nux.redirected-views

« back to all changes in this revision

Viewing changes to Nux/Button.cpp

  • Committer: Tarmac
  • Author(s): Jay Taoko
  • Date: 2012-09-18 14:21:37 UTC
  • mfrom: (660.1.2 nux.dash-to-preview)
  • Revision ID: tarmac-20120918142137-uvz785kmnt2s40qy
This branch introduces "Redirected Views" in Nux. Redirected views allows a view to be rendered inside its own texture and that texture is latter composited inside the main rendering.
This branch contains the required changes for redirected views. The opportunty was also taken to fix minor issues and introduce API changes.

== Core of the Redirected View
  Nux/Area.cpp
  Nux/Area.h
  Nux/Layout.cpp
  Nux/Layout.h
  Nux/View.cpp
  Nux/View.h

== Fixed ClientArea to work with RedirectedViews
  Nux/ClientArea.cpp
  Nux/ClientArea.h

== Concrete implementation of a view to replace InputArea in some locations
  Nux/BasicView.cpp
  Nux/BasicView.h

== Nux.h contains the Feature.h file of Nux
  Nux/Nux.h

== API change to frame buffer object architecture
  NuxGraphics/IOpenGLFrameBufferObject.cpp
  NuxGraphics/IOpenGLFrameBufferObject.h

== Added InitSlTexturePremultiplyShader shader
  NuxGraphics/RenderingPipeGLSL.cpp
  NuxGraphics/GraphicsEngine.cpp
  NuxGraphics/GraphicsEngine.h
  NuxGraphics/RenderingPipeAsm.cpp

== Fixed texture inversion
  NuxGraphics/RenderingPipe.cpp. Fixes: https://bugs.launchpad.net/bugs/1049593. Approved by Neil J. Patel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
344
344
    Geometry base = GetGeometry();
345
345
 
346
346
    graphics_engine.PushClippingRectangle(base);
347
 
    GetPainter().PaintBackground(graphics_engine, base);
 
347
 
 
348
    UXStyleImageRef ref_style = eIMAGE_STYLE_NONE;
348
349
 
349
350
    if (visual_state_ == VISUAL_STATE_PRESSED)
350
351
    {
351
 
      GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_FOCUS);
 
352
      ref_style = eBUTTON_FOCUS;
352
353
    }
353
354
    else if (visual_state_ == VISUAL_STATE_PRELIGHT)
354
355
    {
355
 
      GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_PRELIGHT);
 
356
      ref_style = eBUTTON_PRELIGHT;
356
357
    }
357
358
    else
358
359
    {
359
 
      GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_NORMAL);
360
 
    }
 
360
      ref_style = eBUTTON_NORMAL;
 
361
    }
 
362
 
 
363
    const PainterImage *pimage = GetTheme().GetImage(ref_style);
 
364
    BaseTexture* texture = NULL;
 
365
    if (pimage != NULL)
 
366
    {
 
367
      texture = pimage->texture;
 
368
    }
 
369
 
 
370
    TexCoordXForm texxform;
 
371
    ROPConfig rop;
 
372
    rop.Blend = true;
 
373
    rop.SrcBlend = GL_ONE;
 
374
    rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
 
375
 
 
376
    GetPainter().PushDrawSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop);
361
377
 
362
378
    if (GetCompositionLayout())
363
379
    {
368
384
        clip_geo.OffsetSize(-left_clip_ - right_clip_, -top_clip_ - bottom_clip_);
369
385
 
370
386
        graphics_engine.PushClippingRectangle(clip_geo);
371
 
        GetPainter().PushPaintLayerStack();
372
 
        GetCompositionLayout()->ProcessDraw(graphics_engine, force_draw);
373
 
        GetPainter().PopPaintLayerStack();
 
387
 
 
388
        GetCompositionLayout()->ProcessDraw(graphics_engine, true);
 
389
 
374
390
        graphics_engine.PopClippingRectangle();
375
391
      }
376
392
      GetPainter().PopPaintLayerStack();
377
393
    }
 
394
    GetPainter().PopPaintLayer();
378
395
    graphics_engine.PopClippingRectangle();
379
396
  }
380
397