diff --git a/addons/AddOns/Sharpness/Sharpness.cpp b/addons/AddOns/Sharpness/Sharpness.cpp index d9138263..09bf867e 100644 --- a/addons/AddOns/Sharpness/Sharpness.cpp +++ b/addons/AddOns/Sharpness/Sharpness.cpp @@ -398,12 +398,15 @@ SharpnessManipulator::ChangeSettings(ManipulatorSettings* s) new_settings = dynamic_cast(s); if (new_settings != NULL) { if (new_settings->blur_size != settings.blur_size) { + BBitmap* tmp_bitmap = DuplicateBitmap(copy_of_the_preview_bitmap, 0); + ipLibrary->gaussian_blur(tmp_bitmap, new_settings->blur_size, processor_count); + int32* d_bits = (int32*)blurred_image->Bits(); - int32* s_bits = (int32*)copy_of_the_preview_bitmap->Bits(); - int32 bits_length = blurred_image->BitsLength(); + int32* s_bits = (int32*)tmp_bitmap->Bits(); + int32 bits_length = tmp_bitmap->BitsLength(); memcpy(d_bits, s_bits, bits_length); - ipLibrary->gaussian_blur(blurred_image, new_settings->blur_size, processor_count); + delete tmp_bitmap; } settings = *new_settings; @@ -442,6 +445,7 @@ SharpnessManipulatorView::SharpnessManipulatorView(SharpnessManipulator* manip, blur_size_slider = new BSlider("blur_size_slider", B_TRANSLATE("Effect strength:"), new BMessage(BLUR_ADJUSTING_FINISHED), 1, 50, B_HORIZONTAL, B_TRIANGLE_THUMB); + blur_size_slider->SetModificationMessage(new BMessage(BLUR_ADJUSTED)); blur_size_slider->SetLimitLabels(B_TRANSLATE("Low"), B_TRANSLATE("High")); blur_size_slider->SetHashMarks(B_HASH_MARKS_BOTTOM); blur_size_slider->SetHashMarkCount(11); @@ -491,8 +495,18 @@ SharpnessManipulatorView::MessageReceived(BMessage* message) manipulator->ChangeSettings(&settings); target.SendMessage(HS_MANIPULATOR_ADJUSTING_FINISHED); } break; + case BLUR_ADJUSTED: + { + settings.blur_size = blur_size_slider->Value(); + manipulator->ChangeSettings(&settings); + if (!started_adjusting) { + target.SendMessage(HS_MANIPULATOR_ADJUSTING_STARTED); + started_adjusting = TRUE; + } + } case BLUR_ADJUSTING_FINISHED: { + started_adjusting = FALSE; settings.blur_size = blur_size_slider->Value(); manipulator->ChangeSettings(&settings); target.SendMessage(HS_MANIPULATOR_ADJUSTING_FINISHED); diff --git a/addons/AddOns/Sharpness/Sharpness.h b/addons/AddOns/Sharpness/Sharpness.h index 3069c7ad..4b7f7d4a 100644 --- a/addons/AddOns/Sharpness/Sharpness.h +++ b/addons/AddOns/Sharpness/Sharpness.h @@ -116,6 +116,7 @@ class SharpnessManipulator : public WindowGUIManipulator { #define SHARPNESS_ADJUSTED 'Shad' #define SHARPNESS_ADJUSTING_FINISHED 'Shaf' +#define BLUR_ADJUSTED 'Blad' #define BLUR_ADJUSTING_FINISHED 'Blaf'