From ed00c2ba72366561a02b809d20a2a20ee2d7265c Mon Sep 17 00:00:00 2001 From: Sergio Gonzalez Date: Tue, 16 May 2017 22:00:11 -0500 Subject: [PATCH] off-by-one fix in stroke length;loading old mlt - invert view center --- src/gui.cc | 6 +++--- src/hardware_renderer.cc | 4 ++-- src/milton.cc | 2 +- src/persist.cc | 6 ++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gui.cc b/src/gui.cc index 725d631e..11e0c3f7 100644 --- a/src/gui.cc +++ b/src/gui.cc @@ -260,9 +260,9 @@ milton_imgui_tick(MiltonInput* input, PlatformState* platform_state, MiltonStat milton_state->flags |= MiltonStateFlags_IGNORE_NEXT_CLICKUP; } // History - if ( ImGui::MenuItem("History") ) { - input->mode_to_set = MiltonMode_HISTORY; - } + // if ( ImGui::MenuItem("History") ) { + // input->mode_to_set = MiltonMode_HISTORY; + // } ImGui::EndMenu(); } if ( ImGui::BeginMenu(LOC(view)) ) { diff --git a/src/hardware_renderer.cc b/src/hardware_renderer.cc index 002166c4..92614a66 100644 --- a/src/hardware_renderer.cc +++ b/src/hardware_renderer.cc @@ -1556,8 +1556,7 @@ gpu_render(RenderData* render_data, i32 view_x, i32 view_y, i32 view_width, i32 } void -gpu_render_to_buffer(MiltonState* milton_state, u8* buffer, i32 scale, i32 x, i32 y, - i32 w, i32 h, f32 background_alpha) +gpu_render_to_buffer(MiltonState* milton_state, u8* buffer, i32 scale, i32 x, i32 y, i32 w, i32 h, f32 background_alpha) { CanvasView saved_view = *milton_state->view; RenderData* render_data = milton_state->render_data; @@ -1600,6 +1599,7 @@ gpu_render_to_buffer(MiltonState* milton_state, u8* buffer, i32 scale, i32 x, i3 gpu_clip_strokes_and_update(&milton_state->root_arena, render_data, milton_state->view, milton_state->canvas->root_layer, &milton_state->working_stroke, 0, 0, buf_w, buf_h); + render_data->flags |= RenderDataFlags_WITH_BLUR; gpu_render_canvas(render_data, 0, 0, buf_w, buf_h, background_alpha); diff --git a/src/milton.cc b/src/milton.cc index 861788a8..a13d61f6 100644 --- a/src/milton.cc +++ b/src/milton.cc @@ -204,7 +204,7 @@ milton_stroke_input(MiltonState* milton_state, MiltonInput* input) } // Cleared to be appended. - if ( passed_inspection && ws->num_points < STROKE_MAX_POINTS ) { + if ( passed_inspection && ws->num_points < (STROKE_MAX_POINTS-1) ) { if ( milton_brush_smoothing_enabled(milton_state) ) { // Stroke smoothing. // Change canvas_point depending on the average of the last `N` points. diff --git a/src/persist.cc b/src/persist.cc index c9151706..2b2afaf0 100644 --- a/src/persist.cc +++ b/src/persist.cc @@ -99,7 +99,7 @@ milton_load(MiltonState* milton_state) milton_reset_canvas(milton_state); CanvasState* canvas = milton_state->canvas; -#define READ(address, size, num, fd) do { ok = fread_checked(address,size,num,fd); if (!ok){goto END;} } while(0) +#define READ(address, size, num, fd) do { ok = fread_checked(address,size,num,fd); if (!ok){ goto END; } } while(0) // Unload gpu data if the strokes have been cooked. gpu_free_strokes(milton_state->render_data, milton_state->canvas); @@ -110,7 +110,6 @@ milton_load(MiltonState* milton_state) if ( fd ) { u32 milton_binary_version = (u32)-1; - u32 milton_magic = (u32)-1; READ(&milton_magic, sizeof(u32), 1, fd); READ(&milton_binary_version, sizeof(u32), 1, fd); @@ -147,7 +146,7 @@ milton_load(MiltonState* milton_state) milton_state->view->screen_size = legacy_view.screen_size; milton_state->view->scale = legacy_view.scale; milton_state->view->zoom_center = legacy_view.zoom_center; - milton_state->view->pan_center = VEC2L(legacy_view.pan_center); + milton_state->view->pan_center = VEC2L(legacy_view.pan_center * -1); milton_state->view->background_color = legacy_view.background_color; milton_state->view->working_layer_id = legacy_view.working_layer_id; milton_state->view->num_layers = legacy_view.num_layers; @@ -201,7 +200,6 @@ milton_load(MiltonState* milton_state) READ(&stroke.brush, sizeof(Brush), 1, fd); READ(&stroke.num_points, sizeof(i32), 1, fd); - if ( stroke.num_points >= STROKE_MAX_POINTS || stroke.num_points <= 0 ) { milton_log("ERROR: File has a stroke with %d points\n", stroke.num_points);