From 30bd2c8c2930617419f62b71a72403d99fd61ee2 Mon Sep 17 00:00:00 2001 From: Andrew Lindesay Date: Mon, 20 Apr 2020 10:08:48 +1200 Subject: [PATCH] HaikuDepot: Fix Icon Backgrounds Some icons are not correctly observing the color of the background view they are drawing on. This commit will fix that problem. Resolves #14587 Change-Id: Icdd3eda915c985eba3517f888f29ccb2f8278487 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2500 Reviewed-by: waddlesplash --- src/apps/haikudepot/ui_generic/BitmapView.cpp | 22 +++++-------------- src/apps/haikudepot/ui_generic/BitmapView.h | 6 +---- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/apps/haikudepot/ui_generic/BitmapView.cpp b/src/apps/haikudepot/ui_generic/BitmapView.cpp index 9eab1a8d3a..ccdeab1087 100644 --- a/src/apps/haikudepot/ui_generic/BitmapView.cpp +++ b/src/apps/haikudepot/ui_generic/BitmapView.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013, Stephan Aßmus . + * Copyright 2020, Andrew Lindesay . * All rights reserved. Distributed under the terms of the MIT License. */ @@ -14,10 +15,12 @@ BitmapView::BitmapView(const char* name) : - BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), + BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE + | B_TRANSPARENT_BACKGROUND), fBitmap(NULL), fScaleBitmap(true) { + SetViewColor(B_TRANSPARENT_COLOR); } @@ -26,18 +29,10 @@ BitmapView::~BitmapView() } -void -BitmapView::AllAttached() -{ - AdoptParentColors(); -} - - void BitmapView::Draw(BRect updateRect) { BRect bounds(Bounds()); - DrawBackground(bounds, updateRect); if (fBitmap == NULL) return; @@ -165,11 +160,4 @@ BitmapView::SetScaleBitmap(bool scaleBitmap) fScaleBitmap = scaleBitmap; Invalidate(); -} - - -void -BitmapView::DrawBackground(BRect& bounds, BRect updateRect) -{ - FillRect(updateRect, B_SOLID_LOW); -} +} \ No newline at end of file diff --git a/src/apps/haikudepot/ui_generic/BitmapView.h b/src/apps/haikudepot/ui_generic/BitmapView.h index d2a706c9fb..117813692f 100644 --- a/src/apps/haikudepot/ui_generic/BitmapView.h +++ b/src/apps/haikudepot/ui_generic/BitmapView.h @@ -1,5 +1,6 @@ /* * Copyright 2013, Stephan Aßmus . + * Copyright 2020, Andrew Lindesay . * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef BITMAP_VIEW_H @@ -17,7 +18,6 @@ public: virtual ~BitmapView(); - virtual void AllAttached(); virtual void Draw(BRect updateRect); virtual BSize MinSize(); @@ -30,10 +30,6 @@ public: void UnsetBitmap(); void SetScaleBitmap(bool scaleBitmap); -protected: - virtual void DrawBackground(BRect& bounds, - BRect updateRect); - private: BitmapRef fReference; SharedBitmap::Size fBitmapSize;