# Question about implementation of SDL\_UpdateWindowSurfaceRects()

**URL:** <https://discourse.libsdl.org/t/question-about-implementation-of-sdl-updatewindowsurfacerects/27561>\
**Category:** SDL Development\
**Created:** [April 26, 2020, 3:18pm UTC](https://discourse.libsdl.org/t/question-about-implementation-of-sdl-updatewindowsurfacerects/27561 "2020-04-26T15:18:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MightyJosip](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/df705f/32.png) [@MightyJosip](https://discourse.libsdl.org/u/MightyJosip)\
**Post date:** [April 26, 2020, 3:18pm UTC](https://discourse.libsdl.org/t/question-about-implementation-of-sdl-updatewindowsurfacerects/27561/1 "2020-04-26T15:18:12Z")

</div>

Hello. I want to update part of the screen and so I use SDL\_UpdateWindowSurfaceRects(win, rects, count); in my loop. This works well on macos and linux. But on windows entire screen is updated (even though I pass good rects). I did some research in SDL source code and found out that the function SDL\_UpdateWindowSurfaceRects uses on windows is:

```
int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects)
{
    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
    BitBlt(data->hdc, 0, 0, window->w, window->h, data->mdc, 0, 0, SRCCOPY);
    return 0;
}

```

As you can see this function calls BitBlt on entire screen, even though it accepts the rects. Rects variable is not even used in this function at all. Now my question is why is that the case? In SDL 1.2 it used to be (I will write just part of code)

```
for ( i=0; i<numrects; ++i ) {
	BitBlt(hdc, rects[i].x, rects[i].y, rects[i].w, rects[i].h,
				mdc, rects[i].x, rects[i].y, SRCCOPY);
}

```

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [April 27, 2020, 3:48am UTC](https://discourse.libsdl.org/t/question-about-implementation-of-sdl-updatewindowsurfacerects/27561/2 "2020-04-27T03:48:45Z")

</div>

This is likely a bug, since very few things use SDL\_UpdateWindowSurfaceRects. I have opened a bug report here so we remember to fix it:

[https://bugzilla.libsdl.org/show\_bug.cgi?id=5113](https://bugzilla.libsdl.org/show_bug.cgi?id=5113)

…but I would also encourage you not to use this function, but rather wrap your 2D rendering in the SDL render API, which will move the work to the GPU and get you free scaling, etc. This is often worthwhile (and faster!) even if you’re just uploading a block of pixels you rendered yourself on the CPU every frame.
