Replace m_nextStoredYCoord by a PixelAttributes member.
This commit is contained in:
parent
07e3fb5efd
commit
784cf9604f
@ -26,7 +26,7 @@ PixelAttributes::~PixelAttributes()
|
||||
freeAttributes();
|
||||
}
|
||||
|
||||
void PixelAttributes::setParameters(int width, int lines)
|
||||
void PixelAttributes::setParameters(int width, int lines, int nextY)
|
||||
{
|
||||
freeAttributes();
|
||||
m_width = width + 1; // 1px gradient calculation
|
||||
@ -36,6 +36,7 @@ void PixelAttributes::setParameters(int width, int lines)
|
||||
m_emptyLine = m_lastLine + 1;
|
||||
m_lineCount = m_emptyLine + 1;
|
||||
m_firstY = 0;
|
||||
m_nextY = nextY;
|
||||
m_lastY = -1;
|
||||
m_firstUnshadedY = 0;
|
||||
|
||||
@ -73,6 +74,7 @@ void PixelAttributes::scroll(int keepY)
|
||||
}
|
||||
|
||||
m_firstY += scroll;
|
||||
m_nextY = m_firstY;
|
||||
m_firstUnshadedY -= scroll;
|
||||
if (m_firstUnshadedY < m_firstY) m_firstUnshadedY = m_firstY;
|
||||
}
|
||||
|
@ -70,10 +70,11 @@ class PixelAttributes
|
||||
public:
|
||||
PixelAttributes();
|
||||
virtual ~PixelAttributes();
|
||||
void setParameters(int width, int lines);
|
||||
void setParameters(int width, int lines, int nextY);
|
||||
void scroll(int keepY);
|
||||
PixelAttribute &attribute(int y, int x);
|
||||
void renderShading(bool drawAlpha);
|
||||
int getNextY(void) { return m_nextY; }
|
||||
void setLastY(int y);
|
||||
int getLastY(void) { return m_lastY; }
|
||||
|
||||
@ -90,6 +91,7 @@ private:
|
||||
PixelAttribute **m_pixelAttributes;
|
||||
int m_width;
|
||||
int m_firstY;
|
||||
int m_nextY;
|
||||
int m_lastY;
|
||||
int m_firstUnshadedY;
|
||||
};
|
||||
|
@ -163,7 +163,6 @@ TileGenerator::TileGenerator():
|
||||
m_mapYStartNodeOffset(0),
|
||||
m_mapXEndNodeOffset(0),
|
||||
m_mapYEndNodeOffset(0),
|
||||
m_nextStoredYCoord(0),
|
||||
m_tileXOrigin(TILECENTER_AT_WORLDCENTER),
|
||||
m_tileZOrigin(TILECENTER_AT_WORLDCENTER),
|
||||
m_tileWidth(0),
|
||||
@ -851,7 +850,7 @@ void TileGenerator::pushPixelRows(int zPosLimit) {
|
||||
if (m_shading)
|
||||
m_blockPixelAttributes.renderShading(m_drawAlpha);
|
||||
int y;
|
||||
for (y = m_nextStoredYCoord; y <= m_blockPixelAttributes.getLastY() && y < worldBlockZ2StoredY(m_zMin - 1) + m_mapYEndNodeOffset; y++) {
|
||||
for (y = m_blockPixelAttributes.getNextY(); y <= m_blockPixelAttributes.getLastY() && y < worldBlockZ2StoredY(m_zMin - 1) + m_mapYEndNodeOffset; y++) {
|
||||
for (int x = m_mapXStartNodeOffset; x < worldBlockX2StoredX(m_xMax + 1) + m_mapXEndNodeOffset; x++) {
|
||||
int mapX = x - m_mapXStartNodeOffset;
|
||||
int mapY = y - m_mapYStartNodeOffset;
|
||||
@ -873,7 +872,6 @@ void TileGenerator::pushPixelRows(int zPosLimit) {
|
||||
int yLimit = worldBlockZ2StoredY(zPosLimit);
|
||||
if (y <= yLimit) {
|
||||
m_blockPixelAttributes.scroll(yLimit);
|
||||
m_nextStoredYCoord = yLimit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -944,7 +942,7 @@ void TileGenerator::computeMapParameters(const std::string &input)
|
||||
m_storedHeight = (m_zMax - m_zMin + 1) * 16;
|
||||
int mapWidth = m_storedWidth - m_mapXStartNodeOffset + m_mapXEndNodeOffset;
|
||||
int mapHeight = m_storedHeight - m_mapYStartNodeOffset + m_mapYEndNodeOffset;
|
||||
m_blockPixelAttributes.setParameters(m_storedWidth, 16);
|
||||
m_blockPixelAttributes.setParameters(m_storedWidth, 16, m_mapYStartNodeOffset);
|
||||
|
||||
// Set special values for origin (which depend on other paramters)
|
||||
if (m_tileWidth) {
|
||||
@ -1036,8 +1034,6 @@ void TileGenerator::computeMapParameters(const std::string &input)
|
||||
false);
|
||||
}
|
||||
|
||||
m_nextStoredYCoord = m_mapYStartNodeOffset;
|
||||
|
||||
// Print some useful messages in cases where it may not be possible to generate the image...
|
||||
long long pixels = static_cast<long long>(m_pictWidth + m_border) * (m_pictHeight + m_border);
|
||||
// Study the libgd code to known why the maximum is the following:
|
||||
|
@ -205,7 +205,6 @@ private:
|
||||
int m_mapYStartNodeOffset;
|
||||
int m_mapXEndNodeOffset;
|
||||
int m_mapYEndNodeOffset;
|
||||
int m_nextStoredYCoord;
|
||||
int m_tileXOrigin;
|
||||
int m_tileZOrigin;
|
||||
int m_tileXCentered;
|
||||
|
Loading…
x
Reference in New Issue
Block a user