diff options
Diffstat (limited to 'engines/sci/graphics/paint32.cpp')
-rw-r--r-- | engines/sci/graphics/paint32.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp index a03e77dfa6..7d106b5b02 100644 --- a/engines/sci/graphics/paint32.cpp +++ b/engines/sci/graphics/paint32.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -43,8 +43,12 @@ GfxPaint32::~GfxPaint32() { void GfxPaint32::fillRect(Common::Rect rect, byte color) { int16 y, x; - for (y = rect.top; y < rect.bottom; y++) { - for (x = rect.left; x < rect.right; x++) { + Common::Rect clipRect = rect; + + clipRect.clip(_screen->getWidth(), _screen->getHeight()); + + for (y = clipRect.top; y < clipRect.bottom; y++) { + for (x = clipRect.left; x < clipRect.right; x++) { _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, color, 0, 0); } } |