/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"gtest/gtest.h"
#include"BufferUnrotate.h"
using mozilla::gfx::BufferUnrotate;
staticunsignedchar* GenerateBuffer(int bytesPerPixel, int width, int height, int stride, int xBoundary, int yBoundary) { unsignedchar* buffer = newunsignedchar[stride * height]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int pos = ((yBoundary + y) % height) * stride +
((xBoundary + x) % width) * bytesPerPixel; for (int i = 0; i < bytesPerPixel; i++) {
buffer[pos + i] = (x + y + i * 2) % 256;
}
}
} return buffer;
}
staticbool CheckBuffer(unsignedchar* buffer, int bytesPerPixel, int width, int height, int stride) { int xBoundary = 0; int yBoundary = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int pos = ((yBoundary + y) % height) * stride +
((xBoundary + x) % width) * bytesPerPixel; for (int i = 0; i < bytesPerPixel; i++) { if (buffer[pos + i] != (x + y + i * 2) % 256) {
printf("Buffer differs at %i, %i, is %i\n", x, y,
(int)buffer[pos + i]); returnfalse;
}
}
}
} returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.