diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_view.c | 24 |
5 files changed, 31 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 72cdaf97ec3..8df2c67ecda 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -240,6 +240,7 @@ int BKE_sequencer_evaluate_frame(struct Scene *scene, int cfra); struct StripElem *BKE_sequencer_give_stripelem(struct Sequence *seq, int cfra); /* intern */ +double seq_rendersize_to_scale_factor(int size); void BKE_sequencer_update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_seq, int len_change, int ibuf_change); bool BKE_sequencer_input_have_to_preprocess(const SeqRenderData *context, struct Sequence *seq, float cfra); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 56e34bbeb11..cb53e527c11 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1471,7 +1471,7 @@ static IMB_Proxy_Size seq_rendersize_to_proxysize(int size) return IMB_PROXY_25; } -static double seq_rendersize_to_scale_factor(int size) +double seq_rendersize_to_scale_factor(int size) { if (size >= 99) { return 1.0; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 6ac8d83da92..bb49f024bc3 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -2572,6 +2572,8 @@ void UI_view2d_text_cache_draw(ARegion *ar) /* investigate using BLF_ascender() */ const int font_id = BLF_default(); + + BLF_set_default(); const float default_height = g_v2d_strings ? BLF_height(font_id, "28", 3) : 0.0f; wmOrtho2_region_pixelspace(ar); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 089a30bcf5e..d37eab0e83d 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -897,24 +897,26 @@ ImBuf *sequencer_ibuf_get( SeqRenderData context = {0}; ImBuf *ibuf; int rectx, recty; - float render_size; - float proxy_size = 100.0; short is_break = G.is_break; + short render_size = sseq->render_size; + float proxy_size = 100.0; + double scale_fac; - render_size = sseq->render_size; if (render_size == 0) { render_size = scene->r.size; + scale_fac = (float)scene->r.size / 100.0f; } else { - proxy_size = render_size; + scale_fac = seq_rendersize_to_scale_factor(render_size); + proxy_size = scale_fac * 100; } if (render_size < 0) { return NULL; } - rectx = (render_size * (float)scene->r.xsch) / 100.0f + 0.5f; - recty = (render_size * (float)scene->r.ysch) / 100.0f + 0.5f; + rectx = ((float) scene->r.xsch * scale_fac) + 0.5f; + recty = ((float) scene->r.ysch * scale_fac) + 0.5f; BKE_sequencer_new_render_data( bmain, depsgraph, scene, diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index d500a9a081d..962b02aaeb2 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -90,7 +90,6 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) ARegion *ar = CTX_wm_region(C); ImBuf *ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, sseq, CFRA, 0, NULL); ImageSampleInfo *info = op->customdata; - float fx, fy; if (ibuf == NULL) { IMB_freeImBuf(ibuf); @@ -98,18 +97,33 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) return; } + short scene_scale_size = sseq->render_size ? 100 : scene->r.size; + float rectx = (float) scene->r.xsch * ((float) scene_scale_size / 100.0f); + float recty = (float) scene->r.ysch * ((float) scene_scale_size / 100.0f); + float scale_x = (float) ibuf->x / rectx; + float scale_y = (float) ibuf->y / recty; + float fx, fy; + + /* max coords are +/- (rect* / 2) + */ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy); - fx += (float) ibuf->x / 2.0f; - fy += (float) ibuf->y / 2.0f; + fx += rectx / 2.0f; + fy += recty / 2.0f; + + /* to get ibuf coords we have to scale by (ibuf->* / rect*) + */ + fx *= scale_x; + fy *= scale_y; if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) { const float *fp; unsigned char *cp; int x = (int) fx, y = (int) fy; - info->x = x; - info->y = y; + /* we will report mouse position on unscaled image */ + info->x = 1 + x / scale_x; + info->y = 1 + y / scale_y; info->draw = 1; info->channels = ibuf->channels; |