Skip to content

Commit 4620779

Browse files
committed
Simplify code
1 parent e54f725 commit 4620779

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎src/Mod/ExtraSprites.cpp‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ SurfaceSet *ExtraSprites::loadSurfaceSet(SurfaceSet *set)
247247
}
248248
else
249249
{
250-
Surface *temp = new Surface(_width, _height);
251-
temp->loadImage(fullPath);
250+
Surface temp = Surface(_width, _height);
251+
temp.loadImage(fullPath);
252252
int xDivision = _width / _subX;
253253
int yDivision = _height / _subY;
254254
int frames = xDivision * yDivision;
@@ -259,18 +259,13 @@ SurfaceSet *ExtraSprites::loadSurfaceSet(SurfaceSet *set)
259259
{
260260
for (int x = 0; x != xDivision; ++x)
261261
{
262-
Surface *frame = set->getFrame(offset);
263-
if (frame)
264-
{
265-
frame->clear();
266-
}
267-
frame = getFrame(set, offset, adding);
262+
Surface* frame = getFrame(set, offset, adding);
263+
frame->clear();
268264
// for some reason regular blit() doesn't work here how i want it, so i use this function instead.
269-
temp->blitNShade(frame, 0 - (x * _subX), 0 - (y * _subY), 0);
265+
temp.blitNShade(frame, 0 - (x * _subX), 0 - (y * _subY), 0);
270266
++offset;
271267
}
272268
}
273-
delete temp;
274269
}
275270
}
276271
}

0 commit comments

Comments
 (0)