Page MenuHome

blender 2.8: Opengl: UI_draw_roundbox
ClosedPublic

Authored by Krantz Geoffroy (kgeogeo) on Nov 6 2016, 2:27 AM.

Diff Detail

Event Timeline

i've made a inline function to fill the color array, it make the code a lot cleaner and readable I think.

sorry, I miss one call to the new function

Very close to ready! Glad you got rid of those glColor calls.

source/blender/editors/include/UI_interface.h
311
const float color[4]

It's always RGBA and drawing does not change the values.

Hmm... seems drawing might change alpha value depending on use_alpha. We can figure this out now or commit & do it better later. (I vote to commit soon & improve later).

source/blender/editors/space_outliner/outliner_draw.c
1384

Use 1.0f as style guide suggests, here and in other places.

Krantz Geoffroy (kgeogeo) edited edge metadata.

change done for 1.f to 1.0f.
Is that important the const float??

Quickly looking through the patch looking (almost!) ready :)

change done for 1.f to 1.0f.
Is that important the const float??

Yes, please use const for array parameters that aren't return arguments. For the compiler, an array is a pointer so you're actually passing the memory address, not the array values. If the called function changes the values stored at that address, it doesn't only change the array locally, but also for the callers that pass it. The const tells the programmer to not change the array itself. The compiler will throw warnings if he does (although he could ignore them or even cast to non-const).

source/blender/blenlib/BLI_math_color.h
143

This can be removed.

Thanks for the explaination.

Hmm... seems drawing might change alpha value depending on use_alpha. We can figure this out now or commit & do it better later. (I vote to commit soon & improve later).

I don't touch it for now no?

source/blender/blenlib/BLI_math_color.h
143

yes, sure!!! Stupid copy/paste whitout thinking.

source/blender/editors/include/UI_interface.h
311

float color[4] with no const.

I have a feeling this code will be redone later, so it doesn't need to be const-perfect. More important to get rid of legacy OpenGL calls!

source/blender/editors/interface/interface_draw.c
422

float color[4]

source/blender/editors/interface/interface_intern.h
685

[4]

source/blender/editors/interface/interface_widgets.c
215

[4]

Yes, please use const for array parameters ...

Very good explanation sir.

If I am correct in master these to not respect zoom/dpi is that to be fixed here?

If I am correct in master these to not respect zoom/dpi is that to be fixed here?

Matching master is good enough. You mean line widths or corner radius or what?

Mike Erwin (merwin) edited edge metadata.

Let's fix corner radius scaling in another patch/commit.

This revision is now accepted and ready to land.Nov 15 2016, 2:22 AM

Landed in blender2.8