Misc fixes.
Constant naming fixes. svn-id: r32342
This commit is contained in:
parent
74c458153e
commit
8a83eafbf3
5 changed files with 116 additions and 111 deletions
|
@ -70,7 +70,7 @@ static bool launcherDialog(OSystem &system) {
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
GUI::InterfaceManager iManager(&system, GUI::InterfaceManager::GFX_Standard_16bit);
|
GUI::InterfaceManager iManager(&system, GUI::InterfaceManager::kGfxStandard16bit);
|
||||||
|
|
||||||
iManager.runGUI();
|
iManager.runGUI();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -37,14 +37,14 @@ namespace Graphics {
|
||||||
|
|
||||||
VectorRenderer *createRenderer(int mode) {
|
VectorRenderer *createRenderer(int mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case GUI::InterfaceManager::GFX_Standard_16bit:
|
case GUI::InterfaceManager::kGfxStandard16bit:
|
||||||
return new VectorRendererSpec<uint16, ColorMasks<565> >;
|
return new VectorRendererSpec<uint16, ColorMasks<565> >;
|
||||||
|
|
||||||
case GUI::InterfaceManager::GFX_Antialias_16bit:
|
case GUI::InterfaceManager::kGfxAntialias16bit:
|
||||||
return new VectorRendererAA<uint16, ColorMasks<565> >;
|
return new VectorRendererAA<uint16, ColorMasks<565> >;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,34 +53,34 @@ VectorRenderer *createRenderer(int mode) {
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
void VectorRenderer::drawStep(DrawStep *step) {
|
void VectorRenderer::drawStep(DrawStep *step) {
|
||||||
|
|
||||||
if (step->flags & kDrawStep_CallbackOnly) {
|
if (step->flags & DrawStep::kStepCallbackOnly) {
|
||||||
(this->*(step->drawing_call))(step);
|
(this->*(step->drawing_call))(step);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SetBG)
|
if (step->flags & DrawStep::kStepSetBG)
|
||||||
setBgColor(step->color2.r, step->color2.g, step->color2.b);
|
setBgColor(step->color2.r, step->color2.g, step->color2.b);
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SetFG)
|
if (step->flags & DrawStep::kStepSetFG)
|
||||||
setFgColor(step->color1.r, step->color1.g, step->color1.b);
|
setFgColor(step->color1.r, step->color1.g, step->color1.b);
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SetGradient)
|
if (step->flags & DrawStep::kStepSetGradient)
|
||||||
setGradientColors(step->color1.r, step->color1.g, step->color1.b,
|
setGradientColors(step->color1.r, step->color1.g, step->color1.b,
|
||||||
step->color2.r, step->color2.g, step->color2.b);
|
step->color2.r, step->color2.g, step->color2.b);
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SetShadow)
|
if (step->flags & DrawStep::kStepSetShadow)
|
||||||
shadowEnable(step->shadow);
|
shadowEnable(step->shadow);
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SetGradientFactor)
|
if (step->flags & DrawStep::kStepSetGradientFactor)
|
||||||
setGradientFactor(step->factor);
|
setGradientFactor(step->factor);
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SetStroke)
|
if (step->flags & DrawStep::kStepSetStroke)
|
||||||
setStrokeWidth(step->stroke);
|
setStrokeWidth(step->stroke);
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SetFillMode)
|
if (step->flags & DrawStep::kStepSetFillMode)
|
||||||
setFillMode(step->fill_mode);
|
setFillMode((FillMode)step->fill_mode);
|
||||||
|
|
||||||
if (step->flags & kDrawStep_SettingsOnly)
|
if (step->flags & DrawStep::kStepSettingsOnly)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(this->*(step->drawing_call))(step);
|
(this->*(step->drawing_call))(step);
|
||||||
|
@ -229,33 +229,33 @@ drawCircle(int x, int y, int r) {
|
||||||
if (x + r > Base::_activeSurface->w || y + r > Base::_activeSurface->h)
|
if (x + r > Base::_activeSurface->w || y + r > Base::_activeSurface->h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Base::_fillMode != kFillMode_Disabled && Base::_shadowOffset
|
if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
|
||||||
&& x + r + Base::_shadowOffset < Base::_activeSurface->w
|
&& x + r + Base::_shadowOffset < Base::_activeSurface->w
|
||||||
&& y + r + Base::_shadowOffset < Base::_activeSurface->h) {
|
&& y + r + Base::_shadowOffset < Base::_activeSurface->h) {
|
||||||
drawCircleAlg(x + Base::_shadowOffset + 1, y + Base::_shadowOffset + 1, r, 0, kFillMode_Foreground);
|
drawCircleAlg(x + Base::_shadowOffset + 1, y + Base::_shadowOffset + 1, r, 0, kFillForeground);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(Base::_fillMode) {
|
switch(Base::_fillMode) {
|
||||||
case kFillMode_Disabled:
|
case kFillDisabled:
|
||||||
if (Base::_strokeWidth)
|
if (Base::_strokeWidth)
|
||||||
drawCircleAlg(x, y, r, _fgColor, kFillMode_Disabled);
|
drawCircleAlg(x, y, r, _fgColor, kFillDisabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Foreground:
|
case kFillForeground:
|
||||||
drawCircleAlg(x, y, r, _fgColor, kFillMode_Foreground);
|
drawCircleAlg(x, y, r, _fgColor, kFillForeground);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Background:
|
case kFillBackground:
|
||||||
if (Base::_strokeWidth > 1) {
|
if (Base::_strokeWidth > 1) {
|
||||||
drawCircleAlg(x, y, r, _fgColor, kFillMode_Foreground);
|
drawCircleAlg(x, y, r, _fgColor, kFillForeground);
|
||||||
drawCircleAlg(x, y, r - Base::_strokeWidth, _bgColor, kFillMode_Background);
|
drawCircleAlg(x, y, r - Base::_strokeWidth, _bgColor, kFillBackground);
|
||||||
} else {
|
} else {
|
||||||
drawCircleAlg(x, y, r, _bgColor, kFillMode_Background);
|
drawCircleAlg(x, y, r, _bgColor, kFillBackground);
|
||||||
drawCircleAlg(x, y, r, _fgColor, kFillMode_Disabled);
|
drawCircleAlg(x, y, r, _fgColor, kFillDisabled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Gradient:
|
case kFillGradient:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,31 +267,31 @@ drawSquare(int x, int y, int w, int h) {
|
||||||
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h)
|
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Base::_fillMode != kFillMode_Disabled && Base::_shadowOffset
|
if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
|
||||||
&& x + w + Base::_shadowOffset < Base::_activeSurface->w
|
&& x + w + Base::_shadowOffset < Base::_activeSurface->w
|
||||||
&& y + h + Base::_shadowOffset < Base::_activeSurface->h) {
|
&& y + h + Base::_shadowOffset < Base::_activeSurface->h) {
|
||||||
drawSquareShadow(x, y, w, h, Base::_shadowOffset);
|
drawSquareShadow(x, y, w, h, Base::_shadowOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(Base::_fillMode) {
|
switch(Base::_fillMode) {
|
||||||
case kFillMode_Disabled:
|
case kFillDisabled:
|
||||||
if (Base::_strokeWidth)
|
if (Base::_strokeWidth)
|
||||||
drawSquareAlg(x, y, w, h, _fgColor, kFillMode_Disabled);
|
drawSquareAlg(x, y, w, h, _fgColor, kFillDisabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Foreground:
|
case kFillForeground:
|
||||||
drawSquareAlg(x, y, w, h, _fgColor, kFillMode_Foreground);
|
drawSquareAlg(x, y, w, h, _fgColor, kFillForeground);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Background:
|
case kFillBackground:
|
||||||
drawSquareAlg(x, y, w, h, _bgColor, kFillMode_Background);
|
drawSquareAlg(x, y, w, h, _bgColor, kFillBackground);
|
||||||
drawSquareAlg(x, y, w, h, _fgColor, kFillMode_Disabled);
|
drawSquareAlg(x, y, w, h, _fgColor, kFillDisabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Gradient:
|
case kFillGradient:
|
||||||
VectorRendererSpec::drawSquareAlg(x, y, w, h, 0, kFillMode_Gradient);
|
VectorRendererSpec::drawSquareAlg(x, y, w, h, 0, kFillGradient);
|
||||||
if (Base::_strokeWidth)
|
if (Base::_strokeWidth)
|
||||||
drawSquareAlg(x, y, w, h, _fgColor, kFillMode_Disabled);
|
drawSquareAlg(x, y, w, h, _fgColor, kFillDisabled);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,36 +303,36 @@ drawRoundedSquare(int x, int y, int r, int w, int h) {
|
||||||
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h)
|
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Base::_fillMode != kFillMode_Disabled && Base::_shadowOffset
|
if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
|
||||||
&& x + w + Base::_shadowOffset < Base::_activeSurface->w
|
&& x + w + Base::_shadowOffset < Base::_activeSurface->w
|
||||||
&& y + h + Base::_shadowOffset < Base::_activeSurface->h) {
|
&& y + h + Base::_shadowOffset < Base::_activeSurface->h) {
|
||||||
drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset);
|
drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(Base::_fillMode) {
|
switch(Base::_fillMode) {
|
||||||
case kFillMode_Disabled:
|
case kFillDisabled:
|
||||||
if (Base::_strokeWidth)
|
if (Base::_strokeWidth)
|
||||||
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillMode_Disabled);
|
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillDisabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Foreground:
|
case kFillForeground:
|
||||||
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillMode_Foreground);
|
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillForeground);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Background:
|
case kFillBackground:
|
||||||
VectorRendererSpec::drawRoundedSquareAlg(x, y, r, w, h, _bgColor, kFillMode_Background);
|
VectorRendererSpec::drawRoundedSquareAlg(x, y, r, w, h, _bgColor, kFillBackground);
|
||||||
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillMode_Disabled);
|
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillDisabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFillMode_Gradient:
|
case kFillGradient:
|
||||||
if (Base::_strokeWidth > 1) {
|
if (Base::_strokeWidth > 1) {
|
||||||
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillMode_Foreground);
|
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillForeground);
|
||||||
VectorRendererSpec::drawRoundedSquareAlg(x + Base::_strokeWidth/2, y + Base::_strokeWidth/2,
|
VectorRendererSpec::drawRoundedSquareAlg(x + Base::_strokeWidth/2, y + Base::_strokeWidth/2,
|
||||||
r - Base::_strokeWidth/2, w - Base::_strokeWidth, h - Base::_strokeWidth, 0, kFillMode_Gradient);
|
r - Base::_strokeWidth/2, w - Base::_strokeWidth, h - Base::_strokeWidth, 0, kFillGradient);
|
||||||
} else {
|
} else {
|
||||||
VectorRendererSpec::drawRoundedSquareAlg(x, y, r, w, h, 0, kFillMode_Gradient);
|
VectorRendererSpec::drawRoundedSquareAlg(x, y, r, w, h, 0, kFillGradient);
|
||||||
if (Base::_strokeWidth)
|
if (Base::_strokeWidth)
|
||||||
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillMode_Disabled);
|
drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillDisabled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -344,14 +344,14 @@ drawRoundedSquare(int x, int y, int r, int w, int h) {
|
||||||
/** SQUARE ALGORITHM **/
|
/** SQUARE ALGORITHM **/
|
||||||
template<typename PixelType, typename PixelFormat>
|
template<typename PixelType, typename PixelFormat>
|
||||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||||
drawSquareAlg(int x, int y, int w, int h, PixelType color, FillMode fill_m) {
|
drawSquareAlg(int x, int y, int w, int h, PixelType color, VectorRenderer::FillMode fill_m) {
|
||||||
PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x, y);
|
PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x, y);
|
||||||
int pitch = Base::surfacePitch();
|
int pitch = Base::surfacePitch();
|
||||||
int max_h = h;
|
int max_h = h;
|
||||||
|
|
||||||
if (fill_m != kFillMode_Disabled) {
|
if (fill_m != kFillDisabled) {
|
||||||
while (h--) {
|
while (h--) {
|
||||||
if (fill_m == kFillMode_Gradient)
|
if (fill_m == kFillGradient)
|
||||||
color = calcGradient(max_h - h, max_h);
|
color = calcGradient(max_h - h, max_h);
|
||||||
|
|
||||||
colorFill(ptr, ptr + w, color);
|
colorFill(ptr, ptr + w, color);
|
||||||
|
@ -425,7 +425,7 @@ drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color) {
|
||||||
/** ROUNDED SQUARE ALGORITHM **/
|
/** ROUNDED SQUARE ALGORITHM **/
|
||||||
template<typename PixelType, typename PixelFormat>
|
template<typename PixelType, typename PixelFormat>
|
||||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||||
drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m) {
|
drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, VectorRenderer::FillMode fill_m) {
|
||||||
int f, ddF_x, ddF_y;
|
int f, ddF_x, ddF_y;
|
||||||
int x, y, px, py;
|
int x, y, px, py;
|
||||||
int pitch = Base::surfacePitch();
|
int pitch = Base::surfacePitch();
|
||||||
|
@ -441,7 +441,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillM
|
||||||
int short_h = h - (2 * r) + 2;
|
int short_h = h - (2 * r) + 2;
|
||||||
int long_h = h;
|
int long_h = h;
|
||||||
|
|
||||||
if (fill_m == kFillMode_Disabled) {
|
if (fill_m == kFillDisabled) {
|
||||||
while (sw++ < Base::_strokeWidth) {
|
while (sw++ < Base::_strokeWidth) {
|
||||||
colorFill(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color);
|
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);
|
colorFill(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color);
|
||||||
|
@ -470,7 +470,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillM
|
||||||
} else {
|
} else {
|
||||||
__BE_RESET();
|
__BE_RESET();
|
||||||
|
|
||||||
if (fill_m == kFillMode_Gradient) {
|
if (fill_m == kFillGradient) {
|
||||||
while (x++ < y) {
|
while (x++ < y) {
|
||||||
__BE_ALGORITHM();
|
__BE_ALGORITHM();
|
||||||
colorFill(ptr_tl - x - py, ptr_tr + x - py, calcGradient(real_radius - y, long_h));
|
colorFill(ptr_tl - x - py, ptr_tr + x - py, calcGradient(real_radius - y, long_h));
|
||||||
|
@ -496,7 +496,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillM
|
||||||
|
|
||||||
ptr_fill += pitch * r;
|
ptr_fill += pitch * r;
|
||||||
while (short_h--) {
|
while (short_h--) {
|
||||||
if (fill_m == kFillMode_Gradient)
|
if (fill_m == kFillGradient)
|
||||||
color = calcGradient(real_radius++, long_h);
|
color = calcGradient(real_radius++, long_h);
|
||||||
colorFill(ptr_fill, ptr_fill + w + 1, color);
|
colorFill(ptr_fill, ptr_fill + w + 1, color);
|
||||||
ptr_fill += pitch;
|
ptr_fill += pitch;
|
||||||
|
@ -507,13 +507,13 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillM
|
||||||
/** CIRCLE ALGORITHM **/
|
/** CIRCLE ALGORITHM **/
|
||||||
template<typename PixelType, typename PixelFormat>
|
template<typename PixelType, typename PixelFormat>
|
||||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||||
drawCircleAlg(int x1, int y1, int r, PixelType color, FillMode fill_m) {
|
drawCircleAlg(int x1, int y1, int r, PixelType color, VectorRenderer::FillMode fill_m) {
|
||||||
int f, ddF_x, ddF_y;
|
int f, ddF_x, ddF_y;
|
||||||
int x, y, px, py, sw = 0;
|
int x, y, px, py, sw = 0;
|
||||||
int pitch = Base::surfacePitch();
|
int pitch = Base::surfacePitch();
|
||||||
PixelType *ptr = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
|
PixelType *ptr = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
|
||||||
|
|
||||||
if (fill_m == kFillMode_Disabled) {
|
if (fill_m == kFillDisabled) {
|
||||||
while (sw++ < Base::_strokeWidth) {
|
while (sw++ < Base::_strokeWidth) {
|
||||||
__BE_RESET();
|
__BE_RESET();
|
||||||
r--;
|
r--;
|
||||||
|
@ -700,7 +700,7 @@ drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color) {
|
||||||
/** ROUNDED SQUARES **/
|
/** ROUNDED SQUARES **/
|
||||||
template<typename PixelType, typename PixelFormat>
|
template<typename PixelType, typename PixelFormat>
|
||||||
void VectorRendererAA<PixelType, PixelFormat>::
|
void VectorRendererAA<PixelType, PixelFormat>::
|
||||||
drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m) {
|
drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, VectorRenderer::FillMode fill_m) {
|
||||||
int x, y;
|
int x, y;
|
||||||
int p = Base::surfacePitch(), px, py;
|
int p = Base::surfacePitch(), px, py;
|
||||||
int sw = 0, sp = 0, hp = h * p;
|
int sw = 0, sp = 0, hp = h * p;
|
||||||
|
@ -717,7 +717,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillM
|
||||||
|
|
||||||
int short_h = h - 2 * r;
|
int short_h = h - 2 * r;
|
||||||
|
|
||||||
if (fill_m == kFillMode_Disabled) {
|
if (fill_m == VectorRenderer::kFillDisabled) {
|
||||||
while (sw++ < Base::_strokeWidth) {
|
while (sw++ < Base::_strokeWidth) {
|
||||||
colorFill(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color);
|
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);
|
colorFill(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color);
|
||||||
|
@ -770,7 +770,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillM
|
||||||
/** CIRCLES **/
|
/** CIRCLES **/
|
||||||
template<typename PixelType, typename PixelFormat>
|
template<typename PixelType, typename PixelFormat>
|
||||||
void VectorRendererAA<PixelType, PixelFormat>::
|
void VectorRendererAA<PixelType, PixelFormat>::
|
||||||
drawCircleAlg(int x1, int y1, int r, PixelType color, FillMode fill_m) {
|
drawCircleAlg(int x1, int y1, int r, PixelType color, VectorRenderer::FillMode fill_m) {
|
||||||
int x, y, sw = 0;
|
int x, y, sw = 0;
|
||||||
int p = Base::surfacePitch(), px, py;
|
int p = Base::surfacePitch(), px, py;
|
||||||
|
|
||||||
|
@ -780,7 +780,7 @@ drawCircleAlg(int x1, int y1, int r, PixelType color, FillMode fill_m) {
|
||||||
|
|
||||||
PixelType *ptr = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
|
PixelType *ptr = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
|
||||||
|
|
||||||
if (fill_m == kFillMode_Disabled) {
|
if (fill_m == VectorRenderer::kFillDisabled) {
|
||||||
while (sw++ < Base::_strokeWidth) {
|
while (sw++ < Base::_strokeWidth) {
|
||||||
x = r - (sw - 1); y = 0; T = 0;
|
x = r - (sw - 1); y = 0; T = 0;
|
||||||
px = p * x; py = 0;
|
px = p * x; py = 0;
|
||||||
|
|
|
@ -27,23 +27,17 @@
|
||||||
#define VECTOR_RENDERER_H
|
#define VECTOR_RENDERER_H
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
#include "common/system.h"
|
||||||
|
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
#include "graphics/colormasks.h"
|
#include "graphics/colormasks.h"
|
||||||
#include "common/system.h"
|
|
||||||
|
#include "gui/InterfaceManager.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
class VectorRenderer;
|
class VectorRenderer;
|
||||||
|
|
||||||
VectorRenderer *createRenderer(int mode);
|
|
||||||
|
|
||||||
/** Specifies the way in which a shape is filled */
|
|
||||||
enum FillMode {
|
|
||||||
kFillMode_Disabled = 0,
|
|
||||||
kFillMode_Foreground = 1,
|
|
||||||
kFillMode_Background = 2,
|
|
||||||
kFillMode_Gradient = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DrawStep {
|
struct DrawStep {
|
||||||
uint32 flags; /** Step flags, see DrawStepFlags */
|
uint32 flags; /** Step flags, see DrawStepFlags */
|
||||||
|
|
||||||
|
@ -56,22 +50,24 @@ struct DrawStep {
|
||||||
uint16 x, y, w, h, r; /** Shape size */
|
uint16 x, y, w, h, r; /** Shape size */
|
||||||
uint8 shadow, stroke, factor; /** Misc options... */
|
uint8 shadow, stroke, factor; /** Misc options... */
|
||||||
|
|
||||||
FillMode fill_mode; /** active fill mode */
|
int fill_mode; /** active fill mode */
|
||||||
|
|
||||||
void (VectorRenderer::*drawing_call)(DrawStep*); /** Pointer to drawing function */
|
void (VectorRenderer::*drawing_call)(DrawStep*); /** Pointer to drawing function */
|
||||||
|
|
||||||
|
enum DrawStepFlags {
|
||||||
|
kStepCallbackOnly = (1 << 0),
|
||||||
|
kStepSettingsOnly = (1 << 1),
|
||||||
|
kStepSetBG = (1 << 2),
|
||||||
|
kStepSetFG = (1 << 3),
|
||||||
|
kStepSetGradient = (1 << 4),
|
||||||
|
kStepSetShadow = (1 << 5),
|
||||||
|
kStepSetGradientFactor = (1 << 6),
|
||||||
|
kStepSetStroke = (1 << 7),
|
||||||
|
kStepSetFillMode = (1 << 8)
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DrawStepFlags {
|
VectorRenderer *createRenderer(int mode);
|
||||||
kDrawStep_CallbackOnly = (1 << 0),
|
|
||||||
kDrawStep_SettingsOnly = (1 << 1),
|
|
||||||
kDrawStep_SetBG = (1 << 2),
|
|
||||||
kDrawStep_SetFG = (1 << 3),
|
|
||||||
kDrawStep_SetGradient = (1 << 4),
|
|
||||||
kDrawStep_SetShadow = (1 << 5),
|
|
||||||
kDrawStep_SetGradientFactor = (1 << 6),
|
|
||||||
kDrawStep_SetStroke = (1 << 7),
|
|
||||||
kDrawStep_SetFillMode = (1 << 8)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VectorRenderer: The core Vector Renderer Class
|
* VectorRenderer: The core Vector Renderer Class
|
||||||
|
@ -90,9 +86,17 @@ enum DrawStepFlags {
|
||||||
*/
|
*/
|
||||||
class VectorRenderer {
|
class VectorRenderer {
|
||||||
public:
|
public:
|
||||||
VectorRenderer() : _shadowOffset(0), _fillMode(kFillMode_Disabled), _activeSurface(NULL), _strokeWidth(1), _gradientFactor(1) {}
|
VectorRenderer() : _shadowOffset(0), _fillMode(kFillDisabled), _activeSurface(NULL), _strokeWidth(1), _gradientFactor(1) {}
|
||||||
virtual ~VectorRenderer() {}
|
virtual ~VectorRenderer() {}
|
||||||
|
|
||||||
|
/** Specifies the way in which a shape is filled */
|
||||||
|
enum FillMode {
|
||||||
|
kFillDisabled = 0,
|
||||||
|
kFillForeground = 1,
|
||||||
|
kFillBackground = 2,
|
||||||
|
kFillGradient = 3
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a line by considering the special cases for optimization.
|
* Draws a line by considering the special cases for optimization.
|
||||||
*
|
*
|
||||||
|
@ -183,7 +187,7 @@ public:
|
||||||
virtual void setBgColor(uint8 r, uint8 g, uint8 b) = 0;
|
virtual void setBgColor(uint8 r, uint8 g, uint8 b) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the active gradient color. All shapes drawn using kFillMode_Gradient
|
* Set the active gradient color. All shapes drawn using kFillGradient
|
||||||
* as their fill mode will use this VERTICAL gradient as their fill color.
|
* as their fill mode will use this VERTICAL gradient as their fill color.
|
||||||
*
|
*
|
||||||
* @param r1 value of the red color byte for the start color
|
* @param r1 value of the red color byte for the start color
|
||||||
|
@ -311,7 +315,6 @@ protected:
|
||||||
int _gradientBytes[3]; /** Color bytes of the active gradient, used to speed up calculation */
|
int _gradientBytes[3]; /** Color bytes of the active gradient, used to speed up calculation */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VectorRendererSpec: Specialized Vector Renderer Class
|
* VectorRendererSpec: Specialized Vector Renderer Class
|
||||||
*
|
*
|
||||||
|
@ -392,11 +395,11 @@ public:
|
||||||
int h = _activeSurface->h ;
|
int h = _activeSurface->h ;
|
||||||
int pitch = surfacePitch();
|
int pitch = surfacePitch();
|
||||||
|
|
||||||
if (Base::_fillMode == kFillMode_Background)
|
if (Base::_fillMode == kFillBackground)
|
||||||
colorFill(ptr, ptr + w * h, _bgColor);
|
colorFill(ptr, ptr + w * h, _bgColor);
|
||||||
else if (Base::_fillMode == kFillMode_Foreground)
|
else if (Base::_fillMode == kFillForeground)
|
||||||
colorFill(ptr, ptr + w * h, _fgColor);
|
colorFill(ptr, ptr + w * h, _fgColor);
|
||||||
else if (Base::_fillMode == kFillMode_Gradient) {
|
else if (Base::_fillMode == kFillGradient) {
|
||||||
int i = h;
|
int i = h;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
colorFill(ptr, ptr + w, calcGradient(h - i, h));
|
colorFill(ptr, ptr + w, calcGradient(h - i, h));
|
||||||
|
@ -622,7 +625,7 @@ protected:
|
||||||
*
|
*
|
||||||
* @see VectorRenderer::drawCircleAlg()
|
* @see VectorRenderer::drawCircleAlg()
|
||||||
*/
|
*/
|
||||||
virtual void drawCircleAlg(int x, int y, int r, PixelType color, FillMode fill_m);
|
virtual void drawCircleAlg(int x, int y, int r, PixelType color, VectorRenderer::FillMode fill_m);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Wu's Circle Antialiasing Algorithm" as published by Xiaolin Wu, July 1991,
|
* "Wu's Circle Antialiasing Algorithm" as published by Xiaolin Wu, July 1991,
|
||||||
|
@ -631,7 +634,7 @@ protected:
|
||||||
*
|
*
|
||||||
* @see VectorRenderer::drawRoundedAlg()
|
* @see VectorRenderer::drawRoundedAlg()
|
||||||
*/
|
*/
|
||||||
virtual void drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m);
|
virtual void drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, VectorRenderer::FillMode fill_m);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Graphics
|
} // end of namespace Graphics
|
||||||
|
|
|
@ -34,11 +34,13 @@
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
using namespace Graphics;
|
||||||
|
|
||||||
template<typename PixelType>
|
template<typename PixelType>
|
||||||
void InterfaceManager::screenInit() {
|
void InterfaceManager::screenInit() {
|
||||||
freeScreen();
|
freeScreen();
|
||||||
|
|
||||||
_screen = new Graphics::Surface;
|
_screen = new Surface;
|
||||||
_screen->create(_system->getOverlayWidth(), _system->getOverlayHeight(), sizeof(PixelType));
|
_screen->create(_system->getOverlayWidth(), _system->getOverlayHeight(), sizeof(PixelType));
|
||||||
_system->clearOverlay();
|
_system->clearOverlay();
|
||||||
}
|
}
|
||||||
|
@ -50,12 +52,12 @@ void InterfaceManager::setGraphicsMode(Graphics_Mode mode) {
|
||||||
_graphicsMode = mode;
|
_graphicsMode = mode;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case GFX_Standard_16bit:
|
case kGfxStandard16bit:
|
||||||
_bytesPerPixel = sizeof(uint16);
|
_bytesPerPixel = sizeof(uint16);
|
||||||
screenInit<uint16>();
|
screenInit<uint16>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GFX_Antialias_16bit:
|
case kGfxAntialias16bit:
|
||||||
_bytesPerPixel = sizeof(uint16);
|
_bytesPerPixel = sizeof(uint16);
|
||||||
screenInit<uint16>();
|
screenInit<uint16>();
|
||||||
break;
|
break;
|
||||||
|
@ -64,7 +66,7 @@ void InterfaceManager::setGraphicsMode(Graphics_Mode mode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_vectorRenderer = Graphics::createRenderer(mode);
|
_vectorRenderer = createRenderer(mode);
|
||||||
_vectorRenderer->setSurface(_screen);
|
_vectorRenderer->setSurface(_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,9 +82,9 @@ int InterfaceManager::runGUI() {
|
||||||
steps[0].color2.r = 240;
|
steps[0].color2.r = 240;
|
||||||
steps[0].color2.g = 200;
|
steps[0].color2.g = 200;
|
||||||
steps[0].color2.b = 25;
|
steps[0].color2.b = 25;
|
||||||
steps[0].fill_mode = Graphics::kFillMode_Gradient;
|
steps[0].fill_mode = VectorRenderer::kFillGradient;
|
||||||
steps[0].drawing_call = &Graphics::VectorRenderer::drawCallback_FILLSURFACE;
|
steps[0].drawing_call = &VectorRenderer::drawCallback_FILLSURFACE;
|
||||||
steps[0].flags = Graphics::kDrawStep_SetGradient | Graphics::kDrawStep_SetFillMode;
|
steps[0].flags = DrawStep::kStepSetGradient | DrawStep::kStepSetFillMode;
|
||||||
|
|
||||||
steps[1].color1.r = 206;
|
steps[1].color1.r = 206;
|
||||||
steps[1].color1.g = 121;
|
steps[1].color1.g = 121;
|
||||||
|
@ -95,24 +97,24 @@ int InterfaceManager::runGUI() {
|
||||||
steps[1].r = 8;
|
steps[1].r = 8;
|
||||||
steps[1].w = 120;
|
steps[1].w = 120;
|
||||||
steps[1].h = 30;
|
steps[1].h = 30;
|
||||||
steps[1].drawing_call = &Graphics::VectorRenderer::drawCallback_ROUNDSQ;
|
steps[1].drawing_call = &VectorRenderer::drawCallback_ROUNDSQ;
|
||||||
steps[1].flags = Graphics::kDrawStep_SetGradient;
|
steps[1].flags = DrawStep::kStepSetGradient;
|
||||||
|
|
||||||
steps[2].x = 500;
|
steps[2].x = 500;
|
||||||
steps[2].y = 135;
|
steps[2].y = 135;
|
||||||
steps[2].r = 8;
|
steps[2].r = 8;
|
||||||
steps[2].w = 120;
|
steps[2].w = 120;
|
||||||
steps[2].h = 30;
|
steps[2].h = 30;
|
||||||
steps[2].drawing_call = &Graphics::VectorRenderer::drawCallback_ROUNDSQ;
|
steps[2].drawing_call = &VectorRenderer::drawCallback_ROUNDSQ;
|
||||||
steps[2].flags = Graphics::kDrawStep_CallbackOnly;
|
steps[2].flags = DrawStep::kStepCallbackOnly;
|
||||||
|
|
||||||
steps[3].x = 500;
|
steps[3].x = 500;
|
||||||
steps[3].y = 175;
|
steps[3].y = 175;
|
||||||
steps[3].r = 8;
|
steps[3].r = 8;
|
||||||
steps[3].w = 120;
|
steps[3].w = 120;
|
||||||
steps[3].h = 30;
|
steps[3].h = 30;
|
||||||
steps[3].drawing_call = &Graphics::VectorRenderer::drawCallback_ROUNDSQ;
|
steps[3].drawing_call = &VectorRenderer::drawCallback_ROUNDSQ;
|
||||||
steps[3].flags = Graphics::kDrawStep_CallbackOnly;
|
steps[3].flags = DrawStep::kStepCallbackOnly;
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
while (running) { // draw!!
|
while (running) { // draw!!
|
||||||
|
|
|
@ -38,13 +38,13 @@ class InterfaceManager {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Graphics_Mode {
|
enum Graphics_Mode {
|
||||||
GFX_Disabled = 0,
|
kGfxDisabled = 0,
|
||||||
GFX_Standard_16bit,
|
kGfxStandard16bit,
|
||||||
GFX_Antialias_16bit
|
kGfxAntialias16bit
|
||||||
};
|
};
|
||||||
|
|
||||||
InterfaceManager(OSystem *system, Graphics_Mode mode) : _vectorRenderer(0),
|
InterfaceManager(OSystem *system, Graphics_Mode mode) : _vectorRenderer(0),
|
||||||
_system(system), _graphicsMode(GFX_Disabled), _screen(0), _bytesPerPixel(0) {
|
_system(system), _graphicsMode(kGfxDisabled), _screen(0), _bytesPerPixel(0) {
|
||||||
|
|
||||||
setGraphicsMode(mode);
|
setGraphicsMode(mode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue