mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[kandinsky] optimize KDFrameBuffer::pushRectUniform
Change-Id: Ie1217a8c70817110b52e505e1cf60eab08180cac
This commit is contained in:
@@ -27,10 +27,18 @@ void KDFrameBuffer::pushRect(KDRect rect, const KDColor * pixels) {
|
||||
}
|
||||
|
||||
void KDFrameBuffer::pushRectUniform(KDRect rect, KDColor color) {
|
||||
for (KDCoordinate i=0; i<rect.width(); i++) {
|
||||
for (KDCoordinate j=0; j<rect.height(); j++) {
|
||||
*pixelAddress(rect.origin().translatedBy(KDPoint(i,j))) = color;
|
||||
// Caution: this code is used very frequently
|
||||
// It's worth optimizing!
|
||||
KDColor * pixel = pixelAddress(rect.origin());
|
||||
int lineDelta = m_size.width() - rect.width();
|
||||
for (KDCoordinate j=0; j<rect.height(); j++) {
|
||||
//KDColor * topLeftPixelAddress = pixelAddress(rect.origin().translatedBy(KDPoint(0,j)));
|
||||
//*pixelAddress(rect.origin().translatedBy(KDPoint(i,j))) = color;
|
||||
for (KDCoordinate i=0; i<rect.width(); i++) {
|
||||
*pixel++ = color;
|
||||
//*pixelAddress(rect.origin().translatedBy(KDPoint(i,j))) = color;
|
||||
}
|
||||
pixel += lineDelta;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user