[Scummvm-git-logs] scummvm master -> ce5b27f82fd2e8a9938109b82e2eb3677b379b1e

digitall 547637+digitall at users.noreply.github.com
Mon Mar 15 13:25:03 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ce5b27f82f TINYGL: Implement a real operator=


Commit: ce5b27f82fd2e8a9938109b82e2eb3677b379b1e
    https://github.com/scummvm/scummvm/commit/ce5b27f82fd2e8a9938109b82e2eb3677b379b1e
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2021-03-15T13:25:01Z

Commit Message:
TINYGL: Implement a real operator=

With logic similar to the copy ctor.

Changed paths:
    graphics/tinygl/zblit.cpp


diff --git a/graphics/tinygl/zblit.cpp b/graphics/tinygl/zblit.cpp
index 68a6730443..6746d0b9a1 100644
--- a/graphics/tinygl/zblit.cpp
+++ b/graphics/tinygl/zblit.cpp
@@ -115,9 +115,20 @@ public:
 			_pixels = _buf.getRawBuffer();
 		}
 
-#ifdef USE_CXX11
-		Line &operator=(const Line &other) = default; // FIXME: This may need replacing with custom copy operator code
-#endif
+		Line &operator=(const Line &other) {
+			if (this == &other)
+				return *this;
+			_x = other._x;
+			_y = other._y;
+			if (_length != other._length || _buf.getFormat() != other._buf.getFormat()) {
+				_buf.free();
+				_buf.create(other._buf.getFormat(), other._length, DisposeAfterUse::NO);
+				_length = other._length;
+			}
+			_buf.copyBuffer(0, 0, _length, other._buf);
+			_pixels = _buf.getRawBuffer();
+			return *this;
+		}
 
 		Line(const Line& other) : _buf(other._buf.getFormat(), other._length, DisposeAfterUse::NO), _x(other._x), _y(other._y), _length(other._length) {
 			_buf.copyBuffer(0, 0, _length, other._buf);




More information about the Scummvm-git-logs mailing list