[Bf-blender-cvs] [de09366d573] blender2.8: Merge branch 'master' into blender2.8
Bastien Montagne
noreply at git.blender.org
Sun Nov 26 20:30:17 CET 2017
Commit: de09366d573d36ac96fa7dd9a20e87b6fad5ba02
Author: Bastien Montagne
Date: Sun Nov 26 20:29:56 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBde09366d573d36ac96fa7dd9a20e87b6fad5ba02
Merge branch 'master' into blender2.8
Conflicts:
source/blender/editors/mask/mask_draw.c
===================================================================
===================================================================
diff --cc source/blender/editors/mask/mask_draw.c
index 6ed1c021c6c,407c19a3860..c60b673ec69
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@@ -606,57 -652,16 +606,14 @@@ void ED_mask_draw(const bContext *C
return;
ED_mask_get_size(sa, &width, &height);
- ED_mask_get_aspect(sa, ar, &aspx, &aspy);
- UI_view2d_scale_get(&ar->v2d, &xscale, &yscale);
- draw_masklays(C, mask, draw_flag, draw_type, width, height, xscale * aspx, yscale * aspy);
+ draw_masklays(C, mask, draw_flag, draw_type, width, height);
}
- typedef struct ThreadedMaskRasterizeState {
- MaskRasterHandle *handle;
- float *buffer;
- int width, height;
- } ThreadedMaskRasterizeState;
-
- typedef struct ThreadedMaskRasterizeData {
- int start_scanline;
- int num_scanlines;
- } ThreadedMaskRasterizeData;
-
- static void mask_rasterize_func(TaskPool * __restrict pool, void *taskdata, int UNUSED(threadid))
+ static float *mask_rasterize(Mask *mask, const int width, const int height)
{
- ThreadedMaskRasterizeState *state = (ThreadedMaskRasterizeState *) BLI_task_pool_userdata(pool);
- ThreadedMaskRasterizeData *data = (ThreadedMaskRasterizeData *) taskdata;
- int scanline;
- const float x_inv = 1.0f / (float)state->width;
- const float y_inv = 1.0f / (float)state->height;
- const float x_px_ofs = x_inv * 0.5f;
- const float y_px_ofs = y_inv * 0.5f;
-
- for (scanline = 0; scanline < data->num_scanlines; scanline++) {
- float xy[2];
- int x, y = data->start_scanline + scanline;
-
- xy[1] = ((float)y * y_inv) + y_px_ofs;
-
- for (x = 0; x < state->width; x++) {
- int index = y * state->width + x;
-
- xy[0] = ((float)x * x_inv) + x_px_ofs;
-
- state->buffer[index] = BKE_maskrasterize_handle_sample(state->handle, xy);
- }
- }
- }
-
- static float *threaded_mask_rasterize(Mask *mask, const int width, const int height)
- {
- TaskScheduler *task_scheduler = BLI_task_scheduler_get();
- TaskPool *task_pool;
MaskRasterHandle *handle;
- ThreadedMaskRasterizeState state;
- float *buffer;
- int i, num_threads = BLI_task_scheduler_num_threads(task_scheduler), scanlines_per_thread;
-
- buffer = MEM_mallocN(sizeof(float) * height * width, "rasterized mask buffer");
+ float *buffer = MEM_mallocN(sizeof(float) * height * width, "rasterized mask buffer");
/* Initialize rasterization handle. */
handle = BKE_maskrasterize_handle_new();
@@@ -754,26 -733,28 +685,26 @@@ void ED_mask_draw_region(Mask *mask, AR
}
if (draw_flag & MASK_DRAWFLAG_OVERLAY) {
+ float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
- float *buffer = threaded_mask_rasterize(mask, width, height);
+ float *buffer = mask_rasterize(mask, width, height);
- int format;
- if (overlay_mode == MASK_OVERLAY_ALPHACHANNEL) {
- glColor3f(1.0f, 1.0f, 1.0f);
- format = GL_LUMINANCE;
- }
- else {
+ if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
/* More blending types could be supported in the future. */
glEnable(GL_BLEND);
- glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
- format = GL_ALPHA;
+ glBlendFunc(GL_DST_COLOR, GL_ZERO);
}
- glPushMatrix();
- glTranslatef(x, y, 0);
- glScalef(zoomx, zoomy, 0);
+ gpuPushMatrix();
+ gpuTranslate2f(x, y);
+ gpuScale2f(zoomx, zoomy);
if (stabmat) {
- glMultMatrixf(stabmat);
+ gpuMultMatrix(stabmat);
}
- glaDrawPixelsTex(0.0f, 0.0f, width, height, format, GL_FLOAT, GL_NEAREST, buffer);
- glPopMatrix();
+ IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ immDrawPixelsTex(&state, 0.0f, 0.0f, width, height, GL_RED, GL_FLOAT, GL_NEAREST, buffer, 1.0f, 1.0f, NULL);
+
+ gpuPopMatrix();
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
glDisable(GL_BLEND);
More information about the Bf-blender-cvs
mailing list