Cycles: Add a "Normal" input socket to the Layer Weight node + GLSL drawing code.

Patch by lichtwerk (Philipp Oeser).

Differential Revision: http://developer.blender.org/D28
fix for active bone not saving in editmode.
Code Cleanup: use NULL for pointer checks and remove joke.
Code Cleanup: warnings
Fix T37559: Crash dissolving vertices in some situations
Fix T37281: View3D could have invalid transform orientation using undo
Fix T37465: UV Coords we're incorrect when converting from a curve
Optimization for render result save

Skip byte->float conversion if output file format
supports high bit depths but configured to only
output 8 bits per channel.

Gives around 30% speedup when re-exporting movie file
to PNG image sequence here on laptop.

Possible further optimization:

- Skip color space conversion in imbuf_for_write
  function if we've got already have buffer in
  that space.

  This doesn't seem to happen often after tweak
  to render result to imbuf.

- Skip black alpha-under if original image is
  opaque,

  This is a bit tricky to detect.