Skip to content

Commit

Permalink
Paintable: improve isNull and no longer keep m_source
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Sep 21, 2024
1 parent 6e3e0ac commit 5458b4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/widget/paintable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ QString Paintable::DrawModeToString(DrawMode mode) {
}

Paintable::Paintable(const PixmapSource& source, DrawMode mode, double scaleFactor)
: m_drawMode(mode),
m_source(source) {
: m_drawMode(mode) {
if (!source.isSVG()) {
m_pPixmap.reset(WPixmapStore::getPixmapNoCache(source.getPath(), scaleFactor));
} else {
Expand Down Expand Up @@ -97,7 +96,7 @@ Paintable::Paintable(const PixmapSource& source, DrawMode mode, double scaleFact
}

bool Paintable::isNull() const {
return m_source.isEmpty();
return !(m_pPixmap || m_pSvg);
}

QSize Paintable::size() const {
Expand Down
1 change: 0 additions & 1 deletion src/widget/paintable.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ class Paintable {
std::unique_ptr<QPixmap> m_pPixmap;
std::unique_ptr<QSvgRenderer> m_pSvg;
DrawMode m_drawMode;
PixmapSource m_source;
};

0 comments on commit 5458b4b

Please sign in to comment.