diff --git a/src/apps/showimage/ShowImageView.cpp b/src/apps/showimage/ShowImageView.cpp index c6295f9520..81643918de 100644 --- a/src/apps/showimage/ShowImageView.cpp +++ b/src/apps/showimage/ShowImageView.cpp @@ -192,12 +192,7 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode, fZoom(1.0), - fDither(BScreen().ColorSpace() == B_CMAP8), fScaleBilinear(true), - fScaler(NULL), -#if DELAYED_SCALING - fScalingCountDown(SCALING_DELAY_TIME), -#endif fBitmapLocationInView(0.0, 0.0), @@ -222,7 +217,6 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode, ShowImageSettings* settings; settings = my_app->Settings(); if (settings->Lock()) { - fDither = settings->GetBool("Dither", fDither); fShrinkToBounds = settings->GetBool("ShrinkToBounds", fShrinkToBounds); fZoomToBounds = settings->GetBool("ZoomToBounds", fZoomToBounds); fSlideShowDelay = settings->GetInt32("SlideShowDelay", fSlideShowDelay); @@ -274,17 +268,6 @@ ShowImageView::Pulse() else fHideCursorCountDown--; } - -#if DELAYED_SCALING - if (fBitmap && (fScaleBilinear || fDither) && fScalingCountDown > 0) { - if (fScalingCountDown == 1) { - fScalingCountDown = 0; - _GetScaler(_AlignBitmap()); - } else { - fScalingCountDown --; - } - } -#endif } @@ -376,24 +359,9 @@ ShowImageView::_UpdateStatusText() } -void -ShowImageView::_DeleteScaler() -{ - if (fScaler) { - fScaler->Stop(); - delete fScaler; - fScaler = NULL; - } -#if DELAYED_SCALING - fScalingCountDown = SCALING_DELAY_TIME; -#endif -} - - void ShowImageView::_DeleteBitmap() { - _DeleteScaler(); _DeleteSelectionBitmap(); if (fDisplayBitmap != fBitmap) @@ -615,17 +583,6 @@ ShowImageView::_SetSelection(const entry_ref *ref, BPoint point) } -void -ShowImageView::SetDither(bool dither) -{ - if (fDither != dither) { - _SettingsSetBool("Dither", dither); - fDither = dither; - Invalidate(); - } -} - - void ShowImageView::SetShowCaption(bool show) { @@ -871,40 +828,9 @@ ShowImageView::_UpdateCaption() } -Scaler* -ShowImageView::_GetScaler(BRect rect) -{ - if (fScaler == NULL || !fScaler->Matches(rect, fDither)) { - _DeleteScaler(); - BMessenger msgr(this, Window()); - fScaler = new Scaler(fDisplayBitmap, rect, msgr, MSG_INVALIDATE, fDither); - fScaler->Start(); - } - return fScaler; -} - - void ShowImageView::_DrawImage(BRect rect) { - if (fDither) { -#if DELAYED_SCALING - Scaler* scaler = fScaler; - if (scaler != NULL && !scaler->Matches(rect, fDither)) { - _DeleteScaler(); scaler = NULL; - } -#else - Scaler* scaler = _GetScaler(rect); -#endif - if (scaler != NULL && !scaler->IsRunning()) { - BBitmap* bitmap = scaler->GetBitmap(); - - if (bitmap) { - DrawBitmap(bitmap, BPoint(rect.left, rect.top)); - return; - } - } - } // TODO: fix composing of fBitmap with other bitmaps // with regard to alpha channel if (!fDisplayBitmap) @@ -2276,9 +2202,6 @@ ShowImageView::_FirstFile() void ShowImageView::SetZoom(BPoint where, float zoom) { - if ((fScaleBilinear || fDither) && fZoom != zoom) - _DeleteScaler(); - // Invalidate before scrolling, as that prevents the app_server // to do the scrolling server side Invalidate(); diff --git a/src/apps/showimage/ShowImageView.h b/src/apps/showimage/ShowImageView.h index 44bae2414b..75345b27f7 100644 --- a/src/apps/showimage/ShowImageView.h +++ b/src/apps/showimage/ShowImageView.h @@ -27,12 +27,6 @@ #include -// Delay scaling operation, so that a sequence of zoom in/out operations works -// smoother -#define DELAYED_SCALING 1 -// the delay time in 1/10 seconds -#define SCALING_DELAY_TIME 3 - // the delay time for hiding the cursor in 1/10 seconds (the pulse rate) #define HIDE_CURSOR_DELAY_TIME 20 @@ -72,7 +66,6 @@ public: void SaveToFile(BDirectory* dir, const char* name, BBitmap* bitmap, const translation_format* format); - void SetDither(bool dither); void SetScaleBilinear(bool b); bool GetScaleBilinear() { return fScaleBilinear; } void SetShowCaption(bool show); @@ -214,7 +207,6 @@ private: void _DrawCaption(); void _UpdateCaption(); - Scaler* _GetScaler(BRect rect); void _DrawImage(BRect rect); float _LimitToRange(float v, orientation o, bool absolute); @@ -246,12 +238,7 @@ private: float fZoom; - bool fDither; bool fScaleBilinear; - Scaler* fScaler; -#if DELAYED_SCALING - int fScalingCountDown; -#endif BPoint fBitmapLocationInView; diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp index a251f2ea8d..e4512ad6a1 100644 --- a/src/apps/showimage/ShowImageWindow.cpp +++ b/src/apps/showimage/ShowImageWindow.cpp @@ -1293,10 +1293,3 @@ ShowImageWindow::QuitRequested() return quit; } - - -void -ShowImageWindow::ScreenChanged(BRect frame, color_space mode) -{ - fImageView->SetDither(mode == B_CMAP8); -} diff --git a/src/apps/showimage/ShowImageWindow.h b/src/apps/showimage/ShowImageWindow.h index 44a28d8fd4..afae323471 100644 --- a/src/apps/showimage/ShowImageWindow.h +++ b/src/apps/showimage/ShowImageWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2003-2010, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -26,72 +26,78 @@ class ShowImageStatusView; class ShowImageWindow : public BWindow { - public: - ShowImageWindow(const entry_ref *ref, const BMessenger& trackerMessenger); - virtual ~ShowImageWindow(); +public: + ShowImageWindow(const entry_ref* ref, + const BMessenger& trackerMessenger); + virtual ~ShowImageWindow(); - virtual void FrameResized(float width, float height); - virtual void MessageReceived(BMessage *message); - virtual bool QuitRequested(); - virtual void ScreenChanged(BRect frame, color_space mode); + virtual void FrameResized(float width, float height); + virtual void MessageReceived(BMessage* message); + virtual bool QuitRequested(); - status_t InitCheck(); - ShowImageView* GetShowImageView() const { return fImageView; } + status_t InitCheck(); + ShowImageView* GetShowImageView() const { return fImageView; } - void UpdateTitle(); - void AddMenus(BMenuBar *bar); - void BuildContextMenu(BMenu *menu); - void WindowRedimension(BBitmap *bitmap); + void UpdateTitle(); + void AddMenus(BMenuBar* bar); + void BuildContextMenu(BMenu* menu); + void WindowRedimension(BBitmap* bitmap); - private: - class RecentDocumentsMenu; +private: + class RecentDocumentsMenu; - void _BuildViewMenu(BMenu *menu, bool popupMenu); - BMenuItem* _AddItemMenu(BMenu *menu, const char *label, - uint32 what, const char shortcut, uint32 modifier, - const BHandler *target, bool enabled = true); - BMenuItem* _AddDelayItem(BMenu *menu, const char *label, float value); + void _BuildViewMenu(BMenu* menu, bool popupMenu); + BMenuItem* _AddItemMenu(BMenu* menu, const char* label, + uint32 what, const char shortcut, + uint32 modifier, const BHandler* target, + bool enabled = true); + BMenuItem* _AddDelayItem(BMenu* menu, const char* label, + float value); - bool _ToggleMenuItem(uint32 what); - void _EnableMenuItem(BMenu *menu, uint32 what, bool enable); - void _MarkMenuItem(BMenu *menu, uint32 what, bool marked); - void _MarkSlideShowDelay(float value); - void _ResizeToWindow(bool shrink, uint32 what); + bool _ToggleMenuItem(uint32 what); + void _EnableMenuItem(BMenu* menu, uint32 what, + bool enable); + void _MarkMenuItem(BMenu* menu, uint32 what, + bool marked); + void _MarkSlideShowDelay(float value); + void _ResizeToWindow(bool shrink, uint32 what); - void _SaveAs(BMessage *message); - // Handle Save As submenu choice - void _SaveToFile(BMessage *message); - // Handle save file panel message - bool _ClosePrompt(); - void _ToggleFullScreen(); - void _LoadSettings(); - void _SavePrintOptions(); - bool _PageSetup(); - void _PrepareForPrint(); - void _Print(BMessage *msg); + void _SaveAs(BMessage* message); + // Handle Save As submenu choice + void _SaveToFile(BMessage* message); + // Handle save file panel message + bool _ClosePrompt(); + void _ToggleFullScreen(); + void _LoadSettings(); + void _SavePrintOptions(); + bool _PageSetup(); + void _PrepareForPrint(); + void _Print(BMessage* msg); - void _OpenResizerWindow(int32 width, int32 height); - void _UpdateResizerWindow(int32 width, int32 height); - void _CloseResizerWindow(); + void _OpenResizerWindow(int32 width, int32 height); + void _UpdateResizerWindow(int32 width, int32 height); + void _CloseResizerWindow(); - BFilePanel* fSavePanel; - BMenuBar* fBar; - BMenu* fOpenMenu; - BMenu* fBrowseMenu; - BMenu* fGoToPageMenu; - BMenu* fSlideShowDelay; - ShowImageView* fImageView; - ShowImageStatusView* fStatusView; - bool fModified; - bool fFullScreen; - BRect fWindowFrame; - bool fShowCaption; - BMessage* fPrintSettings; - PrintOptions fPrintOptions; - BMessenger* fResizerWindowMessenger; - BMenuItem* fResizeItem; - int32 fHeight; - int32 fWidth; +private: + BFilePanel* fSavePanel; + BMenuBar* fBar; + BMenu* fOpenMenu +; BMenu* fBrowseMenu; + BMenu* fGoToPageMenu; + BMenu* fSlideShowDelay; + ShowImageView* fImageView; + ShowImageStatusView* fStatusView; + bool fModified; + bool fFullScreen; + BRect fWindowFrame; + bool fShowCaption; + BMessage* fPrintSettings; + PrintOptions fPrintOptions; + BMessenger* fResizerWindowMessenger; + BMenuItem* fResizeItem; + int32 fHeight; + int32 fWidth; }; + #endif // SHOW_IMAGE_WINDOW_H