diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-13 13:54:32 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-13 13:54:32 +0300 |
commit | 98654a9c9a8a9068e3368cf6530a2f27d958895c (patch) | |
tree | e00c9784db689e7b3c7ff946d9c20a8bc7a981cc /source/blender/windowmanager | |
parent | 836ecc614244ff376c8a9e491b0732cb1831e01f (diff) | |
parent | 617c4d6adbfe64b3a72b5c48f918f39d30aa18dc (diff) |
Merge branch 'master' into asset-experiments
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 7 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 33 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_event_types.h | 7 |
4 files changed, 36 insertions, 19 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 8f15d94f538..962ed3c040d 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -437,8 +437,6 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha) float halfx, halfy, ratiox, ratioy; - glEnable(triple->target); - /* wmOrtho for the screen has this same offset */ ratiox = sizex; ratioy = sizey; @@ -453,6 +451,8 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha) halfy /= triple->y; } + GPU_basic_shader_bind((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_TEXTURE_2D : GPU_SHADER_TEXTURE_RECT); + glBindTexture(triple->target, triple->bind); glColor4f(1.0f, 1.0f, 1.0f, alpha); @@ -471,7 +471,8 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha) glEnd(); glBindTexture(triple->target, 0); - glDisable(triple->target); + + GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); } static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple) diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 26d1d4c3266..1357729e898 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -233,19 +233,15 @@ static void wm_gesture_draw_circle(wmGesture *gt) } struct LassoFillData { - unsigned int *px; + unsigned char *px; int width; }; static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data) { struct LassoFillData *data = user_data; - unsigned char *col = (unsigned char *)&(data->px[(y * data->width) + x]); - do { - col[0] = col[1] = col[2] = 0xff; - col[3] = 0x10; - col += 4; - } while (++x != x_end); + unsigned char *col = &(data->px[(y * data->width) + x]); + memset(col, 0x10, x_end - x); } static void draw_filled_lasso(wmWindow *win, wmGesture *gt) @@ -273,7 +269,7 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt) if (BLI_rcti_is_empty(&rect) == false) { const int w = BLI_rcti_size_x(&rect); const int h = BLI_rcti_size_y(&rect); - unsigned int *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * h, __func__); + unsigned char *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * h, __func__); struct LassoFillData lasso_fill_data = {pixel_buf, w}; fill_poly_v2i_n( @@ -281,14 +277,27 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt) (const int (*)[2])moves, tot, draw_filled_lasso_px_cb, &lasso_fill_data); - glEnable(GL_BLEND); - // glColor4f(1.0, 1.0, 1.0, 0.05); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glRasterPos2f(rect.xmin, rect.ymin); + glColor4f(1, 1, 1, 1); + glPixelTransferf(GL_RED_BIAS, 1); + glPixelTransferf(GL_GREEN_BIAS, 1); + glPixelTransferf(GL_BLUE_BIAS, 1); - glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buf); + GPU_basic_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); + glEnable(GL_BLEND); + glaDrawPixelsTex(rect.xmin, rect.ymin, w, h, GL_ALPHA, GL_UNSIGNED_BYTE, GL_NEAREST, pixel_buf); glDisable(GL_BLEND); + + GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); + + glPixelTransferf(GL_RED_BIAS, 0); + glPixelTransferf(GL_GREEN_BIAS, 0); + glPixelTransferf(GL_BLUE_BIAS, 0); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + MEM_freeN(pixel_buf); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 23455f85098..c85af1309e0 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1391,7 +1391,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) } } -static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) +static void popup_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) { wmOperator *op = op_ptr; if (op->type->check) { @@ -1423,7 +1423,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); - UI_block_func_set(block, dialog_check_cb, op, NULL); + UI_block_func_set(block, popup_check_cb, op, NULL); uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE); @@ -1463,9 +1463,13 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); + UI_block_func_set(block, popup_check_cb, op, NULL); + /* since ui is defined the auto-layout args are not used */ uiLayoutOperatorButs(C, layout, op, NULL, 'V', 0); + UI_block_func_set(block, NULL, NULL, NULL); + UI_block_bounds_set_popup(block, 4, 0, 0); return block; diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index e2b95da29a1..3085f138846 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -311,14 +311,17 @@ enum { TIMERNOTIFIER = 0x0118, /* timer event, notifier sender */ TIMERF = 0x011F, /* last timer */ - /* Tweak, gestures: 0x500x, 0x501x */ + /* Actionzones, tweak, gestures: 0x500x, 0x501x */ EVT_ACTIONZONE_AREA = 0x5000, EVT_ACTIONZONE_REGION = 0x5001, EVT_ACTIONZONE_FULLSCREEN = 0x5011, /* NOTE: these values are saved in keymap files, do not change them but just add new ones */ - /* tweak events, for L M R mousebuttons */ + /* Tweak events: + * Sent as additional event with the mouse coordinates from where the initial click was placed. */ + + /* tweak events for L M R mousebuttons */ EVT_TWEAK_L = 0x5002, EVT_TWEAK_M = 0x5003, EVT_TWEAK_R = 0x5004, |