diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-11 08:31:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-11 08:31:09 +0400 |
commit | 6eaae376a89ee1b0c38d7ff61017a6ba914055bd (patch) | |
tree | 685cd12c4e3f8673e8931e9ae66b4af9471fbdf8 /source/blender/editors/interface | |
parent | 599cd56f535946726bc30e66e7ac483ec91ab6fd (diff) |
simple changes to grid drawing logic.
- make ortho grid drawing use vertex arrays
- make perspective view floor drawing cache result of UI_ThemeColorShade so its not called on every line.
- make perspective view floor only loop once on each axis when the grid floor isnt being drawn (was looking over all grid lines for no reason).
- add UI_GetColorPtrShade3ubv() to replace UI_GetColorPtrBlendShade3ubv() when no blending is needed.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/resources.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 692c8940a21..9b9237f70cf 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1039,6 +1039,23 @@ void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char c glColor3ub(r, g, b); } +void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset) +{ + int r, g, b; + + r= offset+(int)cp[0]; + g= offset+(int)cp[1]; + b= offset+(int)cp[2]; + + CLAMP(r, 0, 255); + CLAMP(g, 0, 255); + CLAMP(b, 0, 255); + + col[0] = r; + col[1] = g; + col[2] = b; +} + // get a 3 byte color, blended and shaded between two other char color pointers void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset) { |