[Scummvm-git-logs] scummvm master -> ed34a41810fec9bbe5204d38370fdcb4a0682bc3
dreammaster
paulfgilbert at gmail.com
Sun Jun 9 23:38:34 CEST 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1297ae2b76 GRAPHICS: Fix ManagedSurface::copyFrom memory handling
ed34a41810 GRAPHICS: Fix rects handling in ManagedSurface::copyFrom
Commit: 1297ae2b76ca48e433de6e54922945880251ab3c
https://github.com/scummvm/scummvm/commit/1297ae2b76ca48e433de6e54922945880251ab3c
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2019-06-09T14:38:31-07:00
Commit Message:
GRAPHICS: Fix ManagedSurface::copyFrom memory handling
When calling ManagedSurface::copyFrom, _disposeAfterUse should be set to
YES because inner surface frees up old pixels array and creates a new one.
Changed paths:
graphics/managed_surface.cpp
graphics/managed_surface.h
diff --git a/graphics/managed_surface.cpp b/graphics/managed_surface.cpp
index 1595a32..7dca33a 100644
--- a/graphics/managed_surface.cpp
+++ b/graphics/managed_surface.cpp
@@ -124,6 +124,17 @@ void ManagedSurface::free() {
_offsetFromOwner = Common::Point(0, 0);
}
+void ManagedSurface::copyFrom(const ManagedSurface &surf) {
+ // Surface::copyFrom free pixel pointer so let's free up ManagedSurface to be coherent
+ free();
+
+ _innerSurface.copyFrom(surf._innerSurface);
+ clearDirtyRects();
+
+ // Pixels data is now owned by us
+ _disposeAfterUse = DisposeAfterUse::YES;
+}
+
bool ManagedSurface::clip(Common::Rect &srcBounds, Common::Rect &destBounds) {
if (destBounds.left >= this->w || destBounds.top >= this->h ||
destBounds.right <= 0 || destBounds.bottom <= 0)
diff --git a/graphics/managed_surface.h b/graphics/managed_surface.h
index a11d05c..c143222 100644
--- a/graphics/managed_surface.h
+++ b/graphics/managed_surface.h
@@ -307,10 +307,7 @@ public:
* Copy the data from another Surface, reinitializing the
* surface to match the dimensions of the passed surface
*/
- void copyFrom(const ManagedSurface &surf) {
- clearDirtyRects();
- _innerSurface.copyFrom(surf._innerSurface);
- }
+ void copyFrom(const ManagedSurface &surf);
/**
* Draw a line.
Commit: ed34a41810fec9bbe5204d38370fdcb4a0682bc3
https://github.com/scummvm/scummvm/commit/ed34a41810fec9bbe5204d38370fdcb4a0682bc3
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2019-06-09T14:38:31-07:00
Commit Message:
GRAPHICS: Fix rects handling in ManagedSurface::copyFrom
Like in create(), when using copyFrom the whole surface gets new data
and is now completely dirty so let's use markAllDirty.
Changed paths:
graphics/managed_surface.cpp
diff --git a/graphics/managed_surface.cpp b/graphics/managed_surface.cpp
index 7dca33a..8a2911b 100644
--- a/graphics/managed_surface.cpp
+++ b/graphics/managed_surface.cpp
@@ -129,7 +129,7 @@ void ManagedSurface::copyFrom(const ManagedSurface &surf) {
free();
_innerSurface.copyFrom(surf._innerSurface);
- clearDirtyRects();
+ markAllDirty();
// Pixels data is now owned by us
_disposeAfterUse = DisposeAfterUse::YES;
More information about the Scummvm-git-logs
mailing list