aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorVicent Marti2008-08-04 16:59:55 +0000
committerVicent Marti2008-08-04 16:59:55 +0000
commit85c36885f5bbf2d47276c7702f1b8ccbf22ecc34 (patch)
treedd3aeb61b4bcc37431b383c36f429d082f418965 /graphics
parent461e2f42149e3b1914b3c7b392d076c186c6d0a1 (diff)
downloadscummvm-rg350-85c36885f5bbf2d47276c7702f1b8ccbf22ecc34.tar.gz
scummvm-rg350-85c36885f5bbf2d47276c7702f1b8ccbf22ecc34.tar.bz2
scummvm-rg350-85c36885f5bbf2d47276c7702f1b8ccbf22ecc34.zip
Theme layout parsing. Work in progress.
svn-id: r33613
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRenderer.cpp22
-rw-r--r--graphics/VectorRenderer.h23
2 files changed, 28 insertions, 17 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index db9b774857..e3e7174d90 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -69,13 +69,16 @@ void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step, ui
if (step.fgColor.set)
setFgColor(step.fgColor.r, step.fgColor.g, step.fgColor.b);
+
+ if (step.bevelColor.set)
+ setBevelColor(step.bevelColor.r, step.bevelColor.g, step.bevelColor.b);
if (step.gradColor1.set && step.gradColor2.set)
setGradientColors(step.gradColor1.r, step.gradColor1.g, step.gradColor1.b,
step.gradColor2.r, step.gradColor2.g, step.gradColor2.b);
setShadowOffset(_disableShadows ? 0 : step.shadow);
- setInnerShadowOffset(_disableShadows ? 0 : step.innerShadow);
+ setBevel(step.bevel);
setGradientFactor(step.factor);
setStrokeWidth(step.stroke);
setFillMode((FillMode)step.fillMode);
@@ -513,8 +516,8 @@ drawRoundedSquare(int x, int y, int r, int w, int h) {
break;
}
- if (Base::_innerShadowOffset)
- drawRoundedSquareInnerShadow(x, y, r, w, h, Base::_innerShadowOffset);
+ if (Base::_bevel)
+ drawRoundedSquareFakeBevel(x, y, r, w, h, Base::_bevel);
}
template<typename PixelType, typename PixelFormat>
@@ -945,6 +948,8 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
int pitch = Base::surfacePitch();
int sw = 0, sp = 0, hp = h * pitch;
+// if (r < 8) r = 3;
+
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_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
@@ -1160,7 +1165,7 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int blur) {
template<typename PixelType, typename PixelFormat>
void VectorRendererSpec<PixelType, PixelFormat>::
-drawRoundedSquareInnerShadow(int x1, int y1, int r, int w, int h, int blur) {
+drawRoundedSquareFakeBevel(int x1, int y1, int r, int w, int h, int amount) {
int x, y;
int p = Base::surfacePitch(), px, py;
int sw = 0, sp = 0;
@@ -1169,7 +1174,7 @@ drawRoundedSquareInnerShadow(int x1, int y1, int r, int w, int h, int blur) {
uint32 T = 0, oldT;
uint8 a1, a2;
- PixelType color = RGBToColor<PixelFormat>(63, 60, 17);
+ PixelType color = _bevelColor; //RGBToColor<PixelFormat>(63, 60, 17);
PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
@@ -1178,7 +1183,7 @@ drawRoundedSquareInnerShadow(int x1, int y1, int r, int w, int h, int blur) {
int short_h = h - 2 * r;
- while (sw++ < blur) {
+ while (sw++ < amount) {
colorFill(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color);
sp += p;
@@ -1188,9 +1193,6 @@ drawRoundedSquareInnerShadow(int x1, int y1, int r, int w, int h, int blur) {
while (x > y++) {
__WU_ALGORITHM();
- a1 = a1 * 3 / 4;
- a2 = a2 * 3 / 4;
-
blendPixelPtr(ptr_tr + (y) - (px - p), color, a2);
blendPixelPtr(ptr_tr + (x - 1) - (py), color, a2);
blendPixelPtr(ptr_tl - (x - 1) - (py), color, a2);
@@ -1209,7 +1211,7 @@ drawRoundedSquareInnerShadow(int x1, int y1, int r, int w, int h, int blur) {
ptr_fill += p * r;
while (short_h-- >= 0) {
- colorFill(ptr_fill, ptr_fill + blur, color);
+ colorFill(ptr_fill, ptr_fill + amount, color);
ptr_fill += p;
}
}
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index 3756730720..2c5530c07c 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -47,7 +47,8 @@ struct DrawStep {
fgColor, /** Foreground color */
bgColor, /** backgroudn color */
gradColor1, /** gradient start*/
- gradColor2; /** gradient end */
+ gradColor2, /** gradient end */
+ bevelColor;
bool autoWidth, autoHeight;
int16 x, y, w, h; /** width, height and position, if not measured automatically.
@@ -62,7 +63,7 @@ struct DrawStep {
kVectorAlignCenter
} xAlign, yAlign;
- uint8 shadow, stroke, factor, radius, innerShadow; /** Misc options... */
+ uint8 shadow, stroke, factor, radius, bevel; /** Misc options... */
uint8 fillMode; /** active fill mode */
uint32 extraData; /** Generic parameter for extra options (orientation/bevel) */
@@ -257,6 +258,8 @@ public:
* @param b value of the blue color byte
*/
virtual void setBgColor(uint8 r, uint8 g, uint8 b) = 0;
+
+ virtual void setBevelColor(uint8 r, uint8 g, uint8 b) = 0;
/**
* Set the active gradient color. All shapes drawn using kFillGradient
@@ -330,9 +333,9 @@ public:
_shadowOffset = offset;
}
- virtual void setInnerShadowOffset(int offset) {
- if (offset >= 0)
- _innerShadowOffset = offset;
+ virtual void setBevel(int amount) {
+ if (amount >= 0)
+ _bevel = amount;
}
/**
@@ -450,7 +453,7 @@ protected:
FillMode _fillMode; /** Defines in which way (if any) are filled the drawn shapes */
int _shadowOffset; /** offset for drawn shadows */
- int _innerShadowOffset;
+ int _bevel;
bool _disableShadows; /** Disables temporarily shadow drawing for overlayed images. */
int _strokeWidth; /** Width of the stroke of all drawn shapes */
uint32 _dynamicData; /** Dynamic data from the GUI Theme that modifies the drawing of the current shape */
@@ -538,6 +541,10 @@ public:
void setBgColor(uint8 r, uint8 g, uint8 b) {
this->_bgColor = RGBToColor<PixelFormat>(r, g, b);
}
+
+ void setBevelColor(uint8 r, uint8 g, uint8 b) {
+ this->_bevelColor = RGBToColor<PixelFormat>(r, g, b);
+ }
/**
* @see VectorRenderer::setGradientColors()
@@ -737,7 +744,7 @@ protected:
*/
virtual void drawSquareShadow(int x, int y, int w, int h, int blur);
virtual void drawRoundedSquareShadow(int x, int y, int r, int w, int h, int blur);
- virtual void drawRoundedSquareInnerShadow(int x, int y, int r, int w, int h, int bur);
+ virtual void drawRoundedSquareFakeBevel(int x, int y, int r, int w, int h, int amount);
/**
* Calculates the color gradient on a given point.
@@ -846,6 +853,8 @@ protected:
PixelType _gradientStart; /** Start color for the fill gradient */
PixelType _gradientEnd; /** End color for the fill gradient */
+
+ PixelType _bevelColor;
};
/**