Skip to content

Conversation

@yunline
Copy link
Contributor

@yunline yunline commented Apr 7, 2023

fix #2102
image

@yunline yunline requested a review from a team as a code owner April 7, 2023 07:54
@yunline yunline added transform pygame.transform bugfix PR that fixes bug labels Apr 7, 2023
Copy link
Member

@oddbookworm oddbookworm left a comment

Choose a reason for hiding this comment

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

LGTM! Fixes the linked issue nicely

@yunline yunline changed the title fix #2102 (box_blur()) fix #2102 (blur) May 5, 2023
@yunline yunline changed the title fix #2102 (blur) Blur fix May 5, 2023
@yunline
Copy link
Contributor Author

yunline commented May 5, 2023

Solved another problem when use gaussian_blur in place.
I think it can be a part of this PR.

import pygame
import sys

sf=pygame.image.load("peppers3.tif")
pygame.display.init()
dsf=pygame.display.set_mode((1280,720))
ddsf=dsf.subsurface((720,100,200,300))

while 1:
    dsf.fill((0,150,0))

    dsf.blit(sf, (640,0,0,0))

    pygame.transform.gaussian_blur(ddsf,50,dest_surface=ddsf)

    #dsf.blit(sf,(0,0,1,1))
    pygame.display.update()
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            sys.exit()

Before fix
image

After fix
image

@yunline
Copy link
Contributor Author

yunline commented May 8, 2023

It might be better to raise an error instead of creating a buffer when handling in-place operation.
People might think in-place operation is faster, but it's actually slower.

@Starbuck5
Copy link
Member

It might be better to raise an error instead of creating a buffer when handling in-place operation.
People might think in-place operation is faster, but it's actually slower.

So an error if the source and destination surfaces are the same? I'm totally okay with that.

@yunline
Copy link
Contributor Author

yunline commented May 11, 2023

So an error if the source and destination surfaces are the same? I'm totally okay with that.

OK, I'll open another PR for this

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

Labels

bugfix PR that fixes bug transform pygame.transform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transform.box_blur works incorrectly.

4 participants