diff --git a/src/prefs/appearance/DecView.cpp b/src/prefs/appearance/DecView.cpp index 5adb7f6bd5..65b8bd6cff 100644 --- a/src/prefs/appearance/DecView.cpp +++ b/src/prefs/appearance/DecView.cpp @@ -108,6 +108,7 @@ DecView::DecView(BRect frame, const char *name, int32 resize, int32 flags) LoadSettings(); BString path(ConvertIndexToPath(0L)); + if(LoadDecorator(path.String())) { driver->FillRect(preview_bounds,&ldata); @@ -150,7 +151,7 @@ void DecView::MessageReceived(BMessage *msg) } case DECORATOR_CHOSEN: { - + STRACE(("MSG: Decorator Chosen - #%ld\n",declist->CurrentSelection())); bool success=false; diff --git a/src/prefs/appearance/PreviewDriver.cpp b/src/prefs/appearance/PreviewDriver.cpp index 538839a6ab..e3b0f3df28 100644 --- a/src/prefs/appearance/PreviewDriver.cpp +++ b/src/prefs/appearance/PreviewDriver.cpp @@ -58,6 +58,8 @@ #include "PreviewDriver.h" #include "LayerData.h" #include "ColorSet.h" +#include +#include FT_FREETYPE_H BRect preview_bounds(0,0,150,150);; @@ -212,3 +214,32 @@ void PreviewDriver::StrokeSolidRect(const BRect &rect, RGBColor &color) view->viewbmp->Unlock(); } +bool PreviewDriver::AcquireBuffer(FBBitmap *bmp) +{ + if(!bmp) + return false; + + view->viewbmp->Lock(); + bmp->SetBuffer(view->viewbmp->Bits()); + bmp->SetSpace(view->viewbmp->ColorSpace()); + bmp->SetBytesPerRow(view->viewbmp->BytesPerRow()); + bmp->SetSize(view->viewbmp->Bounds().IntegerWidth(), + view->viewbmp->Bounds().IntegerHeight()); + bmp->SetBitsPerPixel(view->viewbmp->ColorSpace(),view->viewbmp->BytesPerRow()); + + return true; +} + +void PreviewDriver::ReleaseBuffer(void) +{ + view->viewbmp->Unlock(); +} +bool PreviewDriver::Lock(bigtime_t timeout=B_INFINITE_TIMEOUT) +{ + return view->viewbmp->Lock(); +} + +void PreviewDriver::Unlock(void) +{ + view->viewbmp->Unlock(); +} diff --git a/src/prefs/appearance/PreviewDriver.h b/src/prefs/appearance/PreviewDriver.h index 16da482a6d..f19a3f1599 100644 --- a/src/prefs/appearance/PreviewDriver.h +++ b/src/prefs/appearance/PreviewDriver.h @@ -75,6 +75,9 @@ public: void SetMode(const display_mode &mode); BView *View(void) { return (BView*)view; }; + virtual bool Lock(bigtime_t timeout=B_INFINITE_TIMEOUT); + virtual void Unlock(void); + protected: virtual void FillSolidRect(const BRect &rect, RGBColor &color); virtual void FillPatternRect(const BRect &rect, const DrawData *d); @@ -82,6 +85,9 @@ protected: virtual void StrokePatternLine(const BPoint &start, const BPoint &end, const DrawData *d); virtual void StrokeSolidRect(const BRect &rect, RGBColor &color); + virtual bool AcquireBuffer(FBBitmap *bmp); + virtual void ReleaseBuffer(void); + BBitmap *framebuffer; BView *drawview;