Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: gtk blitting #8687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2017
Merged

FIX: gtk blitting #8687

merged 1 commit into from
May 31, 2017

Conversation

tacaswell
Copy link
Member

@tacaswell tacaswell commented May 31, 2017

PR Summary

  • Resize (rather than reserve) stl vector which will serve as our
    buffer.
  • use front rather than [0] to get the first element
    to get the pointer

closes #8684

attn @jrgirvan Can you verify that this still fixes it for you?

 - Resize (rather than reserve) stl vector which will serve as our
   buffer.
 - use `front` rather than `[0]` to get the first element
   to get the pointer

closes matplotlib#8684
@tacaswell tacaswell added this to the 2.1 (next point release) milestone May 31, 2017
@tacaswell tacaswell requested review from fariza, OceanWolf and mdboom May 31, 2017 03:44
Copy link
Member

@WeatherGod WeatherGod left a comment

Choose a reason for hiding this comment

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

From a pure cpp perspective, this all makes sense. It also makes sense that GCC in the past would have let this work (they tried hard to make std::vector act a lot like C arrays), but other compilers may not be so forgiving.

I can't test on windows to confirm, though.

Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

Seems like much better C++ code to me--reserve() is only an optimization, so it doesn't actually affect how many items are inside.

Is the change to front() to be defined when height/stride are 0?

@tacaswell
Copy link
Member Author

The change to front() is to be more idiomatic. I suspect it also in a micro optimization and skips bound checking.

The docs claim the behavior for a zero length vector is undefined.

@jrgirvan
Copy link

Works for me. Thanks for the prompt reply/fix @tacaswell

@QuLogic QuLogic merged commit 75fde88 into matplotlib:master May 31, 2017
@tacaswell tacaswell deleted the fix_gtk_blit branch June 1, 2017 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GTKAgg blit with bbox
5 participants