diff --git a/laf b/laf index f2110aef2..34c67cd6f 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit f2110aef250cfdcd8ee5cb14fd28c3cbdfffa578 +Subproject commit 34c67cd6f2be9dbb14f559b7fb16160318b07086 diff --git a/src/app/ui/dithering_selector.cpp b/src/app/ui/dithering_selector.cpp index 11656ff58..21de48680 100644 --- a/src/app/ui/dithering_selector.cpp +++ b/src/app/ui/dithering_selector.cpp @@ -149,14 +149,20 @@ private: g->drawText(text(), fg, bg, gfx::Point(rc.x+2*guiscale(), rc.y+2*guiscale())); - g->drawRgbaSurface( + + ui::Paint paint; + paint.blendMode(os::BlendMode::SrcOver); + + g->drawSurface( preview(), preview()->bounds(), gfx::Rect( rc.x+2*guiscale(), rc.y+4*guiscale()+textsz.h, preview()->width()*guiscale(), - preview()->height()*guiscale())); + preview()->height()*guiscale()), + os::Sampling(), + &paint); } bool m_matrixOnly; diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 7c9f97cf1..823d50d16 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -748,7 +748,8 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite g->drawSurface(tmp.get(), gfx::Rect(0, 0, rc2.w, rc2.h), dest, - sampling); + sampling, + nullptr); } else { g->blit(tmp.get(), 0, 0, dest.x, dest.y, dest.w, dest.h); diff --git a/src/app/ui/file_list.cpp b/src/app/ui/file_list.cpp index 162a3594c..ec2bdac66 100644 --- a/src/app/ui/file_list.cpp +++ b/src/app/ui/file_list.cpp @@ -465,9 +465,22 @@ void FileList::onPaint(ui::PaintEvent& ev) tbounds.shrink(1); os::SurfaceRef thumbnail = m_selected->getThumbnail(); - g->drawRgbaSurface(thumbnail.get(), - gfx::Rect(0, 0, thumbnail->width(), thumbnail->height()), - tbounds); + + ui::Paint paint; + paint.blendMode(os::BlendMode::SrcOver); + + os::Sampling sampling; + if (thumbnail->width() > tbounds.w && + thumbnail->height() > tbounds.h) { + sampling = os::Sampling(os::Sampling::Filter::Linear, + os::Sampling::Mipmap::Nearest); + } + + g->drawSurface(thumbnail.get(), + gfx::Rect(0, 0, thumbnail->width(), thumbnail->height()), + tbounds, + sampling, + &paint); } } @@ -561,9 +574,21 @@ void FileList::paintItem(ui::Graphics* g, IFileItem* fi, const int i) tbounds.shrink(1); } - g->drawRgbaSurface(thumbnail.get(), - gfx::Rect(0, 0, thumbnail->width(), thumbnail->height()), - tbounds); + ui::Paint paint; + paint.blendMode(os::BlendMode::SrcOver); + + os::Sampling sampling; + if (thumbnail->width() > tbounds.w && + thumbnail->height() > tbounds.h) { + sampling = os::Sampling(os::Sampling::Filter::Linear, + os::Sampling::Mipmap::Nearest); + } + + g->drawSurface(thumbnail.get(), + gfx::Rect(0, 0, thumbnail->width(), thumbnail->height()), + tbounds, + sampling, + &paint); } else { tbounds = gfx::Rect(0, 0, 20*guiscale(), 2+4*(8.0-m_zoom)/8.0*guiscale()) diff --git a/src/ui/graphics.cpp b/src/ui/graphics.cpp index 7775de8c2..9c75d28e7 100644 --- a/src/ui/graphics.cpp +++ b/src/ui/graphics.cpp @@ -246,21 +246,6 @@ void Graphics::drawSurface(os::Surface* surface, int x, int y) m_surface->drawSurface(surface, m_dx+x, m_dy+y); } -void Graphics::drawSurface(os::Surface* surface, - const gfx::Rect& srcRect, - const gfx::Rect& dstRect) -{ - dirty(gfx::Rect(m_dx+dstRect.x, m_dy+dstRect.y, - dstRect.w, dstRect.h)); - - os::SurfaceLock lockSrc(surface); - os::SurfaceLock lockDst(m_surface.get()); - m_surface->drawSurface( - surface, - srcRect, - gfx::Rect(dstRect).offset(m_dx, m_dy)); -} - void Graphics::drawSurface(os::Surface* surface, const gfx::Rect& srcRect, const gfx::Rect& dstRect, @@ -298,21 +283,6 @@ void Graphics::drawRgbaSurface(os::Surface* surface, int srcx, int srcy, int dst m_surface->drawRgbaSurface(surface, srcx, srcy, m_dx+dstx, m_dy+dsty, w, h); } -void Graphics::drawRgbaSurface(os::Surface* surface, - const gfx::Rect& srcRect, - const gfx::Rect& dstRect) -{ - dirty(gfx::Rect(m_dx+dstRect.x, m_dy+dstRect.y, - dstRect.w, dstRect.h)); - - os::SurfaceLock lockSrc(surface); - os::SurfaceLock lockDst(m_surface.get()); - m_surface->drawRgbaSurface( - surface, - srcRect, - gfx::Rect(dstRect).offset(m_dx, m_dy)); -} - void Graphics::drawColoredRgbaSurface(os::Surface* surface, gfx::Color color, int x, int y) { dirty(gfx::Rect(m_dx+x, m_dy+y, surface->width(), surface->height())); diff --git a/src/ui/graphics.h b/src/ui/graphics.h index 6ef87d690..c924ac50f 100644 --- a/src/ui/graphics.h +++ b/src/ui/graphics.h @@ -87,19 +87,13 @@ namespace ui { const gfx::Rect& outer, const gfx::Rect& inner); void drawSurface(os::Surface* surface, int x, int y); - void drawSurface(os::Surface* surface, - const gfx::Rect& srcRect, - const gfx::Rect& dstRect); void drawSurface(os::Surface* surface, const gfx::Rect& srcRect, const gfx::Rect& dstRect, const os::Sampling& sampling, - const ui::Paint* paint = nullptr); + const ui::Paint* paint); void drawRgbaSurface(os::Surface* surface, int x, int y); void drawRgbaSurface(os::Surface* surface, int srcx, int srcy, int dstx, int dsty, int w, int h); - void drawRgbaSurface(os::Surface* surface, - const gfx::Rect& srcRect, - const gfx::Rect& dstRect); void drawColoredRgbaSurface(os::Surface* surface, gfx::Color color, int x, int y); void drawColoredRgbaSurface(os::Surface* surface, gfx::Color color, int srcx, int srcy, int dstx, int dsty, int w, int h); void drawSurfaceNine(os::Surface* surface,