Skip to content

Commit 2d2a1c0

Browse files
committed
now correctly draws onto subsurfaces
1 parent 065b3f8 commit 2d2a1c0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src_c/surface.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,17 +2328,22 @@ _surf_fblits_cached_item_check_and_blit(pgSurfaceObject *self, PyObject *item,
23282328
return FBLITS_ERR_INVALID_DESTINATION;
23292329
}
23302330

2331+
src_dest.x += suboffsetx;
2332+
src_dest.y += suboffsety;
2333+
23312334
SDL_Rect *clip_rect = &dst->clip_rect;
23322335
SDL_Rect clipped;
23332336
if (!SDL_IntersectRect(clip_rect, &src_dest, &clipped))
23342337
continue; /* Skip out of bounds destinations */
23352338

23362339
CachedBlitDest *d_item = &destinations->sequence[current_size++];
23372340

2338-
d_item->pixels = (Uint32 *)dst->pixels;
2339-
d_item->pixels += clipped.y * dst->pitch / 4 + clipped.x;
2341+
d_item->pixels =
2342+
(Uint32 *)dst->pixels + clipped.y * dst->pitch / 4 + clipped.x;
2343+
23402344
d_item->w = clipped.w;
23412345
d_item->h = clipped.h;
2346+
23422347
d_item->x = src_dest.x < clip_rect->x ? clip_rect->x - src_dest.x : 0;
23432348
d_item->y = src_dest.y < clip_rect->y ? clip_rect->y - src_dest.y : 0;
23442349
}

0 commit comments

Comments
 (0)