[Scummvm-cvs-logs] SF.net SVN: scummvm: [21792] scummvm/trunk/gui/ThemeNew.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Apr 11 08:35:02 CEST 2006
Revision: 21792
Author: lordhoto
Date: 2006-04-11 08:34:07 -0700 (Tue, 11 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21792&view=rev
Log Message:
-----------
- cleans up drawSurfaceMasked a little bit
- get rid of getColorAlpha in drawSurfaceMasked if no alpha blending is used
Modified Paths:
--------------
scummvm/trunk/gui/ThemeNew.cpp
Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp 2006-04-11 14:51:38 UTC (rev 21791)
+++ scummvm/trunk/gui/ThemeNew.cpp 2006-04-11 15:34:07 UTC (rev 21792)
@@ -1141,7 +1141,6 @@
upDown = true;
for (int i = 0; i < partsW; ++i) {
-
// calculate the correct drawing width
int usedWidth = drawWidth;
if (specialWidth && i == 1) {
@@ -1187,90 +1186,65 @@
const OverlayColor *src = 0;
const OverlayColor transparency = _colors[kColorTransparency];
+ int drawWidth = (r.width() < surf->w) ? r.width() : surf->w;
- if (upDown && !leftRight) { // upsidedown
+ int srcAdd = 0;
+ if (upDown) {
src = (const OverlayColor*)surf->pixels + (surf->h - 1) * surf->w;
- int drawWidth = (r.width() < surf->w) ? r.width() : surf->w;
+ srcAdd = -surf->w;
+ } else {
+ src = (const OverlayColor*)surf->pixels;
+ srcAdd = surf->w;
+ }
- for (int i = 0; i < r.height(); ++i) {
- if (dst < _screen.pixels) {
- dst += _screen.w;
- src -= surf->w;
- continue;
- }
+ while (dst < _screen.pixels) {
+ dst += _screen.w;
+ src += srcAdd;
+ }
- OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
- for (int x = 0; x < drawWidth; ++x) {
- if (src[x] != transparency) {
- dst[x] = getColorAlpha(src[x] & rowColor, dst[x], alpha);
+ if (alpha >= 256) {
+ if (leftRight) {
+ for (int i = 0; i < r.height(); ++i) {
+ OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
+ for (int x = 0; x < drawWidth; ++x) {
+ if (src[drawWidth-x-1] != transparency)
+ dst[x] = src[drawWidth-x-1] & rowColor;
}
- }
-
- dst += _screen.w;
- src -= surf->w;
- }
- } else if (upDown && leftRight) { // upsidedown + left right inverse
- src = (const OverlayColor*)surf->pixels + (surf->h - 1) * surf->w;
- int drawWidth = (r.width() < surf->w) ? r.width() : surf->w;
-
- for (int i = 0; i < r.height(); ++i) {
- if (dst < _screen.pixels) {
dst += _screen.w;
- src -= surf->w;
- continue;
+ src += srcAdd;
}
-
- OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
- for (int x = 0; x < drawWidth; ++x) {
- if (src[drawWidth-x-1] != transparency) {
- dst[x] = getColorAlpha(src[drawWidth-x-1] & rowColor, dst[x], alpha);
+ } else {
+ for (int i = 0; i < r.height(); ++i) {
+ OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
+ for (int x = 0; x < drawWidth; ++x) {
+ if (src[x] != transparency)
+ dst[x] = src[x] & rowColor;
}
+ dst += _screen.w;
+ src += srcAdd;
}
-
- dst += _screen.w;
- src -= surf->w;
}
- } else if (!upDown && leftRight) { // left right inverse
- src = (const OverlayColor*)surf->pixels;
- int drawWidth = (r.width() < surf->w) ? r.width() : surf->w;
-
- for (int i = 0; i < r.height(); ++i) {
- if (dst < _screen.pixels) {
+ } else {
+ if (leftRight) {
+ for (int i = 0; i < r.height(); ++i) {
+ OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
+ for (int x = 0; x < drawWidth; ++x) {
+ if (src[drawWidth-x-1] != transparency)
+ dst[x] = getColorAlpha(src[drawWidth-x-1] & rowColor, dst[x], alpha);
+ }
dst += _screen.w;
- src += surf->w;
- continue;
+ src += srcAdd;
}
-
- OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
- for (int x = 0; x < drawWidth; ++x) {
- if (src[drawWidth-x-1] != transparency) {
- dst[x] = getColorAlpha(src[drawWidth-x-1] & rowColor, dst[x], alpha);
+ } else {
+ for (int i = 0; i < r.height(); ++i) {
+ OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
+ for (int x = 0; x < drawWidth; ++x) {
+ if (src[x] != transparency)
+ dst[x] = getColorAlpha(src[x] & rowColor, dst[x], alpha);
}
- }
-
- dst += _screen.w;
- src += surf->w;
- }
- } else { // normal
- src = (const OverlayColor*)surf->pixels;
- int drawWidth = (r.width() < surf->w) ? r.width() : surf->w;
-
- for (int i = 0; i < r.height(); ++i) {
- if (dst < _screen.pixels) {
dst += _screen.w;
- src += surf->w;
- continue;
+ src += srcAdd;
}
-
- OverlayColor rowColor = calcGradient(start, end, i, r.height(), factor);
- for (int x = 0; x < drawWidth; ++x) {
- if (src[x] != transparency) {
- dst[x] = getColorAlpha(src[x] & rowColor, dst[x], alpha);
- }
- }
-
- dst += _screen.w;
- src += surf->w;
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list