mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
[lua] Cache temporal surface in GraphicsContext::drawImage()
This commit is contained in:
parent
c280732fb1
commit
87cd81b9f6
@ -56,7 +56,14 @@ void GraphicsContext::drawImage(const doc::Image* img,
|
||||
if (srcRc.isEmpty() || dstRc.isEmpty())
|
||||
return; // Do nothing for empty rectangles
|
||||
|
||||
auto tmpSurface = os::instance()->makeRgbaSurface(srcRc.w, srcRc.h);
|
||||
static os::SurfaceRef tmpSurface = nullptr;
|
||||
if (!tmpSurface ||
|
||||
tmpSurface->width() < srcRc.w ||
|
||||
tmpSurface->height() < srcRc.h) {
|
||||
tmpSurface = os::instance()->makeRgbaSurface(
|
||||
std::max(srcRc.w, (tmpSurface ? tmpSurface->width(): 0)),
|
||||
std::max(srcRc.h, (tmpSurface ? tmpSurface->height(): 0)));
|
||||
}
|
||||
if (tmpSurface) {
|
||||
convert_image_to_surface(
|
||||
img,
|
||||
|
Loading…
Reference in New Issue
Block a user