From 2a26c7600650e5146bf847d95ca00108c9c2b2ca Mon Sep 17 00:00:00 2001 From: Walter Korman Date: Tue, 22 Oct 2002 02:02:40 +0000 Subject: [PATCH] Deal gracefully with images that we can't usefully tile (which includes the default 1x1 transparent image we're given if the image manager failed to load an image successfully.) git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1821 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/media/util/BackgroundTiler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/media/util/BackgroundTiler.java b/src/java/com/threerings/media/util/BackgroundTiler.java index d7b82232c..da153c431 100644 --- a/src/java/com/threerings/media/util/BackgroundTiler.java +++ b/src/java/com/threerings/media/util/BackgroundTiler.java @@ -1,5 +1,5 @@ // -// $Id: BackgroundTiler.java,v 1.3 2002/09/25 21:49:53 shaper Exp $ +// $Id: BackgroundTiler.java,v 1.4 2002/10/22 02:02:40 shaper Exp $ package com.threerings.media.util; @@ -36,6 +36,13 @@ public class BackgroundTiler _h3 = _height/3; _ch3 = _height-2*_h3; + // make sure the image suits our minimum useful dimensions + if (_w3 <= 0 || _cw3 <= 0 || _h3 <= 0 || _ch3 <= 0) { + Log.warning("Backgrounder given source image of insufficient " + + "size for tiling [src=" + src + "]."); + return; + } + // create our sub-divided images _tiles = new BufferedImage[9]; int[] sy = { 0, _h3, _h3+_ch3 };