Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_icons.c
| Show All 29 Lines | |||||
| #include <math.h> | #include <math.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "GPU_draw.h" | #include "GPU_draw.h" | ||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | ||||
| #include "GPU_legacy_stubs.h" | |||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_fileops_types.h" | #include "BLI_fileops_types.h" | ||||
| #include "DNA_brush_types.h" | #include "DNA_brush_types.h" | ||||
| #include "DNA_curve_types.h" | #include "DNA_curve_types.h" | ||||
| #include "DNA_dynamicpaint_types.h" | #include "DNA_dynamicpaint_types.h" | ||||
| ▲ Show 20 Lines • Show All 974 Lines • ▼ Show 20 Lines | static void icon_draw_texture( | ||||
| float x1, x2, y1, y2; | float x1, x2, y1, y2; | ||||
| x1 = ix * icongltex.invw; | x1 = ix * icongltex.invw; | ||||
| x2 = (ix + ih) * icongltex.invw; | x2 = (ix + ih) * icongltex.invw; | ||||
| y1 = iy * icongltex.invh; | y1 = iy * icongltex.invh; | ||||
| y2 = (iy + ih) * icongltex.invh; | y2 = (iy + ih) * icongltex.invh; | ||||
| /* sharper downscaling, has no effect when scale matches with a mip level */ | /* sharper downscaling, has no effect when scale matches with a mip level */ | ||||
| glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -0.5f); | oldTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -0.5f); | ||||
| glBindTexture(GL_TEXTURE_2D, icongltex.id); | glBindTexture(GL_TEXTURE_2D, icongltex.id); | ||||
| VertexFormat *format = immVertexFormat(); | VertexFormat *format = immVertexFormat(); | ||||
| unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| unsigned int texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); | unsigned int texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); | ||||
| if (rgb) immUniformColor3fvAlpha(rgb, alpha); | if (rgb) immUniformColor3fvAlpha(rgb, alpha); | ||||
| Show All 12 Lines | static void icon_draw_texture( | ||||
| immVertex2f(pos, x + w, y + h); | immVertex2f(pos, x + w, y + h); | ||||
| immAttrib2f(texCoord, x2, y1); | immAttrib2f(texCoord, x2, y1); | ||||
| immVertex2f(pos, x + w, y); | immVertex2f(pos, x + w, y); | ||||
| immEnd(); | immEnd(); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, 0.0f); | oldTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, 0.0f); | ||||
| glBindTexture(GL_TEXTURE_2D, 0); | glBindTexture(GL_TEXTURE_2D, 0); | ||||
| } | } | ||||
| /* Drawing size for preview images */ | /* Drawing size for preview images */ | ||||
| static int get_draw_size(enum eIconSizes size) | static int get_draw_size(enum eIconSizes size) | ||||
| { | { | ||||
| switch (size) { | switch (size) { | ||||
| ▲ Show 20 Lines • Show All 370 Lines • Show Last 20 Lines | |||||