[Scummvm-cvs-logs] scummvm master -> 4840b889d7c8d2924f162c270d85c5431f0f86a6
csnover
csnover at users.noreply.github.com
Fri May 27 22:57:34 CEST 2016
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4ee5b0f910 SCI32: Use better name for fixed priority field
746c4e7b03 SCI32: Fix CelObj cache
4840b889d7 SCI32: Initialise pointers in CelObj scaler
Commit: 4ee5b0f910ff46c386141cc72a627ac6aeb3ef03
https://github.com/scummvm/scummvm/commit/4ee5b0f910ff46c386141cc72a627ac6aeb3ef03
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-05-27T15:54:14-05:00
Commit Message:
SCI32: Use better name for fixed priority field
The old name matches the selector, but isn’t as clear.
Changed paths:
engines/sci/graphics/plane32.cpp
engines/sci/graphics/screen_item32.cpp
engines/sci/graphics/screen_item32.h
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index d5c297e..470986f 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -173,7 +173,7 @@ void Plane::addPicInternal(const GuiResourceId pictureId, const Common::Point *p
screenItem->_pictureId = pictureId;
screenItem->_mirrorX = mirrorX;
screenItem->_priority = celObj->_priority;
- screenItem->_fixPriority = true;
+ screenItem->_fixedPriority = true;
if (position != nullptr) {
screenItem->_position = *position + celObj->_relativePosition;
} else {
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index c3fdbb6..9530914 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -55,7 +55,7 @@ _useInsetRect(false),
_z(0),
_celInfo(celInfo),
_celObj(nullptr),
-_fixPriority(false),
+_fixedPriority(false),
_position(0, 0),
_object(make_reg(0, _nextObjectId++)),
_pictureId(-1),
@@ -70,7 +70,7 @@ _useInsetRect(false),
_z(0),
_celInfo(celInfo),
_celObj(nullptr),
-_fixPriority(false),
+_fixedPriority(false),
_position(rect.left, rect.top),
_object(make_reg(0, _nextObjectId++)),
_pictureId(-1),
@@ -90,7 +90,7 @@ _useInsetRect(false),
_z(0),
_celInfo(celInfo),
_celObj(nullptr),
-_fixPriority(false),
+_fixedPriority(false),
_position(position),
_object(make_reg(0, _nextObjectId++)),
_pictureId(-1),
@@ -209,10 +209,10 @@ void ScreenItem::setFromObject(SegManager *segMan, const reg_t object, const boo
}
if (readSelectorValue(segMan, object, SELECTOR(fixPriority))) {
- _fixPriority = true;
+ _fixedPriority = true;
_priority = readSelectorValue(segMan, object, SELECTOR(priority));
} else {
- _fixPriority = false;
+ _fixedPriority = false;
writeSelectorValue(segMan, object, SELECTOR(priority), _position.y);
}
@@ -402,7 +402,7 @@ void ScreenItem::calcRects(const Plane &plane) {
_screenRect.top = 0;
}
- if (!_fixPriority) {
+ if (!_fixedPriority) {
_priority = _z + _position.y;
}
} else {
diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h
index 977d80e..cda98c8 100644
--- a/engines/sci/graphics/screen_item32.h
+++ b/engines/sci/graphics/screen_item32.h
@@ -132,7 +132,7 @@ public:
* in place. Otherwise, the priority of the screen item
* is calculated from its y-position + z-index.
*/
- bool _fixPriority;
+ bool _fixedPriority;
/**
* The rendering priority of the screen item, relative
Commit: 746c4e7b03bee53d5db708dece2b490cc1f84c2b
https://github.com/scummvm/scummvm/commit/746c4e7b03bee53d5db708dece2b490cc1f84c2b
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-05-27T15:54:14-05:00
Commit Message:
SCI32: Fix CelObj cache
The previous implementation did not work properly, assigning the
next insertion index to the oldest object instead of filling empty
cache slots on a cache miss.
Changed paths:
engines/sci/graphics/celobj32.cpp
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 693bc5f..3e09d0f 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -525,30 +525,30 @@ int CelObj::_nextCacheId = 1;
CelCache *CelObj::_cache = nullptr;
int CelObj::searchCache(const CelInfo32 &celInfo, int *nextInsertIndex) const {
+ *nextInsertIndex = -1;
int oldestId = _nextCacheId + 1;
- int oldestIndex = -1;
+ int oldestIndex = 0;
for (int i = 0, len = _cache->size(); i < len; ++i) {
CelCacheEntry &entry = (*_cache)[i];
- if (entry.celObj != nullptr) {
- if (entry.celObj->_info == celInfo) {
- entry.id = ++_nextCacheId;
- return i;
+ if (entry.celObj == nullptr) {
+ if (*nextInsertIndex == -1) {
+ *nextInsertIndex = i;
}
-
- if (oldestId > entry.id) {
- oldestId = entry.id;
- oldestIndex = i;
- }
- } else if (oldestIndex == -1) {
+ } else if (entry.celObj->_info == celInfo) {
+ entry.id = ++_nextCacheId;
+ return i;
+ } else if (oldestId > entry.id) {
+ oldestId = entry.id;
oldestIndex = i;
}
}
- // NOTE: Unlike the original SCI engine code, the out-param
- // here is only updated if there was not a cache hit.
- *nextInsertIndex = oldestIndex;
+ if (*nextInsertIndex == -1) {
+ *nextInsertIndex = oldestIndex;
+ }
+
return -1;
}
Commit: 4840b889d7c8d2924f162c270d85c5431f0f86a6
https://github.com/scummvm/scummvm/commit/4840b889d7c8d2924f162c270d85c5431f0f86a6
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-05-27T15:54:14-05:00
Commit Message:
SCI32: Initialise pointers in CelObj scaler
This ensures that if there is a bug in the drawing code that causes
the row to be unset, it will not result in silently reading garbage
out of random memory.
CID 1354802
Changed paths:
engines/sci/graphics/celobj32.cpp
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 3e09d0f..da00a5e 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -120,6 +120,7 @@ struct SCALER_NoScale {
const int16 _sourceY;
SCALER_NoScale(const CelObj &celObj, const int16 maxWidth, const Common::Point &scaledPosition) :
+ _row(nullptr),
_reader(celObj, FLIP ? celObj._width : maxWidth),
_lastIndex(celObj._width - 1),
_sourceX(scaledPosition.x),
@@ -166,6 +167,7 @@ struct SCALER_Scale {
static int16 _valuesY[1024];
SCALER_Scale(const CelObj &celObj, const Common::Rect &targetRect, const Common::Point &scaledPosition, const Ratio scaleX, const Ratio scaleY) :
+ _row(nullptr),
#ifndef NDEBUG
_maxX(targetRect.right - 1),
#endif
More information about the Scummvm-git-logs
mailing list