102 float *r_thumb_width,
104 float *r_image_width,
105 float *r_image_height)
111 float aspect_ratio = (
float)image_width / image_height;
112 if (image_width > image_height) {
122 aspect_ratio = ((
float)image_width) / image_height;
123 float thumb_h_px = thumb_height / pixely;
124 float thumb_width = aspect_ratio * thumb_h_px * pixelx;
126 *r_thumb_width = thumb_width;
127 if (r_image_width && r_image_height) {
128 *r_image_width = image_width;
129 *r_image_height = image_height;
209 if (val_need_update !=
NULL) {
216 return thumb_data_hash;
287 if (
G.is_rendering) {
321 if (displayed_thumbnails ==
NULL) {
326 return displayed_thumbnails;
339 if (frame > range_start && frame < range_end) {
346 GSet *previously_displayed)
348 int best_diff = INT_MAX;
349 int best_frame = timeline_frame;
356 int diff =
abs(frame - timeline_frame);
357 if (
diff < best_diff) {
377 const int relative_base_frame =
round_fl_to_int((frame_index / (
float)frame_step)) * frame_step;
378 const int nearest_guaranted_absolute_frame = relative_base_frame +
380 return nearest_guaranted_absolute_frame;
386 GSet *previously_displayed,
391 previously_displayed);
395 context->scene, seq, timeline_frame);
400 if (ibuf_previous && ibuf_guaranteed) {
401 if (
abs(frame_previous - timeline_frame) <
abs(frame_guaranteed - timeline_frame)) {
403 closest_in_memory = ibuf_previous;
407 closest_in_memory = ibuf_guaranteed;
411 if (ibuf_previous ==
NULL) {
412 closest_in_memory = ibuf_guaranteed;
415 if (ibuf_guaranteed ==
NULL) {
416 closest_in_memory = ibuf_previous;
419 return closest_in_memory;
431 bool clipped =
false;
432 float image_height, image_width, thumb_width;
441 if ((y2 -
y1) / pixely <= 20 *
U.dpi_fac) {
451 const float thumb_height = y2 -
y1;
453 seq, pixelx, pixely, &thumb_width, thumb_height, &image_width, &image_height);
455 float thumb_y_end =
y1 + thumb_height;
476 while (timeline_frame < upper_thumb_bound) {
477 thumb_x_end = timeline_frame + thumb_width;
483 if (timeline_frame > v2d->
cur.
xmax) {
494 if (thumb_x_end > (upper_thumb_bound)) {
495 thumb_x_end = upper_thumb_bound;
497 if (thumb_x_end - timeline_frame < 1) {
502 float zoom_x = thumb_width / image_width;
503 float zoom_y = thumb_height / image_height;
505 float cropx_min = (cut_off / pixelx) / (zoom_y / pixely);
506 float cropx_max = ((thumb_x_end - timeline_frame) / pixelx) / (zoom_y / pixely);
507 if (cropx_max == (thumb_x_end - timeline_frame)) {
508 cropx_max = cropx_max + 1;
510 BLI_rcti_init(&crop, (
int)(cropx_min), (
int)cropx_max, 0, (
int)(image_height)-1);
519 &
context, seq, timeline_frame, last_displayed_thumbnails, &crop, clipped);
525 last_displayed_thumbnails, timeline_frame, thumb_x_end);
539 unsigned char *buf = (
unsigned char *)ibuf->
rect;
540 for (
int pixel = ibuf->
x * ibuf->
y; pixel--; buf += 4) {
546 for (
int pixel = ibuf->
x * ibuf->
y; pixel--; buf += ibuf->
channels) {
554 timeline_frame + cut_off,
557 timeline_frame + cut_off,
typedef float(TangentPoint)[2]
void ED_draw_imbuf_ctx_clipping(const struct bContext *C, struct ImBuf *ibuf, float x, float y, bool use_filter, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y)
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct SpaceSeq * CTX_wm_space_seq(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
int BKE_scene_multiview_view_id_get(const struct RenderData *rd, const char *viewname)
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
GSet * BLI_gset_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghashIterator_step(GHashIterator *ghi)
BLI_INLINE bool BLI_gsetIterator_done(const GSetIterator *gsi)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void BLI_gsetIterator_init(GSetIterator *gsi, GSet *gs)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
BLI_INLINE void BLI_gsetIterator_step(GSetIterator *gsi)
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
bool BLI_gset_add(GSet *gs, void *key)
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp)
#define LISTBASE_FOREACH(type, var, list)
MINLINE int round_fl_to_int(float a)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define IN_RANGE_INCL(a, b, c)
struct Depsgraph Depsgraph
@ SEQ_FLAG_SKIP_THUMBNAILS
void ED_area_tag_redraw(ScrArea *area)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
void GPU_blend(eGPUBlend blend)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define SEQ_RENDER_THUMB_SIZE
@ WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL
const Depsgraph * depsgraph
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static void area(int d1, int d2, int e1, int e2, float weights[2])
int SEQ_render_thumbnails_guaranteed_set_frame_step_get(const Scene *scene, const Sequence *seq)
ImBuf * SEQ_get_thumbnail(const SeqRenderData *context, Sequence *seq, float timeline_frame, rcti *crop, bool clipped)
void SEQ_render_new_render_data(Main *bmain, struct Depsgraph *depsgraph, Scene *scene, int rectx, int recty, int preview_render_size, int for_render, SeqRenderData *r_context)
void SEQ_render_thumbnails_base_set(const SeqRenderData *context, Sequence *seq, Sequence *seq_orig, rctf *view_area, const short *stop)
float SEQ_render_thumbnail_first_frame_get(const Scene *scene, Sequence *seq, float frame_step, rctf *view_area)
void SEQ_render_thumbnails(const SeqRenderData *context, Sequence *seq, Sequence *seq_orig, float frame_step, rctf *view_area, const short *stop)
float SEQ_render_thumbnail_next_frame_get(const Scene *scene, Sequence *seq, float last_frame, float frame_step)
void SEQ_sequence_free(Scene *scene, Sequence *seq)
Sequence * SEQ_sequence_dupli_recursive(const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Sequence *seq, int dupe_flag)
static void sequencer_thumbnail_start_job_if_necessary(const bContext *C, Editing *ed, View2D *v2d, bool thumbnail_is_missing, float thumb_height)
void draw_seq_strip_thumbnail(View2D *v2d, const bContext *C, Scene *scene, Sequence *seq, float y1, float y2, float pixelx, float pixely)
void last_displayed_thumbnails_list_free(void *val)
struct ThumbDataItem ThumbDataItem
static ImBuf * sequencer_thumbnail_closest_from_memory(const SeqRenderData *context, Sequence *seq, int timeline_frame, GSet *previously_displayed, rcti *crop, bool clipped)
static SeqRenderData sequencer_thumbnail_context_init(const bContext *C)
static int sequencer_thumbnail_closest_guaranteed_frame_get(struct Scene *scene, Sequence *seq, int timeline_frame)
static void thumbnail_hash_data_free(void *val)
static GHash * sequencer_thumbnail_ghash_init(const bContext *C, View2D *v2d, Editing *ed)
static void last_displayed_thumbnails_list_cleanup(GSet *previously_displayed, float range_start, float range_end)
static bool check_seq_need_thumbnails(const Scene *scene, Sequence *seq, rctf *view_area)
static void sequencer_thumbnail_init_job(const bContext *C, View2D *v2d, Editing *ed, float thumb_height)
static bool sequencer_thumbnail_v2d_is_navigating(const bContext *C)
struct ThumbnailDrawJob ThumbnailDrawJob
static void thumbnail_freejob(void *data)
static int sequencer_thumbnail_closest_previous_frame_get(int timeline_frame, GSet *previously_displayed)
static void thumbnail_endjob(void *data)
static void seq_get_thumb_image_dimensions(Sequence *seq, float pixelx, float pixely, float *r_thumb_width, float thumb_height, float *r_image_width, float *r_image_height)
static GSet * last_displayed_thumbnails_list_ensure(const bContext *C, Sequence *seq)
static void thumbnail_start_job(void *data, short *stop, short *UNUSED(do_update), float *UNUSED(progress))
void SEQ_relations_sequence_free_anim(Sequence *seq)
bool SEQ_time_has_right_still_frames(const Scene *scene, const Sequence *seq)
int SEQ_time_left_handle_frame_get(const Scene *UNUSED(scene), const Sequence *seq)
int SEQ_time_right_handle_frame_get(const Scene *scene, const Sequence *seq)
struct GHash * last_displayed_thumbnails
struct rctf last_thumbnail_area
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
bool WM_jobs_is_running(const wmJob *wm_job)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
void * WM_jobs_customdata_get(wmJob *wm_job)
void WM_jobs_stop(wmWindowManager *wm, const void *owner, void *startjob)
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *))
void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, int flag, int job_type)