Fix T40885: "Reset Curve" is backwards on Custom Falloff Curves (Lights).

Add ability to define negative slope by default to curvemapping template...
Fix T40818: libpng warning: iCCP: known incorrect sRGB profile

Suppress warning for now, it's harmless and only happens
with new libpng.

In the future we might try enabling it for non-datatoc-ed
files, but it's really not worth spending lots of time on.
Experiment with the compositor border in editor

Preserve buffer form previous runs so it's possible to make
a compo of full frame, then draw a border and start tweaking
nodes and see updates in that border.

Main idea is to make it able to visually compare difference
between what was changed inside the border and how frame
looked before the tweaks outside of the border.

Also implemented Clear Viewer Border in compositor, shortcut
it Ctrl-Alt-B.

Reviewers: lukastoenne, jbakker

CC: venomgfx, sebastian_k

Differential Revision: https://developer.blender.org/D582
Fix image user count not being decreased when deleting a 3DView background image.

Patch by julien (Julien DUROURE) as T40568 (with own minor style edits), many thanks!
Fix odd situation where you could assign a background image without increasing its usercount.

Probably a leftover from old code, I don't think this invoke usage of VIEW3D_OT_background_image_add
was actually reachable anywhere from the UI, but managed to get it working from py, without increasing
user count...
Correct use-after-free in recent commit
Usual UI messages fixes.
CMake: correct include dirs
Fix T40761: Bone constraints broken in the BGE

Extra bonus: calculating bone constraints now happens parallel!
Python: remove redundant casts
Fix T40065: Pressing Esc in separate render result window does not focus main window.

The problem is that the render window keeps keybord input focus even after it has been
lowered. Windows maintains the Z-order of windows, so the present solution is to raise
the window that has been just below the render window.

Differential revision: https://developer.blender.org/D594
Reviewed by: campbellbarton
Code cleanup: use enum for setup_app_data
Fix strict flags compilation
Fix T40895: Curves panel, zooming out a lot crashes Blender
Correct enum size incase compiler makes enum signed
Code cleanup: use scene variable rather then calling CTX_data_scene
Fix T40888: Memory error when selecting Cycles render engine
add: initial datablock patch apply
fix: osx compilation fail