Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/glutil.c
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| #include "BIF_gl.h" | #include "BIF_gl.h" | ||||
| #include "BIF_glutil.h" | #include "BIF_glutil.h" | ||||
| #include "IMB_colormanagement.h" | #include "IMB_colormanagement.h" | ||||
| #include "IMB_imbuf_types.h" | #include "IMB_imbuf_types.h" | ||||
| #include "GPU_basic_shader.h" | #include "GPU_basic_shader.h" | ||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | ||||
| #include "GPU_legacy_stubs.h" | |||||
| #include "GPU_matrix.h" | #include "GPU_matrix.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| /* ******************************************** */ | /* ******************************************** */ | ||||
| void setlinestyle(int nr) | void setlinestyle(int nr) | ||||
| { | { | ||||
| if (nr == 0) { | if (nr == 0) { | ||||
| glDisable(GL_LINE_STIPPLE); | oldDisable(GL_LINE_STIPPLE); | ||||
| } | } | ||||
| else { | else { | ||||
| glEnable(GL_LINE_STIPPLE); | oldEnable(GL_LINE_STIPPLE); | ||||
| if (U.pixelsize > 1.0f) | if (U.pixelsize > 1.0f) | ||||
| glLineStipple(nr, 0xCCCC); | oldLineStipple(nr, 0xCCCC); | ||||
| else | else | ||||
| glLineStipple(nr, 0xAAAA); | oldLineStipple(nr, 0xAAAA); | ||||
| } | } | ||||
| } | } | ||||
| /* Invert line handling */ | /* Invert line handling */ | ||||
| #define GL_TOGGLE(mode, onoff) (((onoff) ? glEnable : glDisable)(mode)) | #define GL_TOGGLE(mode, onoff) (((onoff) ? glEnable : glDisable)(mode)) | ||||
| void set_inverted_drawing(int enable) | void set_inverted_drawing(int enable) | ||||
| Show All 21 Lines | |||||
| { | { | ||||
| GLubyte dummy = 0; | GLubyte dummy = 0; | ||||
| /* As long as known good coordinates are correct | /* As long as known good coordinates are correct | ||||
| * this is guaranteed to generate an ok raster | * this is guaranteed to generate an ok raster | ||||
| * position (ignoring potential (real) overflow | * position (ignoring potential (real) overflow | ||||
| * issues). | * issues). | ||||
| */ | */ | ||||
| glRasterPos2f(known_good_x, known_good_y); | oldRasterPos2f(known_good_x, known_good_y); | ||||
| /* Now shift the raster position to where we wanted | /* Now shift the raster position to where we wanted | ||||
| * it in the first place using the glBitmap trick. | * it in the first place using the glBitmap trick. | ||||
| */ | */ | ||||
| glBitmap(0, 0, 0, 0, x - known_good_x, y - known_good_y, &dummy); | oldBitmap(0, 0, 0, 0, x - known_good_x, y - known_good_y, &dummy); | ||||
| } | } | ||||
| static int get_cached_work_texture(int *r_w, int *r_h) | static int get_cached_work_texture(int *r_w, int *r_h) | ||||
| { | { | ||||
| static GLint texid = -1; | static GLint texid = -1; | ||||
| static int tex_w = 256; | static int tex_w = 256; | ||||
| static int tex_h = 256; | static int tex_h = 256; | ||||
| ▲ Show 20 Lines • Show All 552 Lines • ▼ Show 20 Lines | void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int zoomfilter, | ||||
| float zoom_x, float zoom_y) | float zoom_x, float zoom_y) | ||||
| { | { | ||||
| glaDrawImBuf_glsl_ctx_clipping(C, ibuf, x, y, zoomfilter, 0.0f, 0.0f, 0.0f, 0.0f, zoom_x, zoom_y); | glaDrawImBuf_glsl_ctx_clipping(C, ibuf, x, y, zoomfilter, 0.0f, 0.0f, 0.0f, 0.0f, zoom_x, zoom_y); | ||||
| } | } | ||||
| void cpack(unsigned int x) | void cpack(unsigned int x) | ||||
| { | { | ||||
| /* DEPRECATED: use imm_cpack */ | /* DEPRECATED: use imm_cpack */ | ||||
| glColor3ub(( (x) & 0xFF), | oldColor3ub(( (x) & 0xFF), | ||||
| (((x) >> 8) & 0xFF), | (((x) >> 8) & 0xFF), | ||||
| (((x) >> 16) & 0xFF)); | (((x) >> 16) & 0xFF)); | ||||
| } | } | ||||
| /* don't move to GPU_immediate_util.h because this uses user-prefs | /* don't move to GPU_immediate_util.h because this uses user-prefs | ||||
| * and isn't very low level */ | * and isn't very low level */ | ||||
| void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy) | void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy) | ||||
| { | { | ||||
| Show All 34 Lines | |||||