aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorVicent Marti2008-07-16 10:48:14 +0000
committerVicent Marti2008-07-16 10:48:14 +0000
commit14c8d5d6c3d70cfa4f3229e3cd7c76771f566f9c (patch)
treec6d558b617837efb31f415382756e28c39f176bd /graphics
parent47119ee8b136184c39cc6ce1a4b7248702f4c16f (diff)
downloadscummvm-rg350-14c8d5d6c3d70cfa4f3229e3cd7c76771f566f9c.tar.gz
scummvm-rg350-14c8d5d6c3d70cfa4f3229e3cd7c76771f566f9c.tar.bz2
scummvm-rg350-14c8d5d6c3d70cfa4f3229e3cd7c76771f566f9c.zip
Stroking on tab widgets. Basic support for backcaching.
svn-id: r33084
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRenderer.cpp93
1 files changed, 68 insertions, 25 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index a95564789e..aa0fad36c8 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -402,9 +402,14 @@ drawTab(int x, int y, int r, int w, int h) {
return;
case kFillGradient:
- case kFillForeground:
case kFillBackground:
drawTabAlg(x, y, w, h, r, (Base::_fillMode == kFillBackground) ? _bgColor : _fgColor, Base::_fillMode);
+ if (Base::_strokeWidth)
+ drawTabAlg(x, y, w, h, r, _fgColor, kFillDisabled);
+ break;
+
+ case kFillForeground:
+ drawTabAlg(x, y, w, h, r, (Base::_fillMode == kFillBackground) ? _bgColor : _fgColor, Base::_fillMode);
break;
}
}
@@ -471,44 +476,82 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer:
int f, ddF_x, ddF_y;
int x, y, px, py;
int pitch = Base::surfacePitch();
+ int sw = 0, sp = 0, hp = 0;
PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
int real_radius = r;
- int short_h = h - (r) + 2;
+ int short_h = h - r + 2;
int long_h = h;
-
- __BE_RESET();
PixelType color1, color2;
if (fill_m == kFillForeground || fill_m == kFillBackground)
color1 = color2 = color;
-
- while (x++ < y) {
- __BE_ALGORITHM();
- if (fill_m == kFillGradient) {
- color1 = calcGradient(real_radius - x, long_h);
- color2 = calcGradient(real_radius - y, long_h);
+ if (fill_m == kFillDisabled) {
+ while (sw++ < Base::_strokeWidth) {
+ colorFill(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color);
+ colorFill(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color);
+ sp += pitch;
+
+ __BE_RESET();
+ r--;
+
+ while (x++ < y) {
+ __BE_ALGORITHM();
+ *(ptr_tr + (y) - (px)) = color;
+ *(ptr_tr + (x) - (py)) = color;
+ *(ptr_tl - (x) - (py)) = color;
+ *(ptr_tl - (y) - (px)) = color;
+
+ if (Base::_strokeWidth > 1) {
+ *(ptr_tr + (y) - (px)) = color;
+ *(ptr_tr + (x - 1) - (py)) = color;
+ *(ptr_tl - (x - 1) - (py)) = color;
+ *(ptr_tl - (y) - (px)) = color;
+ *(ptr_tr + (y) - (px - pitch)) = color;
+ *(ptr_tr + (x) - (py)) = color;
+ *(ptr_tl - (x) - (py)) = color;
+ *(ptr_tl - (y) - (px - pitch)) = color;
+ }
+ }
}
+
+ ptr_fill += pitch * real_radius;
+ while (short_h--) {
+ colorFill(ptr_fill, ptr_fill + Base::_strokeWidth, color);
+ colorFill(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color);
+ ptr_fill += pitch;
+ }
+ } else {
+ __BE_RESET();
- colorFill(ptr_tl - x - py, ptr_tr + x - py, color2);
- colorFill(ptr_tl - y - px, ptr_tr + y - px, color1);
-
- *(ptr_tr + (y) - (px)) = color;
- *(ptr_tr + (x) - (py)) = color;
- *(ptr_tl - (x) - (py)) = color;
- *(ptr_tl - (y) - (px)) = color;
- }
-
- ptr_fill += pitch * r;
- while (short_h--) {
- if (fill_m == kFillGradient)
- color = calcGradient(real_radius++, long_h);
- colorFill(ptr_fill, ptr_fill + w + 1, color);
- ptr_fill += pitch;
+ while (x++ < y) {
+ __BE_ALGORITHM();
+
+ if (fill_m == kFillGradient) {
+ color1 = calcGradient(real_radius - x, long_h);
+ color2 = calcGradient(real_radius - y, long_h);
+ }
+
+ colorFill(ptr_tl - x - py, ptr_tr + x - py, color2);
+ colorFill(ptr_tl - y - px, ptr_tr + y - px, color1);
+
+ *(ptr_tr + (y) - (px)) = color1;
+ *(ptr_tr + (x) - (py)) = color2;
+ *(ptr_tl - (x) - (py)) = color2;
+ *(ptr_tl - (y) - (px)) = color1;
+ }
+
+ ptr_fill += pitch * r;
+ while (short_h--) {
+ if (fill_m == kFillGradient)
+ color = calcGradient(real_radius++, long_h);
+ colorFill(ptr_fill, ptr_fill + w + 1, color);
+ ptr_fill += pitch;
+ }
}
}