From: grumbel Date: Tue, 1 Dec 2009 04:45:08 +0000 (+0000) Subject: Fixed off-by-one X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=535559febfc366834aabb93278e5d3aacf76ea22;p=supertux.git Fixed off-by-one git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6165 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/src/object/background.cpp b/src/object/background.cpp index 0ed917b0a..09d147c7d 100644 --- a/src/object/background.cpp +++ b/src/object/background.cpp @@ -155,7 +155,7 @@ Background::draw_image(DrawingContext& context, const Vector& pos) switch(alignment) { case LEFT_ALIGNMENT: - for(int y = start_y; y < end_y; ++y) + for(int y = start_y; y <= end_y; ++y) { Vector p(pos.x - parallax_image_size.width / 2.0f, pos.y + y * image->get_height() - image->get_height() / 2.0f); @@ -164,7 +164,7 @@ Background::draw_image(DrawingContext& context, const Vector& pos) break; case RIGHT_ALIGNMENT: - for(int y = start_y; y < end_y; ++y) + for(int y = start_y; y <= end_y; ++y) { Vector p(pos.x + parallax_image_size.width / 2.0f - image->get_width(), pos.y + y * image->get_height() - image->get_height() / 2.0f); @@ -173,7 +173,7 @@ Background::draw_image(DrawingContext& context, const Vector& pos) break; case TOP_ALIGNMENT: - for(int x = start_x; x < end_x; ++x) + for(int x = start_x; x <= end_x; ++x) { Vector p(pos.x + x * image->get_width() - image->get_width() / 2.0f, pos.y - parallax_image_size.height / 2.0f); @@ -182,7 +182,7 @@ Background::draw_image(DrawingContext& context, const Vector& pos) break; case BOTTOM_ALIGNMENT: - for(int x = start_x; x < end_x; ++x) + for(int x = start_x; x <= end_x; ++x) { Vector p(pos.x + x * image->get_width() - image->get_width() / 2.0f, pos.y - image->get_height() + parallax_image_size.height / 2.0f);