diff options
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index fd65d81baad..ca0fd17c5a7 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -422,6 +422,24 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment glEnd(); } +void glutil_draw_filled_arc_part(float start, float angle, float radius, float radius_inn, int nsegments) +{ + int i; + + glBegin(GL_QUAD_STRIP); + glVertex2f(cosf(start) * radius_inn, sinf(start) * radius_inn); + glVertex2f(cosf(start) * radius, sinf(start) * radius); + for (i = 0; i < nsegments; i++) { + float t = (float) i / (nsegments - 1); + float cur = start + t * angle; + + glVertex2f(cosf(cur) * radius_inn, sinf(cur) * radius_inn); + glVertex2f(cosf(cur) * radius, sinf(cur) * radius); + } + glEnd(); +} + + void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments) { int i; @@ -713,10 +731,11 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo } /* uses either DrawPixelsSafe or DrawPixelsTex, based on user defined maximum */ -void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect) +void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, + int type, int zoomfilter, float alpha, void *rect) { if (U.image_draw_method != IMAGE_DRAW_METHOD_DRAWPIXELS) { - glColor4f(1.0, 1.0, 1.0, 1.0); + glColor4f(1.0, 1.0, 1.0, alpha); glaDrawPixelsTex(x, y, img_w, img_h, format, type, zoomfilter, rect); } else { @@ -1057,7 +1076,7 @@ void bglFlush(void) /* **** Color management helper functions for GLSL display/transform ***** */ /* Draw given image buffer on a screen using GLSL for display transform */ -void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter, +void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter, float alpha, ColorManagedViewSettings *view_settings, ColorManagedDisplaySettings *display_settings) { @@ -1097,7 +1116,7 @@ void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter, if (ok) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glColor4f(1.0, 1.0, 1.0, 1.0); + glColor4f(1.0, 1.0, 1.0, alpha); if (ibuf->rect_float) { int format = 0; @@ -1135,20 +1154,20 @@ void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter, if (display_buffer) glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, - zoomfilter, display_buffer); + zoomfilter, alpha, display_buffer); IMB_display_buffer_release(cache_handle); } } -void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int zoomfilter) +void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int zoomfilter, float alpha) { ColorManagedViewSettings *view_settings; ColorManagedDisplaySettings *display_settings; IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings); - glaDrawImBuf_glsl(ibuf, x, y, zoomfilter, view_settings, display_settings); + glaDrawImBuf_glsl(ibuf, x, y, zoomfilter, alpha, view_settings, display_settings); } void cpack(unsigned int x) |