Commit f1bcf6bc authored by abmyii's avatar abmyii
Browse files

Add short explanation of rotation code

parent f08bb558
......@@ -97,7 +97,18 @@ void read_pixels(int bpp, GLenum format, mir::geometry::Size const& size, std::v
// Rotate to landscape
if (landscape) {
/** Starts from the last column and moves back reading each vertically and writing it horizontally **/
/** Starts from the last column and moves back reading each vertically and writing it horizontally.
* Given the following matrix of pixels (R G B):
* (1 1 1) (4 4 4) (6 6 6)
* (3 3 3) (2 2 2) (5 5 5)
* (7 7 7) (9 9 9) (8 8 8)
*
* It will be rotated 90 degrees anti-clockwise, with the pixel values remaining grouped like so:
*
* (6 6 6) (5 5 5) (8 8 8)
* (4 4 4) (2 2 2) (9 9 9)
* (1 1 1) (3 3 3) (7 7 7)
**/
int i = 0;
for (int x = width*bpp; x > 0; x -= bpp) {
for (int y = 0; y < height; y++) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment