Skip to content
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

Incorrect calculation of bitmap buffer length #145

Closed
TimNN opened this issue Apr 19, 2015 · 4 comments
Closed

Incorrect calculation of bitmap buffer length #145

TimNN opened this issue Apr 19, 2015 · 4 comments
Labels

Comments

@TimNN
Copy link

TimNN commented Apr 19, 2015

The length of the bitmap buffer is calculated using self.width() * self.rows(), this however assumes that one pixel equals one byte, which might not be the case (for example if pixel_mode == Mono. The correct way to calculate the buffer length would be self.pitch().abs() * self.rows(), if I understand the freetype documentation correctly.

Also, if I interpret the documentation correctly, when pitch is negative, the buffer pointer points at the last row in memory (i.e. buffer points at the row with index zero, but the row at index one is located at a lower address than that row in memory).

@bvssvni bvssvni added the bug label Apr 20, 2015
@zummenix
Copy link
Contributor

Looks like this fixed in #164. Closing.

@Kagami
Copy link
Member

Kagami commented Oct 27, 2015

Start of the buffer in case of negative pitch is not yet fixed.

@Kagami
Copy link
Member

Kagami commented Oct 27, 2015

Hm, no, start of the buffer seems to be always the same. The bitmap is just stored upside-down in case of negative pitch, but last address is still at bitmap.buffer + len. @m4rw3r, correct?

@m4rw3r
Copy link
Contributor

m4rw3r commented Oct 31, 2015

@Kagami If I read what I wrote in this pull-request correctly it should be upside down with negative pitch, yes: #164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants