Skip to content

Surface Blit implementation#147

Open
brccabral wants to merge 1 commit into
libSDL2pp:masterfrom
brccabral:surface_blit
Open

Surface Blit implementation#147
brccabral wants to merge 1 commit into
libSDL2pp:masterfrom
brccabral:surface_blit

Conversation

@brccabral
Copy link
Copy Markdown

In SDL2 SDL_BlitSurface dstrect can be NULL, and it gets updated with the final blit rectangle after all clipping. SDL3 it is const.

… the final blit rectangle after all clipping. SDL3 it is const.
Copy link
Copy Markdown
Member

@AMDmi3 AMDmi3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`

Comment thread SDL2pp/Surface.cc
void Surface::Blit(const Optional<Rect>& srcrect, Surface& dst, const Rect& dstrect) {
SDL_Rect tmpdstrect = dstrect; // 4th argument is non-const; does it modify rect?
if (SDL_BlitSurface(surface_, srcrect ? &*srcrect : nullptr, dst.Get(), &tmpdstrect) != 0)
void Surface::Blit(const Optional<Rect>& srcrect, Surface& dst, Optional<Rect>& dstrect) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it const.

  • We're going to switch to SDL3 at some point and we don't need incompatible changes.
  • Non-const argument does not allow passing rvalue which is inconvenient.

Comment thread SDL2pp/Surface.hh
///
/// \throws SDL2pp::Exception
///
/// \see http://wiki.libsdl.org/SDL_BlitSurface
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legacy url does not need to be retained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants