mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-02 04:20:16 +00:00
Use Graphics::drawSurface() with explicit Sampling/Paint options
This commit is contained in:
parent
feece489fe
commit
922f99ef87
2
laf
2
laf
@ -1 +1 @@
|
|||||||
Subproject commit f2110aef250cfdcd8ee5cb14fd28c3cbdfffa578
|
Subproject commit 34c67cd6f2be9dbb14f559b7fb16160318b07086
|
@ -149,14 +149,20 @@ private:
|
|||||||
g->drawText(text(), fg, bg,
|
g->drawText(text(), fg, bg,
|
||||||
gfx::Point(rc.x+2*guiscale(),
|
gfx::Point(rc.x+2*guiscale(),
|
||||||
rc.y+2*guiscale()));
|
rc.y+2*guiscale()));
|
||||||
g->drawRgbaSurface(
|
|
||||||
|
ui::Paint paint;
|
||||||
|
paint.blendMode(os::BlendMode::SrcOver);
|
||||||
|
|
||||||
|
g->drawSurface(
|
||||||
preview(),
|
preview(),
|
||||||
preview()->bounds(),
|
preview()->bounds(),
|
||||||
gfx::Rect(
|
gfx::Rect(
|
||||||
rc.x+2*guiscale(),
|
rc.x+2*guiscale(),
|
||||||
rc.y+4*guiscale()+textsz.h,
|
rc.y+4*guiscale()+textsz.h,
|
||||||
preview()->width()*guiscale(),
|
preview()->width()*guiscale(),
|
||||||
preview()->height()*guiscale()));
|
preview()->height()*guiscale()),
|
||||||
|
os::Sampling(),
|
||||||
|
&paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool m_matrixOnly;
|
bool m_matrixOnly;
|
||||||
|
@ -748,7 +748,8 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
|||||||
g->drawSurface(tmp.get(),
|
g->drawSurface(tmp.get(),
|
||||||
gfx::Rect(0, 0, rc2.w, rc2.h),
|
gfx::Rect(0, 0, rc2.w, rc2.h),
|
||||||
dest,
|
dest,
|
||||||
sampling);
|
sampling,
|
||||||
|
nullptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g->blit(tmp.get(), 0, 0, dest.x, dest.y, dest.w, dest.h);
|
g->blit(tmp.get(), 0, 0, dest.x, dest.y, dest.w, dest.h);
|
||||||
|
@ -465,9 +465,22 @@ void FileList::onPaint(ui::PaintEvent& ev)
|
|||||||
tbounds.shrink(1);
|
tbounds.shrink(1);
|
||||||
|
|
||||||
os::SurfaceRef thumbnail = m_selected->getThumbnail();
|
os::SurfaceRef thumbnail = m_selected->getThumbnail();
|
||||||
g->drawRgbaSurface(thumbnail.get(),
|
|
||||||
gfx::Rect(0, 0, thumbnail->width(), thumbnail->height()),
|
ui::Paint paint;
|
||||||
tbounds);
|
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);
|
tbounds.shrink(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
g->drawRgbaSurface(thumbnail.get(),
|
ui::Paint paint;
|
||||||
gfx::Rect(0, 0, thumbnail->width(), thumbnail->height()),
|
paint.blendMode(os::BlendMode::SrcOver);
|
||||||
tbounds);
|
|
||||||
|
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 {
|
else {
|
||||||
tbounds = gfx::Rect(0, 0, 20*guiscale(), 2+4*(8.0-m_zoom)/8.0*guiscale())
|
tbounds = gfx::Rect(0, 0, 20*guiscale(), 2+4*(8.0-m_zoom)/8.0*guiscale())
|
||||||
|
@ -246,21 +246,6 @@ void Graphics::drawSurface(os::Surface* surface, int x, int y)
|
|||||||
m_surface->drawSurface(surface, m_dx+x, m_dy+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,
|
void Graphics::drawSurface(os::Surface* surface,
|
||||||
const gfx::Rect& srcRect,
|
const gfx::Rect& srcRect,
|
||||||
const gfx::Rect& dstRect,
|
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);
|
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)
|
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()));
|
dirty(gfx::Rect(m_dx+x, m_dy+y, surface->width(), surface->height()));
|
||||||
|
@ -87,19 +87,13 @@ namespace ui {
|
|||||||
const gfx::Rect& outer, const gfx::Rect& inner);
|
const gfx::Rect& outer, const gfx::Rect& inner);
|
||||||
|
|
||||||
void drawSurface(os::Surface* surface, int x, int y);
|
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,
|
void drawSurface(os::Surface* surface,
|
||||||
const gfx::Rect& srcRect,
|
const gfx::Rect& srcRect,
|
||||||
const gfx::Rect& dstRect,
|
const gfx::Rect& dstRect,
|
||||||
const os::Sampling& sampling,
|
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 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, 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 x, int y);
|
||||||
void drawColoredRgbaSurface(os::Surface* surface, gfx::Color color, int srcx, int srcy, int dstx, int dsty, int w, int h);
|
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,
|
void drawSurfaceNine(os::Surface* surface,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user