X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fjpeg_frame_view.cpp;h=943b3e15ac5858886472c1866371debc9e6eb733;hb=HEAD;hp=af894328dc1f27cd311796707d16d3327e685692;hpb=26a5c1c6a939fba538d96254181f32218ac42b71;p=nageru
diff --git a/futatabi/jpeg_frame_view.cpp b/futatabi/jpeg_frame_view.cpp
index af89432..6dafb3e 100644
--- a/futatabi/jpeg_frame_view.cpp
+++ b/futatabi/jpeg_frame_view.cpp
@@ -182,8 +182,10 @@ shared_ptr decode_jpeg(const string &jpeg)
}
if (!error_mgr.run([&dinfo, &y_pix, &cb_pix, &cr_pix, pitch_y, pitch_chroma, v_mcu_size, mcu_height_blocks] {
- JSAMPROW yptr[v_mcu_size], cbptr[v_mcu_size], crptr[v_mcu_size];
- JSAMPARRAY data[3] = { yptr, cbptr, crptr };
+ unique_ptr yptr(new JSAMPROW[v_mcu_size]);
+ unique_ptr cbptr(new JSAMPROW[v_mcu_size]);
+ unique_ptr crptr(new JSAMPROW[v_mcu_size]);
+ JSAMPARRAY data[3] = { yptr.get(), cbptr.get(), crptr.get() };
for (unsigned y = 0; y < mcu_height_blocks; ++y) {
// NOTE: The last elements of cbptr/crptr will be unused for vertically subsampled chroma.
for (unsigned yy = 0; yy < v_mcu_size; ++yy) {
@@ -210,6 +212,7 @@ shared_ptr decode_jpeg(const string &jpeg)
glFlushMappedNamedBufferRange(pbo.pbo, 0, dinfo.image_width * dinfo.image_height + chroma_width * chroma_height * 2);
glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT);
pbo.upload_done = RefCountedGLsync(GL_SYNC_GPU_COMMANDS_COMPLETE, /*flags=*/0);
+ glFlush();
frame->uploaded_ui_thread = pbo.upload_done;
frame->uploaded_interpolation = pbo.upload_done;
global_pbo_pool->release_pbo(move(pbo));
@@ -411,6 +414,7 @@ void JPEGFrameView::setFrame(shared_ptr frame)
lock_guard lock(cache_mu);
PendingDecode decode;
decode.frame = std::move(frame);
+ decode.fade_alpha = 0.0f;
pending_decodes.push_back(decode);
any_pending_decodes.notify_all();
}