55 const rctf *view_area)
57 int first_drawable_frame =
max_iii(left_handle, strip->
start, view_area->
xmin);
60 if (first_drawable_frame == left_handle) {
64 float aligned_frame_offset = int((first_drawable_frame - strip->
start) / frame_step) *
66 return strip->
start + aligned_frame_offset;
74 float next_frame = last_frame + frame_step;
77 if (last_frame == left_handle) {
78 next_frame = strip->
start + (int((last_frame - strip->
start) / frame_step) + 1) * frame_step;
90 float *r_image_height)
108 float thumb_h_px = thumb_height / pixely;
109 float thumb_width = aspect_ratio * thumb_h_px * pixelx;
111 *r_thumb_width = thumb_width;
139 const float crop_x_multiplier = 1.0f / pixelx / (thumb_height /
image_height / pixely);
150 while (timeline_frame < upper_thumb_bound) {
151 float thumb_x_end = timeline_frame + thumb_width;
152 bool clipped =
false;
155 if (timeline_frame > v2d->
cur.
xmax) {
160 float cut_off = 0.0f;
167 if (thumb_x_end > upper_thumb_bound) {
168 thumb_x_end = upper_thumb_bound;
172 float cropx_min = cut_off * crop_x_multiplier;
173 float cropx_max = (thumb_x_end - timeline_frame) * crop_x_multiplier;
174 if (cropx_max < 1.0f) {
180 if (ibuf ==
nullptr) {
197 thumb.
x1 = timeline_frame + cut_off;
198 thumb.
x2 = thumb_x_end;
241 const SeqThumbInfo &info,
float width,
const rcti &rect,
int tex_width,
int tex_height)
254 res.tint_color =
float4(1.0f, 1.0f, 1.0f, info.
is_muted ? 0.47f : 1.0f);
313 constexpr int ATLAS_WIDTH = 4096;
314 constexpr int ATLAS_MAX_HEIGHT = 4096;
317 int cur_row_height = 0;
321 int cropx_min = int(info.cropx_min);
322 int cropx_max = int(
math::ceil(info.cropx_max));
323 int width = cropx_max - cropx_min + 1;
324 int height = info.ibuf->y;
325 cur_row_height =
math::max(cur_row_height, height);
328 if (cur_row_x + width > ATLAS_WIDTH) {
329 cur_row_y += cur_row_height + 1;
330 cur_row_height = height;
332 if (cur_row_y > ATLAS_MAX_HEIGHT) {
338 rcti rect{cur_row_x, cur_row_x + width, cur_row_y, cur_row_y + height};
342 cur_row_x += width + 1;
346 const int tex_width = ATLAS_WIDTH;
347 const int tex_height = cur_row_y + cur_row_height;
351 const rcti &rect = rects[
i];
354 void *cache_handle =
nullptr;
356 info.
ibuf, view_settings, display_settings, &cache_handle);
357 if (display_buffer !=
nullptr && info.
ibuf !=
nullptr) {
360 int width = cropx_max - cropx_min + 1;
361 int height = info.
ibuf->
y;
362 const uchar *src = display_buffer + cropx_min * 4;
363 uchar *dst = &tex_data[(rect.
ymin * ATLAS_WIDTH + rect.
xmin) * 4];
364 for (
int y = 0;
y < height;
y++) {
365 memcpy(dst, src, width * 4);
366 src += info.
ibuf->
x * 4;
367 dst += ATLAS_WIDTH * 4;
380 blender::gpu::TextureFormat::UNORM_8_8_8_8,
393 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, blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
blender::gpu::Batch * GPU_batch_preset_quad()
void GPU_matrix_push_projection()
void GPU_matrix_pop_projection()
int GPU_shader_get_ubo_binding(blender::gpu::Shader *shader, const char *name)
int GPU_shader_get_sampler_binding(blender::gpu::Shader *shader, const char *name)
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
blender::gpu::Shader * GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
@ GPU_SHADER_SEQUENCER_THUMBS
#define GPU_SEQ_STRIP_DRAW_DATA_LEN
void GPU_texture_unbind(blender::gpu::Texture *texture)
void GPU_texture_extend_mode(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
blender::gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_filter_mode(blender::gpu::Texture *texture, bool use_filter)
void GPU_texture_bind(blender::gpu::Texture *texture, int unit)
void GPU_texture_free(blender::gpu::Texture *texture)
void GPU_texture_update(blender::gpu::Texture *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)
void IMB_freeImBuf(ImBuf *ibuf)
void append(const T &value)
void reserve(const int64_t min_capacity)
struct @021025263243242147216143265077100330027142264337::@225245033123204053237120173316075113304004012000 batch
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)
void draw_strip_thumbnails(TimelineDrawContext *ctx, StripsDrawBatch &strips_batch, const blender::Vector< StripDrawContext > &strips)
static void strip_get_thumb_image_dimensions(const Strip *strip, float pixelx, float pixely, float *r_thumb_width, float thumb_height, float *r_image_width, float *r_image_height)
static float thumb_calc_next_timeline_frame(const Strip *strip, float left_handle, float last_frame, float frame_step)
static float thumb_calc_first_timeline_frame(const Strip *strip, float left_handle, float frame_step, const rctf *view_area)
T max(const T &a, const T &b)
bool strip_can_have_thumbnail(const Scene *scene, const Strip *strip)
ImBuf * thumbnail_cache_get(const bContext *C, Scene *scene, const Strip *strip, float timeline_frame)
static constexpr int THUMB_SIZE
VecBase< float, 4 > float4
struct SequencerTimelineOverlay timeline_overlay
Array< SeqStripThumbData > thumbs_
StripsDrawBatch & strips_batch_
gpu::UniformBuf * ubo_thumbs_
ThumbsDrawBatch(StripsDrawBatch &strips_batch, gpu::Texture *atlas)
void add_thumb(const SeqThumbInfo &info, float width, const rcti &rect, int tex_width, int tex_height)
void wmOrtho2_region_pixelspace(const ARegion *region)