Skip to content

Conversation

@deshipu
Copy link
Contributor

@deshipu deshipu commented Nov 3, 2017

Right now we are using 1024 bytes (512 16-bit pixels), and it doesn't
really give us any speed advantage, since the DMA buffer is only 512
bytes anyways.

h = min(self.height - y, max(1, height))
self._block(x, y, x + w - 1, y + h - 1, b'')
chunks, rest = divmod(w * h, 512)
chunks, rest = divmod(w * h, 256)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment explaining the buffer choice size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved it into a constant and added explanation.

chunks, rest = divmod(w * h, 256)
pixel = self._encode_pixel(color)
if chunks:
data = pixel * 512
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be 256 also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I should slow down a little.

Right now we are using 1024 bytes (512 16-bit pixels), and it doesn't
really give us any speed advantage, since the DMA buffer is only 512
bytes anyways.
Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Thanks!

@dhalbert dhalbert merged commit 8b5e71b into adafruit:master Nov 3, 2017
tannewt pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 4, 2018
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