Browse Source

ArtDraw: Bounds-check top and left

This fixes the glitch when a line leaves the viewport in the scrolling
quest text.

Refs #3388
pull/3401/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
a1125e83d7
  1. 7
      Source/DiabloUI/art_draw.cpp

7
Source/DiabloUI/art_draw.cpp

@ -37,6 +37,10 @@ void DrawArt(Point screenPosition, Art *art, int nFrame, Uint16 srcW, Uint16 src
srcRect.w = srcW;
if (srcH != 0 && srcH < srcRect.h)
srcRect.h = srcH;
if (screenPosition.x + srcRect.w <= 0 || screenPosition.y + srcRect.h <= 0)
return;
SDL_Rect dstRect = MakeSdlRect(screenPosition.x, screenPosition.y, srcRect.w, srcRect.h);
ScaleOutputRect(&dstRect);
@ -57,6 +61,9 @@ void DrawArt(const Surface &out, Point position, Art *art, int nFrame, Uint16 sr
if (srcH != 0 && srcH < srcRect.h)
srcRect.h = srcH;
if (position.x + srcRect.w <= 0 || position.y + srcRect.h <= 0)
return;
out.Clip(&srcRect, &position);
SDL_Rect dstRect = MakeSdlRect(position.x + out.region.x, position.y + out.region.y, 0, 0);

Loading…
Cancel
Save