1
0
mirror of https://github.com/aseprite/aseprite.git synced 2025-04-03 07:20:46 +00:00

Minor changes in IntertwineAsPixelPerfect

This commit is contained in:
David Capello 2021-06-29 19:07:37 -03:00
parent 3f778b0ec2
commit 5873a64abd

@ -588,9 +588,8 @@ protected:
Intertwine::doTransformPoint(pt, loop); Intertwine::doTransformPoint(pt, loop);
if (loop->getLayer()->isTilemap()) { if (loop->getLayer()->isTilemap() && m_tempTileset)
updateTempTileset(loop, pt); updateTempTileset(loop, pt);
}
} }
private: private:
@ -631,13 +630,12 @@ private:
loop->getDstImage()->copy( loop->getDstImage()->copy(
existentTileImage.get(), existentTileImage.get(),
gfx::Clip(tilePos.x, tilePos.y, 0, 0, gfx::Clip(tilePos.x, tilePos.y, 0, 0,
existentTileImage.get()->width(), existentTileImage->width(),
existentTileImage.get()->height())); existentTileImage->height()));
}); });
} }
ImageRef i(Image::create(loop->getDstImage()->pixelFormat(), a.w, a.h)); ImageRef i(crop_image(loop->getDstImage(), a, loop->getDstImage()->maskColor()));
i->copy(loop->getDstImage(), gfx::Clip(0, 0, a));
m_savedAreas.push_back(SavedArea{ i, pt, a }); m_savedAreas.push_back(SavedArea{ i, pt, a });
} }
} }
@ -679,8 +677,7 @@ private:
} }
void updateTempTileset(ToolLoop* loop, const tools::Stroke::Pt& pt) { void updateTempTileset(ToolLoop* loop, const tools::Stroke::Pt& pt) {
if (!m_tempTileset) ASSERT(m_tempTileset);
return;
gfx::Rect r; gfx::Rect r;
loop->getPointShape()->getModifiedArea(loop, pt.x, pt.y, r); loop->getPointShape()->getModifiedArea(loop, pt.x, pt.y, r);
@ -704,8 +701,8 @@ private:
loop->getDstImage()->copy( loop->getDstImage()->copy(
existentTileImage.get(), existentTileImage.get(),
gfx::Clip(tilePos.x, tilePos.y, 0, 0, gfx::Clip(tilePos.x, tilePos.y, 0, 0,
existentTileImage.get()->width(), existentTileImage->width(),
existentTileImage.get()->height())); existentTileImage->height()));
}); });
} }
} }
@ -733,9 +730,8 @@ private:
const doc::tile_index ti = doc::tile_geti(t); const doc::tile_index ti = doc::tile_geti(t);
const doc::ImageRef existentTileImage = m_tempTileset->get(ti); const doc::ImageRef existentTileImage = m_tempTileset->get(ti);
if (!existentTileImage) { if (!existentTileImage)
continue; continue;
}
auto tilePos = m_grid.tileToCanvas(tilePt); auto tilePos = m_grid.tileToCanvas(tilePt);