53 const rctf *view_area)
55 int first_drawable_frame =
max_iii(left_handle, seq->
start, view_area->
xmin);
58 if (first_drawable_frame == left_handle) {
62 float aligned_frame_offset =
int((first_drawable_frame - seq->
start) / frame_step) * frame_step;
63 return seq->
start + aligned_frame_offset;
71 float next_frame = last_frame + frame_step;
74 if (last_frame == left_handle) {
75 next_frame = seq->
start + (
int((last_frame - seq->
start) / frame_step) + 1) * frame_step;
87 float *r_image_height)
105 float thumb_h_px = thumb_height / pixely;
106 float thumb_width = aspect_ratio * thumb_h_px * pixelx;
108 *r_thumb_width = thumb_width;
136 const float crop_x_multiplier = 1.0f / pixelx / (thumb_height /
image_height / pixely);
147 while (timeline_frame < upper_thumb_bound) {
148 float thumb_x_end = timeline_frame + thumb_width;
149 bool clipped =
false;
152 if (timeline_frame > v2d->
cur.
xmax) {
157 float cut_off = 0.0f;
164 if (thumb_x_end > upper_thumb_bound) {
165 thumb_x_end = upper_thumb_bound;
169 float cropx_min = cut_off * crop_x_multiplier;
170 float cropx_max = (thumb_x_end - timeline_frame) * crop_x_multiplier;
171 if (cropx_max < 1.0f) {
177 if (ibuf ==
nullptr) {
194 thumb.
x1 = timeline_frame + cut_off;
195 thumb.
x2 = thumb_x_end;
238 const SeqThumbInfo &info,
float width,
const rcti &rect,
int tex_width,
int tex_height)
251 res.tint_color =
float4(1.0f, 1.0f, 1.0f, info.
is_muted ? 0.47f : 1.0f);
310 constexpr int ATLAS_WIDTH = 4096;
311 constexpr int ATLAS_MAX_HEIGHT = 4096;
314 int cur_row_height = 0;
318 int cropx_min =
int(info.cropx_min);
320 int width = cropx_max - cropx_min + 1;
321 int height = info.ibuf->y;
322 cur_row_height =
math::max(cur_row_height, height);
325 if (cur_row_x + width > ATLAS_WIDTH) {
326 cur_row_y += cur_row_height + 1;
327 cur_row_height = height;
329 if (cur_row_y > ATLAS_MAX_HEIGHT) {
335 rcti rect{cur_row_x, cur_row_x + width, cur_row_y, cur_row_y + height};
339 cur_row_x += width + 1;
343 const int tex_width = ATLAS_WIDTH;
344 const int tex_height = cur_row_y + cur_row_height;
348 const rcti &rect = rects[i];
351 void *cache_handle =
nullptr;
353 info.
ibuf, view_settings, display_settings, &cache_handle);
354 if (display_buffer !=
nullptr && info.
ibuf !=
nullptr) {
357 int width = cropx_max - cropx_min + 1;
358 int height = info.
ibuf->
y;
359 const uchar *src = display_buffer + cropx_min * 4;
360 uchar *dst = &tex_data[(rect.
ymin * ATLAS_WIDTH + rect.
xmin) * 4];
361 for (
int y = 0; y < height; y++) {
362 memcpy(dst, src, width * 4);
363 src += info.
ibuf->
x * 4;
364 dst += ATLAS_WIDTH * 4;
385 const rcti &rect = rects[i];
MINLINE int round_fl_to_int(float a)
MINLINE float clamp_f(float value, float min, float max)
MINLINE float min_ff(float a, float b)
MINLINE int max_iii(int a, int b, int c)
static constexpr int image_width
static constexpr int image_height
@ SEQ_TIMELINE_SHOW_THUMBNAILS
void GPU_batch_draw_instance_range(blender::gpu::Batch *batch, int instance_first, int instance_count)
void GPU_batch_set_shader(blender::gpu::Batch *batch, GPUShader *shader)
blender::gpu::Batch * GPU_batch_preset_quad()
void GPU_matrix_push_projection()
void GPU_matrix_pop_projection()
int GPU_shader_get_sampler_binding(GPUShader *shader, const char *name)
int GPU_shader_get_ubo_binding(GPUShader *shader, const char *name)
void GPU_shader_bind(GPUShader *shader)
GPUShader * GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
@ GPU_SHADER_SEQUENCER_THUMBS
#define GPU_SEQ_STRIP_DRAW_DATA_LEN
void GPU_texture_bind(GPUTexture *texture, int unit)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_free(GPUTexture *texture)
void GPU_texture_unbind(GPUTexture *texture)
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
void GPU_texture_update(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
unsigned char * IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, void **cache_handle)
void IMB_display_buffer_release(void *cache_handle)
void IMB_colormanagement_display_settings_from_ctx(const bContext *C, ColorManagedViewSettings **r_view_settings, ColorManagedDisplaySettings **r_display_settings)
struct GPUShader GPUShader
void append(const T &value)
void reserve(const int64_t min_capacity)
float pos_to_pixel_space_x(float x) const
float pos_to_pixel_space_y(float y) const
GPUUniformBuf * get_ubo_context() const
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
RAYTRACE_GROUP_SIZE additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo", "eevee_sampling_data", "eevee_utility_texture", "eevee_hiz_data", "draw_view") .specialization_constant(Type RAYTRACE_GROUP_SIZE in_sh_0_tx in_sh_2_tx screen_normal_tx GPU_RGBA8
void IMB_freeImBuf(ImBuf *)
no_perspective(Type::VEC2, "pos_interp") .no_perspective(Type fragColor SeqStripThumbData
T max(const T &a, const T &b)
static constexpr int SEQ_THUMB_SIZE
ImBuf * thumbnail_cache_get(const bContext *C, Scene *scene, const Sequence *seq, float timeline_frame)
bool strip_can_have_thumbnail(const Scene *scene, const Sequence *seq)
VecBase< float, 4 > float4
void draw_strip_thumbnails(TimelineDrawContext *ctx, ed::seq::StripsDrawBatch &strips_batch, const Vector< StripDrawContext > &strips)
static float thumb_calc_next_timeline_frame(const Sequence *seq, float left_handle, float last_frame, float frame_step)
static void seq_get_thumb_image_dimensions(const Sequence *seq, float pixelx, float pixely, float *r_thumb_width, float thumb_height, float *r_image_width, float *r_image_height)
static void get_seq_strip_thumbnails(const View2D *v2d, const bContext *C, Scene *scene, const StripDrawContext &strip, float pixelx, float pixely, bool is_muted, Vector< SeqThumbInfo > &r_thumbs)
static float thumb_calc_first_timeline_frame(const Sequence *seq, float left_handle, float frame_step, const rctf *view_area)
struct SequencerTimelineOverlay timeline_overlay
ed::seq::StripsDrawBatch & strips_batch_
GPUUniformBuf * ubo_thumbs_
void add_thumb(const SeqThumbInfo &info, float width, const rcti &rect, int tex_width, int tex_height)
Array< SeqStripThumbData > thumbs_
ThumbsDrawBatch(ed::seq::StripsDrawBatch &strips_batch, GPUTexture *atlas)
void wmOrtho2_region_pixelspace(const ARegion *region)