Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed fastvhline to point to drawline, added fillScreen, a fake con…
…structor and rotation stuff
- Loading branch information
Showing
2 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17a6c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were drawFastVline and drawFastHLine made slower (and "stupider", as the comment says) by replacing the fast, straightforward loop with a call to the bresenham code which (needlessly, here) calculates the slope of the line at each step?
I assume there was some advantage to this commit but I am having a hard time seeing it. Please explain?
17a6c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because most screens have an optimized method for drawing straight lines that is hardware dependent, this would be overridden in the subclass.
17a6c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had a look through the code in question, ladyada's right on this one -- each subclass is intended to provide a H/V line function that's genuinely optimized to the specific hardware (the TFTLCD library shows a really good example of this). Simplifying the H/V cases to a loop of drawPixel() calls is a red herring, because that function is performing clipping on every. single. point. along. the. way...that's no optimization at all. The base class is intended to be a minimal framework -- the least code to read, maintain, debug -- just enough to test a new display device by implementing drawPixel(), hence the reduction of the H/V cases to normal line-drawing calls by default. The subclasses can then exploit hardware-specific peculiarities (memory layout, etc.) for more truly optimized graphics primitives that actually deserve the word 'fast' in their names.
"Premature optimization is the root of all evil." -- Donald Knuth