[aseprite] 271/308: Fix possible bug/crash using a cmd::CopyRegion()
Tobias Hansen
thansen at moszumanska.debian.org
Tue Mar 8 02:45:19 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 875e2cd39137a4fd265e9f42448f0af4dcfdb033
Author: David Capello <davidcapello at gmail.com>
Date: Fri Feb 26 12:50:09 2016 -0300
Fix possible bug/crash using a cmd::CopyRegion()
The region that we save must be exactly the same that we use in the swap
process.
---
src/app/cmd/copy_region.cpp | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/app/cmd/copy_region.cpp b/src/app/cmd/copy_region.cpp
index 0fc70c4..1e47943 100644
--- a/src/app/cmd/copy_region.cpp
+++ b/src/app/cmd/copy_region.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2001-2015 David Capello
+// Copyright (C) 2001-2016 David Capello
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -22,7 +22,7 @@ CopyRegion::CopyRegion(Image* dst, Image* src,
const gfx::Region& region, int dst_dx, int dst_dy)
: WithImage(dst)
{
- // Save region pixels
+ // Create region to save/swap later
for (const auto& rc : region) {
gfx::Clip clip(
rc.x+dst_dx, rc.y+dst_dy,
@@ -33,12 +33,14 @@ CopyRegion::CopyRegion(Image* dst, Image* src,
continue;
m_region.createUnion(m_region, gfx::Region(clip.dstBounds()));
+ }
- for (int y=0; y<clip.size.h; ++y) {
+ // Save region pixels
+ for (const auto& rc : m_region) {
+ for (int y=0; y<rc.h; ++y)
m_stream.write(
- (const char*)src->getPixelAddress(clip.src.x, clip.src.y+y),
- src->getRowStrideSize(clip.size.w));
- }
+ (const char*)src->getPixelAddress(rc.x, rc.y+y),
+ src->getRowStrideSize(rc.w));
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list