aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-03 17:17:27 -0400
committerMatthew Hoops2011-05-03 17:25:41 -0400
commit9cb600099f4c29298707787cafad2741a1cd6686 (patch)
treefb1930fa56b611317831d66442cba19b18d2e57a /engines/sword25/gfx
parent3b2283daf850605ca897002afbafe44489c35473 (diff)
parent95a6098f672191dc0792bd4f9bfa18706bbe8e3a (diff)
downloadscummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.gz
scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.bz2
scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/sword25/gfx')
-rw-r--r--engines/sword25/gfx/graphicengine.cpp17
-rw-r--r--engines/sword25/gfx/graphicengine_script.cpp51
-rw-r--r--engines/sword25/gfx/image/art.cpp60
-rw-r--r--engines/sword25/gfx/image/art.h145
-rw-r--r--engines/sword25/gfx/image/image.h144
-rw-r--r--engines/sword25/gfx/image/pngloader.cpp32
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp75
-rw-r--r--engines/sword25/gfx/image/renderedimage.h24
-rw-r--r--engines/sword25/gfx/image/swimage.cpp8
-rw-r--r--engines/sword25/gfx/image/vectorimage.cpp102
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.cpp35
-rw-r--r--engines/sword25/gfx/screenshot.cpp5
-rw-r--r--engines/sword25/gfx/text.cpp4
13 files changed, 338 insertions, 364 deletions
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 5fefcec420..8bdf2a4a6e 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -112,8 +112,10 @@ bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCoun
_screenRect.right = _width;
_screenRect.bottom = _height;
- _backSurface.create(width, height, 4);
- _frameBuffer.create(width, height, 4);
+ const Graphics::PixelFormat format = g_system->getScreenFormat();
+
+ _backSurface.create(width, height, format);
+ _frameBuffer.create(width, height, format);
// Standardmäßig ist Vsync an.
setVsync(true);
@@ -206,6 +208,7 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
for (int i = rect.top; i < rect.bottom; i++) {
out = outo;
for (int j = rect.left; j < rect.right; j++) {
+#if defined(SCUMM_LITTLE_ENDIAN)
*out += (byte)(((cb - *out) * ca) >> 8);
out++;
*out += (byte)(((cg - *out) * ca) >> 8);
@@ -214,6 +217,16 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
out++;
*out = 255;
out++;
+#else
+ *out = 255;
+ out++;
+ *out += (byte)(((cr - *out) * ca) >> 8);
+ out++;
+ *out += (byte)(((cg - *out) * ca) >> 8);
+ out++;
+ *out += (byte)(((cb - *out) * ca) >> 8);
+ out++;
+#endif
}
outo += _backSurface.pitch;
diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp
index d67d0038c3..d8daaab32c 100644
--- a/engines/sword25/gfx/graphicengine_script.cpp
+++ b/engines/sword25/gfx/graphicengine_script.cpp
@@ -81,26 +81,6 @@ static ActionCallback *actionCallbackPtr = 0; // FIXME: should be turned into Gr
#define ANIMATION_TEMPLATE_CLASS_NAME "Gfx.AnimationTemplate"
static const char *GFX_LIBRARY_NAME = "Gfx";
-// Wie luaL_checkudata, nur ohne dass kein Fehler erzeugt wird.
-static void *my_checkudata(lua_State *L, int ud, const char *tname) {
- int top = lua_gettop(L);
-
- void *p = lua_touserdata(L, ud);
- if (p != NULL) { /* value is a userdata? */
- if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
- // lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
- LuaBindhelper::getMetatable(L, tname);
- if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
- lua_settop(L, top);
- return p;
- }
- }
- }
-
- lua_settop(L, top);
- return NULL;
-}
-
static void newUintUserData(lua_State *L, uint value) {
void *userData = lua_newuserdata(L, sizeof(value));
memcpy(userData, &value, sizeof(value));
@@ -108,8 +88,8 @@ static void newUintUserData(lua_State *L, uint value) {
static AnimationTemplate *checkAnimationTemplate(lua_State *L, int idx = 1) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate
- uint animationTemplateHandle;
- if ((animationTemplateHandle = *reinterpret_cast<uint *>(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) {
+ uint animationTemplateHandle = *reinterpret_cast<uint *>(LuaBindhelper::my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME));
+ if (animationTemplateHandle != 0) {
AnimationTemplate *animationTemplatePtr = AnimationTemplateRegistry::instance().resolveHandle(animationTemplateHandle);
if (!animationTemplatePtr)
luaL_error(L, "The animation template with the handle %d does no longer exist.", animationTemplateHandle);
@@ -370,10 +350,10 @@ static const luaL_reg GFX_FUNCTIONS[] = {
static RenderObjectPtr<RenderObject> checkRenderObject(lua_State *L, bool errorIfRemoved = true) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable einer Klasse haben, die von Gfx.RenderObject "erbt".
uint *userDataPtr;
- if ((userDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
- (userDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
- (userDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
- (userDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
+ if ((userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
+ (userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
if (roPtr.isValid())
return roPtr;
@@ -600,11 +580,11 @@ static const luaL_reg RENDEROBJECT_METHODS[] = {
static RenderObjectPtr<Panel> checkPanel(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel
uint *userDataPtr;
- if ((userDataPtr = (uint *)my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
+ if ((userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
- if (roPtr.isValid()) {
+ if (roPtr.isValid())
return roPtr->toPanel();
- } else
+ else
luaL_error(L, "The panel with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" PANEL_CLASS_NAME "' expected");
@@ -645,11 +625,11 @@ static const luaL_reg PANEL_METHODS[] = {
static RenderObjectPtr<Bitmap> checkBitmap(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap
uint *userDataPtr;
- if ((userDataPtr = (uint *)my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
+ if ((userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
- if (roPtr.isValid()) {
+ if (roPtr.isValid())
return roPtr->toBitmap();
- } else
+ else
luaL_error(L, "The bitmap with the handle %d does no longer exist.", *userDataPtr);
} else {
luaL_argcheck(L, 0, 1, "'" BITMAP_CLASS_NAME "' expected");
@@ -790,13 +770,12 @@ static const luaL_reg BITMAP_METHODS[] = {
static RenderObjectPtr<Animation> checkAnimation(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation
uint *userDataPtr;
- if ((userDataPtr = (uint *)my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
+ if ((userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
if (roPtr.isValid())
return roPtr->toAnimation();
- else {
+ else
luaL_error(L, "The animation with the handle %d does no longer exist.", *userDataPtr);
- }
} else {
luaL_argcheck(L, 0, 1, "'" ANIMATION_CLASS_NAME "' expected");
}
@@ -1064,7 +1043,7 @@ static const luaL_reg ANIMATION_METHODS[] = {
static RenderObjectPtr<Text> checkText(lua_State *L) {
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text
uint *userDataPtr;
- if ((userDataPtr = (uint *)my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
+ if ((userDataPtr = (uint *)LuaBindhelper::my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
RenderObjectPtr<RenderObject> roPtr(*userDataPtr);
if (roPtr.isValid())
return roPtr->toText();
diff --git a/engines/sword25/gfx/image/art.cpp b/engines/sword25/gfx/image/art.cpp
index d30460901d..69f9425a53 100644
--- a/engines/sword25/gfx/image/art.cpp
+++ b/engines/sword25/gfx/image/art.cpp
@@ -1041,7 +1041,7 @@ static void art_pri_free(ArtPriQ *pq) {
free(pq);
}
-static art_boolean art_pri_empty(ArtPriQ *pq) {
+static bool art_pri_empty(ArtPriQ *pq) {
return pq->n_items == 0;
}
@@ -1122,7 +1122,7 @@ static int art_svp_writer_rewind_add_segment(ArtSvpWriter *self, int wind_left,
ArtSvpWriterRewind *swr = (ArtSvpWriterRewind *)self;
ArtSVP *svp;
ArtSVPSeg *seg;
- art_boolean left_filled = 0, right_filled = 0;
+ bool left_filled = 0, right_filled = 0;
int wind_right = wind_left + delta_wind;
int seg_num;
const int init_n_points_max = 4;
@@ -1459,7 +1459,7 @@ static ArtActiveSeg *art_svp_intersect_add_point(ArtIntersectCtx *ctx, double x,
ArtActiveSeg *seg, ArtBreakFlags break_flags) {
ArtActiveSeg *left, *right;
double x_min = x, x_max = x;
- art_boolean left_live, right_live;
+ bool left_live, right_live;
double d;
double new_x;
ArtActiveSeg *test, *result = NULL;
@@ -1490,9 +1490,9 @@ static ArtActiveSeg *art_svp_intersect_add_point(ArtIntersectCtx *ctx, double x,
left = left->left;
left_live = (left != NULL);
} else
- left_live = ART_FALSE;
+ left_live = false;
} else
- left_live = ART_FALSE;
+ left_live = false;
} else if (right_live) {
if (x >= right->x[(right->flags & ART_ACTIVE_FLAGS_BNEG) ^ 1] &&
/* It may be that one of these conjuncts turns out to be always
@@ -1510,9 +1510,9 @@ static ArtActiveSeg *art_svp_intersect_add_point(ArtIntersectCtx *ctx, double x,
right = right->right;
right_live = (right != NULL);
} else
- right_live = ART_FALSE;
+ right_live = false;
} else
- right_live = ART_FALSE;
+ right_live = false;
}
}
@@ -1571,7 +1571,7 @@ static void art_svp_intersect_swap_active(ArtIntersectCtx *ctx,
* Return value: True if the intersection took place at the current
* scan line, indicating further iteration is needed.
**/
-static art_boolean art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
+static bool art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
ArtActiveSeg *left_seg, ArtActiveSeg *right_seg,
ArtBreakFlags break_flags) {
double left_x0, left_y0, left_x1;
@@ -1597,17 +1597,17 @@ static art_boolean art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
if (left_x1 <
right_seg->x[(right_seg->flags & ART_ACTIVE_FLAGS_BNEG) ^ 1] ||
left_y1 == right_seg->y0)
- return ART_FALSE;
+ return false;
d = left_x1 * right_seg->a + left_y1 * right_seg->b + right_seg->c;
if (d < -EPSILON_A)
- return ART_FALSE;
+ return false;
else if (d < EPSILON_A) {
/* I'm unsure about the break flags here. */
double right_x1 = art_svp_intersect_break(ctx, right_seg,
left_x1, left_y1,
ART_BREAK_RIGHT);
if (left_x1 <= right_x1)
- return ART_FALSE;
+ return false;
}
} else if (left_y1 > right_y1) {
/* Test right (x1, y1) against left segment */
@@ -1615,27 +1615,27 @@ static art_boolean art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
if (right_x1 > left_seg->x[left_seg->flags & ART_ACTIVE_FLAGS_BNEG] ||
right_y1 == left_seg->y0)
- return ART_FALSE;
+ return false;
d = right_x1 * left_seg->a + right_y1 * left_seg->b + left_seg->c;
if (d > EPSILON_A)
- return ART_FALSE;
+ return false;
else if (d > -EPSILON_A) {
/* See above regarding break flags. */
left_x1 = art_svp_intersect_break(ctx, left_seg,
right_x1, right_y1,
ART_BREAK_LEFT);
if (left_x1 <= right_x1)
- return ART_FALSE;
+ return false;
}
} else { /* left_y1 == right_y1 */
left_x1 = left_seg->x[1];
double right_x1 = right_seg->x[1];
if (left_x1 <= right_x1)
- return ART_FALSE;
+ return false;
}
art_svp_intersect_swap_active(ctx, left_seg, right_seg);
- return ART_TRUE;
+ return true;
}
if (left_y1 < right_y1) {
@@ -1645,16 +1645,16 @@ static art_boolean art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
if (left_x1 <
right_seg->x[(right_seg->flags & ART_ACTIVE_FLAGS_BNEG) ^ 1] ||
left_y1 == right_seg->y0)
- return ART_FALSE;
+ return false;
d = left_x1 * right_seg->a + left_y1 * right_seg->b + right_seg->c;
if (d < -EPSILON_A)
- return ART_FALSE;
+ return false;
else if (d < EPSILON_A) {
double right_x1 = art_svp_intersect_break(ctx, right_seg,
left_x1, left_y1,
ART_BREAK_RIGHT);
if (left_x1 <= right_x1)
- return ART_FALSE;
+ return false;
}
} else if (left_y1 > right_y1) {
/* Test right (x1, y1) against left segment */
@@ -1662,23 +1662,23 @@ static art_boolean art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
if (right_x1 > left_seg->x[left_seg->flags & ART_ACTIVE_FLAGS_BNEG] ||
right_y1 == left_seg->y0)
- return ART_FALSE;
+ return false;
d = right_x1 * left_seg->a + right_y1 * left_seg->b + left_seg->c;
if (d > EPSILON_A)
- return ART_FALSE;
+ return false;
else if (d > -EPSILON_A) {
left_x1 = art_svp_intersect_break(ctx, left_seg,
right_x1, right_y1,
ART_BREAK_LEFT);
if (left_x1 <= right_x1)
- return ART_FALSE;
+ return false;
}
} else { /* left_y1 == right_y1 */
left_x1 = left_seg->x[1];
double right_x1 = right_seg->x[1];
if (left_x1 <= right_x1)
- return ART_FALSE;
+ return false;
}
/* The segments cross. Find the intersection point. */
@@ -1748,7 +1748,7 @@ static art_boolean art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
winner->horiz_delta_wind -= loser->delta_wind;
art_svp_intersect_swap_active(ctx, left_seg, right_seg);
- return ART_TRUE;
+ return true;
}
} else if (y == right_seg->y0) {
art_svp_intersect_push_pt(ctx, left_seg, x, y);
@@ -1764,7 +1764,7 @@ static art_boolean art_svp_intersect_test_cross(ArtIntersectCtx *ctx,
if ((break_flags & ART_BREAK_RIGHT) && right_seg->right != NULL)
art_svp_intersect_add_point(ctx, x, y, right_seg->right, break_flags);
}
- return ART_FALSE;
+ return false;
}
/**
@@ -1885,7 +1885,7 @@ static void art_svp_intersect_horiz(ArtIntersectCtx *ctx, ArtActiveSeg *seg,
if (x0 > x1) {
ArtActiveSeg *left;
- art_boolean first = ART_TRUE;
+ bool first = true;
for (left = seg->left; left != NULL; left = seg->left) {
int left_bneg = left->flags & ART_ACTIVE_FLAGS_BNEG;
@@ -1902,12 +1902,12 @@ static void art_svp_intersect_horiz(ArtIntersectCtx *ctx, ArtActiveSeg *seg,
if (first && left->right != NULL) {
art_svp_intersect_test_cross(ctx, left, left->right,
ART_BREAK_RIGHT);
- first = ART_FALSE;
+ first = false;
}
}
} else {
ArtActiveSeg *right;
- art_boolean first = ART_TRUE;
+ bool first = true;
for (right = seg->right; right != NULL; right = seg->right) {
int right_bneg = right->flags & ART_ACTIVE_FLAGS_BNEG;
@@ -1925,7 +1925,7 @@ static void art_svp_intersect_horiz(ArtIntersectCtx *ctx, ArtActiveSeg *seg,
if (first && right->left != NULL) {
art_svp_intersect_test_cross(ctx, right->left, right,
ART_BREAK_RIGHT);
- first = ART_FALSE;
+ first = false;
}
}
}
@@ -2231,7 +2231,7 @@ void art_svp_intersector(const ArtSVP *in, ArtSvpWriter *out) {
typedef double artfloat;
-struct _ArtSVPRenderAAIter {
+struct ArtSVPRenderAAIter {
const ArtSVP *svp;
int x0, x1;
int y;
diff --git a/engines/sword25/gfx/image/art.h b/engines/sword25/gfx/image/art.h
index 90baa770cf..fe3bbd4982 100644
--- a/engines/sword25/gfx/image/art.h
+++ b/engines/sword25/gfx/image/art.h
@@ -42,10 +42,6 @@
namespace Sword25 {
-typedef byte art_u8;
-typedef uint16 art_u16;
-typedef uint32 art_u32;
-
/* These aren't, strictly speaking, configuration macros, but they're
damn handy to have around, and may be worth playing with for
debugging. */
@@ -55,95 +51,55 @@ typedef uint32 art_u32;
/* This one must be used carefully - in particular, p and max should
be variables. They can also be pstruct->el lvalues. */
-#define art_expand(p, type, max) do { if(max) { p = art_renew (p, type, max <<= 1); } else { max = 1; p = art_new(type, 1); } } while (0)
-
-typedef int art_boolean;
-#define ART_FALSE 0
-#define ART_TRUE 1
-
-/* define pi */
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif /* M_PI */
-
-#ifndef M_SQRT2
-#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
-#endif /* M_SQRT2 */
-
-/* Provide macros to feature the GCC function attribute.
- */
-#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
-#define ART_GNUC_PRINTF( format_idx, arg_idx ) \
- __attribute__((__format__ (__printf__, format_idx, arg_idx)))
-#define ART_GNUC_NORETURN \
- __attribute__((__noreturn__))
-#else /* !__GNUC__ */
-#define ART_GNUC_PRINTF( format_idx, arg_idx )
-#define ART_GNUC_NORETURN
-#endif /* !__GNUC__ */
-
-void ART_GNUC_NORETURN
-art_die(const char *fmt, ...) ART_GNUC_PRINTF(1, 2);
-
-void
-art_warn(const char *fmt, ...) ART_GNUC_PRINTF(1, 2);
-
-typedef struct _ArtDRect ArtDRect;
-typedef struct _ArtIRect ArtIRect;
-
-struct _ArtDRect {
+#define art_expand(p, type, max) \
+ do { \
+ if(max) {\
+ p = art_renew(p, type, max <<= 1); \
+ } else { \
+ max = 1; \
+ p = art_new(type, 1); \
+ } \
+ } while (0)
+
+struct ArtDRect {
/*< public >*/
double x0, y0, x1, y1;
};
-struct _ArtIRect {
- /*< public >*/
- int x0, y0, x1, y1;
-};
-
-typedef struct _ArtPoint ArtPoint;
-
-struct _ArtPoint {
+struct ArtPoint {
/*< public >*/
double x, y;
};
/* Basic data structures and constructors for sorted vector paths */
-typedef struct _ArtSVP ArtSVP;
-typedef struct _ArtSVPSeg ArtSVPSeg;
-
-struct _ArtSVPSeg {
+struct ArtSVPSeg {
int n_points;
int dir; /* == 0 for "up", 1 for "down" */
ArtDRect bbox;
ArtPoint *points;
};
-struct _ArtSVP {
+struct ArtSVP {
int n_segs;
ArtSVPSeg segs[1];
};
-void
-art_svp_free(ArtSVP *svp);
+void art_svp_free(ArtSVP *svp);
-int
-art_svp_seg_compare(const void *s1, const void *s2);
+int art_svp_seg_compare(const void *s1, const void *s2);
/* Basic data structures and constructors for bezier paths */
-typedef enum {
+enum ArtPathcode {
ART_MOVETO,
ART_MOVETO_OPEN,
ART_CURVETO,
ART_LINETO,
ART_END
-} ArtPathcode;
-
-typedef struct _ArtBpath ArtBpath;
+};
-struct _ArtBpath {
+struct ArtBpath {
/*< public >*/
ArtPathcode code;
double x1;
@@ -156,10 +112,8 @@ struct _ArtBpath {
/* Basic data structures and constructors for simple vector paths */
-typedef struct _ArtVpath ArtVpath;
-
/* CURVETO is not allowed! */
-struct _ArtVpath {
+struct ArtVpath {
ArtPathcode code;
double x;
double y;
@@ -167,8 +121,7 @@ struct _ArtVpath {
/* Some of the functions need to go into their own modules */
-void
-art_vpath_add_point(ArtVpath **p_vpath, int *pn_points, int *pn_points_max,
+void art_vpath_add_point(ArtVpath **p_vpath, int *pn_points, int *pn_points_max,
ArtPathcode code, double x, double y);
ArtVpath *art_bez_path_to_vec(const ArtBpath *bez, double flatness);
@@ -177,57 +130,49 @@ ArtVpath *art_bez_path_to_vec(const ArtBpath *bez, double flatness);
#ifndef ART_WIND_RULE_DEFINED
#define ART_WIND_RULE_DEFINED
-typedef enum {
+enum ArtWindRule {
ART_WIND_RULE_NONZERO,
ART_WIND_RULE_INTERSECT,
ART_WIND_RULE_ODDEVEN,
ART_WIND_RULE_POSITIVE
-} ArtWindRule;
+};
#endif
-typedef struct _ArtSvpWriter ArtSvpWriter;
-
-struct _ArtSvpWriter {
+struct ArtSvpWriter {
int (*add_segment)(ArtSvpWriter *self, int wind_left, int delta_wind,
double x, double y);
void (*add_point)(ArtSvpWriter *self, int seg_id, double x, double y);
void (*close_segment)(ArtSvpWriter *self, int seg_id);
};
-ArtSvpWriter *
-art_svp_writer_rewind_new(ArtWindRule rule);
+ArtSvpWriter *art_svp_writer_rewind_new(ArtWindRule rule);
-ArtSVP *
-art_svp_writer_rewind_reap(ArtSvpWriter *self);
+ArtSVP *art_svp_writer_rewind_reap(ArtSvpWriter *self);
-int
-art_svp_seg_compare(const void *s1, const void *s2);
+int art_svp_seg_compare(const void *s1, const void *s2);
-void
-art_svp_intersector(const ArtSVP *in, ArtSvpWriter *out);
+void art_svp_intersector(const ArtSVP *in, ArtSvpWriter *out);
/* Sort vector paths into sorted vector paths. */
-ArtSVP *
-art_svp_from_vpath(ArtVpath *vpath);
+ArtSVP *art_svp_from_vpath(ArtVpath *vpath);
/* Sort vector paths into sorted vector paths. */
-typedef enum {
+enum ArtPathStrokeJoinType {
ART_PATH_STROKE_JOIN_MITER,
ART_PATH_STROKE_JOIN_ROUND,
ART_PATH_STROKE_JOIN_BEVEL
-} ArtPathStrokeJoinType;
+};
-typedef enum {
+enum ArtPathStrokeCapType {
ART_PATH_STROKE_CAP_BUTT,
ART_PATH_STROKE_CAP_ROUND,
ART_PATH_STROKE_CAP_SQUARE
-} ArtPathStrokeCapType;
+};
-ArtSVP *
-art_svp_vpath_stroke(ArtVpath *vpath,
+ArtSVP *art_svp_vpath_stroke(ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
double line_width,
@@ -235,8 +180,7 @@ art_svp_vpath_stroke(ArtVpath *vpath,
double flatness);
/* This version may have winding numbers exceeding 1. */
-ArtVpath *
-art_svp_vpath_stroke_raw(ArtVpath *vpath,
+ArtVpath *art_svp_vpath_stroke_raw(ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
double line_width,
@@ -246,27 +190,22 @@ art_svp_vpath_stroke_raw(ArtVpath *vpath,
/* The spiffy antialiased renderer for sorted vector paths. */
-typedef struct _ArtSVPRenderAAStep ArtSVPRenderAAStep;
-typedef struct _ArtSVPRenderAAIter ArtSVPRenderAAIter;
-
-struct _ArtSVPRenderAAStep {
+struct ArtSVPRenderAAStep {
int x;
int delta; /* stored with 16 fractional bits */
};
-ArtSVPRenderAAIter *
-art_svp_render_aa_iter(const ArtSVP *svp,
+struct ArtSVPRenderAAIter;
+
+ArtSVPRenderAAIter *art_svp_render_aa_iter(const ArtSVP *svp,
int x0, int y0, int x1, int y1);
-void
-art_svp_render_aa_iter_step(ArtSVPRenderAAIter *iter, int *p_start,
+void art_svp_render_aa_iter_step(ArtSVPRenderAAIter *iter, int *p_start,
ArtSVPRenderAAStep **p_steps, int *p_n_steps);
-void
-art_svp_render_aa_iter_done(ArtSVPRenderAAIter *iter);
+void art_svp_render_aa_iter_done(ArtSVPRenderAAIter *iter);
-void
-art_svp_render_aa(const ArtSVP *svp,
+void art_svp_render_aa(const ArtSVP *svp,
int x0, int y0, int x1, int y1,
void (*callback)(void *callback_data,
int y,
diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h
index 5ac6d1ac25..7029402c4a 100644
--- a/engines/sword25/gfx/image/image.h
+++ b/engines/sword25/gfx/image/image.h
@@ -55,75 +55,72 @@ public:
// Enums
/**
- @brief Die möglichen Flippingparameter für die Blit-Methode.
+ @brief The possible flipping parameters for the blit methode.
*/
enum FLIP_FLAGS {
- /// Das Bild wird nicht gespiegelt.
+ /// The image will not be flipped.
FLIP_NONE = 0,
- /// Das Bild wird an der horizontalen Achse gespiegelt.
+ /// The image will be flipped at the horizontal axis.
FLIP_H = 1,
- /// Das Bild wird an der vertikalen Achse gespiegelt.
+ /// The image will be flipped at the vertical axis.
FLIP_V = 2,
- /// Das Bild wird an der horizontalen und vertikalen Achse gespiegelt.
+ /// The image will be flipped at the horizontal and vertical axis.
FLIP_HV = FLIP_H | FLIP_V,
- /// Das Bild wird an der horizontalen und vertikalen Achse gespiegelt.
+ /// The image will be flipped at the horizontal and vertical axis.
FLIP_VH = FLIP_H | FLIP_V
};
//@{
- /** @name Accessor-Methoden */
+ /** @name Accessor methods */
/**
- @brief Gibt die Breite des Bildes in Pixeln zurück
+ @brief Returns the width of the image in pixels
*/
virtual int getWidth() const = 0;
/**
- @brief Gibt die Höhe des Bildes in Pixeln zurück
+ @brief Returns the height of the image in pixels
*/
virtual int getHeight() const = 0;
/**
- @brief Gibt das Farbformat des Bildes zurück
+ @brief Returns the color format of the image
*/
virtual GraphicEngine::COLOR_FORMATS getColorFormat() const = 0;
//@}
//@{
- /** @name Render-Methoden */
+ /** @name Render methodes */
/**
- @brief Rendert das Bild in den Framebuffer.
- @param pDest ein Pointer auf das Zielbild. In den meisten Fällen ist dies der Framebuffer.
- @param PosX die Position auf der X-Achse im Zielbild in Pixeln, an der das Bild gerendert werden soll.<br>
- Der Standardwert ist 0.
- @param PosY die Position auf der Y-Achse im Zielbild in Pixeln, an der das Bild gerendert werden soll.<br>
- Der Standardwert ist 0.
- @param Flipping gibt an, wie das Bild gespiegelt werden soll.<br>
- Der Standardwert ist BS_Image::FLIP_NONE (keine Spiegelung)
- @param pSrcPartRect Pointer auf ein Common::Rect, welches den Ausschnitt des Quellbildes spezifiziert, der gerendert
- werden soll oder NULL, falls das gesamte Bild gerendert werden soll.<br>
- Dieser Ausschnitt bezieht sich auf das ungespiegelte und unskalierte Bild.<br>
- Der Standardwert ist NULL.
- @param Color ein ARGB Farbwert, der die Parameter für die Farbmodulation und fürs Alphablending festlegt.<br>
- Die Alpha-Komponente der Farbe bestimmt den Alphablending Parameter (0 = keine Deckung, 255 = volle Deckung).<br>
- Die Farbkomponenten geben die Farbe für die Farbmodulation an.<br>
- Der Standardwert is BS_ARGB(255, 255, 255, 255) (volle Deckung, keine Farbmodulation).
- Zum Erzeugen des Farbwertes können die Makros BS_RGB und BS_ARGB benutzt werden.
- @param Width gibt die Ausgabebreite des Bildausschnittes an.
- Falls diese von der Breite des Bildausschnittes abweicht wird
- das Bild entsprechend Skaliert.<br>
- Der Wert -1 gibt an, dass das Bild nicht Skaliert werden soll.<br>
- Der Standardwert ist -1.
- @param Width gibt die Ausgabehöhe des Bildausschnittes an.
- Falls diese von der Höhe des Bildauschnittes abweicht, wird
- das Bild entsprechend Skaliert.<br>
- Der Wert -1 gibt an, dass das Bild nicht Skaliert werden soll.<br>
- Der Standardwert ist -1.
- @return Gibt false zurück, falls das Rendern fehlgeschlagen ist.
- @remark Er werden nicht alle Blitting-Operationen von allen BS_Image-Klassen unterstützt.<br>
- Mehr Informationen gibt es in der Klassenbeschreibung von BS_Image und durch folgende Methoden:
+ @brief renders the image in the framebuffer
+ @param pDest a pointer to the target image. In most cases this is the framebuffer.
+ @param PosX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br>
+ The default value is 0.
+ @param PosY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br>
+ The default value is 0.
+ @param Flipping how the the image should be flipped.<br>
+ The default value is BS_Image::FLIP_NONE (no flipping)
+ @param pSrcPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br>
+ This referes to the unflipped and unscaled image.<br>
+ The default value is NULL.
+ @param Color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br>
+ The alpha component of the color determines the alpha blending parameter (0 = no covering, 255 = full covering).<br>
+ The color components determines the color for color modulation.<br>
+ The default value is BS_ARGB(255, 255, 255, 255) (full covering, no color modulation).
+ The macros BS_RGB and BS_ARGB can be used for the creation of the color value.
+ @param Width the output width of the screen section.
+ The images will be scaled if the output width of the screen section differs from the image section.<br>
+ The value -1 determines that the image should not be scaled.<br>
+ The default value is -1.
+ @param Width the output height of the screen section.
+ The images will be scaled if the output width of the screen section differs from the image section.<br>
+ The value -1 determines that the image should not be scaled.<br>
+ The default value is -1.
+ @return returns false if the rendering failed.
+ @remark Not all blitting operations of all BS_Image classes are supported.<br>
+ More information can be find in the class description of BS_Image and the following methodes:
- IsBlitTarget()
- IsScalingAllowed()
- IsFillingAllowed()
@@ -138,79 +135,74 @@ public:
int width = -1, int height = -1) = 0;
/**
- @brief Füllt einen Rechteckigen Bereich des Bildes mit einer Farbe.
- @param pFillRect Pointer auf ein Common::Rect, welches den Ausschnitt des Bildes spezifiziert, der gefüllt
- werden soll oder NULL, falls das gesamte Bild gefüllt werden soll.<br>
- Der Standardwert ist NULL.
- @param Color der 32 Bit Farbwert mit dem der Bildbereich gefüllt werden soll.
- @remark Es ist möglich über die Methode transparente Rechtecke darzustellen, indem man eine Farbe mit einem Alphawert ungleich
- 255 angibt.
- @remark Unabhängig vom Farbformat des Bildes muss ein 32 Bit Farbwert angegeben werden. Zur Erzeugung, können die Makros
- BS_RGB und BS_ARGB benutzt werden.
- @remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
+ @brief fills a rectangular section of the image with a color.
+ @param pFillRect Pointer on Common::Rect which specifies the section of the image which is supposed to be filled. If the whole image has to be filled this value is NULL.<br>
+ The default value is NULL.
+ @param Color the 32 Bit color value for filling the image section.
+ @remark It is possible to create transparent rectangulars by using a color with alpha value not equal to 255.
+ @remark Independent from the color format of the image, it must be given a 32 bit color value. The macros BS_RGB and BS_ARGB can be used for the creation of the color value.
+ @remark If the rectangular is not completely inside the screen area, it will be automatically trimmed.
*/
virtual bool fill(const Common::Rect *pFillRect = 0, uint color = BS_RGB(0, 0, 0)) = 0;
/**
- @brief Füllt den Inhalt des Bildes mit Pixeldaten.
- @param Pixeldata ein Vector der die Pixeldaten enthält. Sie müssen in dem Farbformat des Bildes vorliegen und es müssen genügend Daten
- vorhanden sein, um das ganze Bild zu füllen.
- @param Offset der Offset in Byte im Pixeldata-Vector an dem sich der erste zu schreibende Pixel befindet.<br>
- Der Standardwert ist 0.
- @param Stride der Abstand in Byte zwischen dem Zeilenende und dem Beginn einer neuen Zeile im Pixeldata-Vector.<br>
- Der Standardwert ist 0.
- @return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
- @remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
+ @brief Fills the content of the image with pixel data.
+ @param Pixeldata a vector which cotains the pixel data. They must be present in the color format of the image and there must be enough data available for filling the whole image.
+ @param Offset the offset in Byte in Pixeldata-Vector on which the first pixel to write is located.<br>
+ The default value is 0.
+ @param Stride the distance in Byte between the end of line and the beginning of a new line in Pixeldata-Vector.<br>
+ The default value is 0.
+ @return returns false, if the call failed.
+ @remark A call of this methode is only allowd if IsSetContentAllowed() returns true.
*/
virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride) = 0;
/**
- @brief Liest einen Pixel des Bildes.
- @param X die X-Koordinate des Pixels.
- @param Y die Y-Koordinate des Pixels
- @return Gibt den 32-Bit Farbwert des Pixels an der übergebenen Koordinate zurück.
- @remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist
- eher dafür gedacht einzelne Pixel des Bildes auszulesen.
+ @brief Reads out a pixel of the image.
+ @param X the X-coordinate of the pixel.
+ @param Y the y-coordinate of the pixel.
+ @return Returns the 32-bit color value of the pixel at the given position.
+ @remark This methode should not be used in no way to read out bigger parts of the image because the method is very slow. The method is rather intended for reading out single pixels of the image..
*/
virtual uint getPixel(int x, int y) = 0;
//@{
- /** @name Auskunfts-Methoden */
+ /** @name Information methodes */
/**
- @brief Überprüft, ob an dem BS_Image Blit() aufgerufen werden darf.
- @return Gibt false zurück, falls ein Blit()-Aufruf an diesem Objekt nicht gestattet ist.
+ @brief Checks, if it is allowed to call BS_Image Blit().
+ @return Returns false, if a Blit() call is not allowed at this object.
*/
virtual bool isBlitSource() const = 0;
/**
- @brief Überprüft, ob das BS_Image ein Zielbild für einen Blit-Aufruf sein kann.
- @return Gibt false zurück, falls ein Blit-Aufruf mit diesem Objekt als Ziel nicht gestattet ist.
+ @brief Checks, if the BS_Image can be a target image for a Blit call.
+ @return Returns false, if a Blit() call with this object as an target is not allowed.
*/
virtual bool isBlitTarget() const = 0;
/**
- @brief Gibt true zurück, falls das BS_Image bei einem Aufruf von Blit() skaliert dargestellt werden kann.
+ @brief Returns true, if the BS_Image is allowed to be scaled by a Blit() call.
*/
virtual bool isScalingAllowed() const = 0;
/**
- @brief Gibt true zurück, wenn das BS_Image mit einem Aufruf von Fill() gefüllt werden kann.
+ @brief Returns true, if the BS_Image is allowed to be filled by a Fill() call.
*/
virtual bool isFillingAllowed() const = 0;
/**
- @brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit einem Alphawert dargestellt werden kann.
+ @brief Returns true, if the BS_Image is allowed to be displayed with an alpha value.
*/
virtual bool isAlphaAllowed() const = 0;
/**
- @brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit Farbmodulation dargestellt werden kann.
+ @brief Return true, if the BS_Image is allowed to be displayed with color modulation by a Blit() call
*/
virtual bool isColorModulationAllowed() const = 0;
/**
- @brief Gibt true zurück, wenn der Inhalt des BS_Image durch eine Aufruf von SetContent() ausgetauscht werden kann.
+ @brief Returns true, if the content of the BS_Image is allowed to be replaced by call of SetContent().
*/
virtual bool isSetContentAllowed() const = 0;
diff --git a/engines/sword25/gfx/image/pngloader.cpp b/engines/sword25/gfx/image/pngloader.cpp
index f54b45254b..f6c00b6968 100644
--- a/engines/sword25/gfx/image/pngloader.cpp
+++ b/engines/sword25/gfx/image/pngloader.cpp
@@ -84,7 +84,7 @@ static uint findEmbeddedPNG(const byte *fileDataPtr, uint fileSize) {
Common::MemoryReadStream stream(fileDataPtr, fileSize);
stream.seek(0, SEEK_SET);
- // Headerinformationen der Spielstandes einlesen.
+ // Read header information of savegame
uint compressedGamedataSize;
loadString(stream); // Marker
loadString(stream); // Version
@@ -124,7 +124,7 @@ bool PNGLoader::doDecodeImage(const byte *fileDataPtr, uint fileSize, byte *&unc
error("png_check_sig failed");
}
- // Die beiden PNG Strukturen erstellen
+ // Create both PNG structures
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr) {
error("Could not create libpng read struct.");
@@ -135,31 +135,31 @@ bool PNGLoader::doDecodeImage(const byte *fileDataPtr, uint fileSize, byte *&unc
error("Could not create libpng info struct.");
}
- // Alternative Lesefunktion benutzen
+ // Use alternative reading function
const byte **ref = &fileDataPtr;
png_set_read_fn(png_ptr, (void *)ref, png_user_read_data);
- // PNG Header einlesen
+ // Read PNG header
png_read_info(png_ptr, info_ptr);
- // PNG Informationen auslesen
+ // Read out PNG informations
png_uint_32 w, h;
png_get_IHDR(png_ptr, info_ptr, &w, &h, &bitDepth, &colorType, &interlaceType, NULL, NULL);
width = w;
height = h;
- // Pitch des Ausgabebildes berechnen
+ // Calculate pitch of output image
pitch = GraphicEngine::calcPitch(GraphicEngine::CF_ARGB32, width);
- // Speicher für die endgültigen Bilddaten reservieren
- // Dieses geschieht vor dem reservieren von Speicher für temporäre Bilddaten um die Fragmentierung des Speichers gering zu halten
+ // Allocate memory for the final image data.
+ // To keep memory framentation low this happens before allocating memory for temporary image data.
uncompressedDataPtr = new byte[pitch * height];
if (!uncompressedDataPtr) {
error("Could not allocate memory for output image.");
}
- // Bilder jeglicher Farbformate werden zunächst in ARGB Bilder umgewandelt
+ // Images of all color formates will be transformed into ARGB images
if (bitDepth == 16)
png_set_strip_16(png_ptr);
if (colorType == PNG_COLOR_TYPE_PALETTE)
@@ -177,7 +177,7 @@ bool PNGLoader::doDecodeImage(const byte *fileDataPtr, uint fileSize, byte *&unc
if (colorType != PNG_COLOR_TYPE_RGB_ALPHA)
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
- // Nachdem die Transformationen registriert wurden, werden die Bilddaten erneut eingelesen
+ // After the transformations have been registered, the image data is read again.
png_read_update_info(png_ptr, info_ptr);
png_get_IHDR(png_ptr, info_ptr, &w, &h, &bitDepth, &colorType, NULL, NULL, NULL);
width = w;
@@ -218,7 +218,7 @@ bool PNGLoader::doDecodeImage(const byte *fileDataPtr, uint fileSize, byte *&unc
Common::MemoryReadStream *fileStr = new Common::MemoryReadStream(fileDataPtr, fileSize, DisposeAfterUse::NO);
Graphics::PNG *png = new Graphics::PNG();
if (!png->read(fileStr)) // the fileStr pointer, and thus pFileData will be deleted after this is done
- error("Error while reading PNG image");
+ error("Error while reading PNG image");
Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24);
Graphics::Surface *pngSurface = png->getSurface(format);
@@ -251,7 +251,7 @@ bool PNGLoader::doImageProperties(const byte *fileDataPtr, uint fileSize, int &w
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
- // Die beiden PNG Strukturen erstellen
+ // Create both PNG structures
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr) {
error("Could not create libpng read struct.");
@@ -262,14 +262,14 @@ bool PNGLoader::doImageProperties(const byte *fileDataPtr, uint fileSize, int &w
error("Could not create libpng info struct.");
}
- // Alternative Lesefunktion benutzen
+ // Use alternative reading function
const byte **ref = &fileDataPtr;
png_set_read_fn(png_ptr, (void *)ref, png_user_read_data);
- // PNG Header einlesen
+ // Read PNG Header
png_read_info(png_ptr, info_ptr);
- // PNG Informationen auslesen
+ // Read out PNG informations
int bitDepth;
int colorType;
png_uint_32 w, h;
@@ -278,7 +278,7 @@ bool PNGLoader::doImageProperties(const byte *fileDataPtr, uint fileSize, int &w
width = w;
height = h;
- // Die Strukturen freigeben
+ // Destroy libpng structures
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
#else
// We don't need to read the image properties here...
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index 0d2ffb5aee..806d9b27ad 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -59,7 +59,7 @@ RenderedImage::RenderedImage(const Common::String &filename, bool &result) :
_backSurface = Kernel::getInstance()->getGfx()->getSurface();
- // Datei laden
+ // Load file
byte *pFileData;
uint fileSize;
pFileData = pPackage->getFile(filename, &fileSize);
@@ -68,7 +68,7 @@ RenderedImage::RenderedImage(const Common::String &filename, bool &result) :
return;
}
- // Bildeigenschaften bestimmen
+ // Determine image properties
int pitch;
if (!PNGLoader::imageProperties(pFileData, fileSize, _width, _height)) {
error("Could not read image properties.");
@@ -76,14 +76,14 @@ RenderedImage::RenderedImage(const Common::String &filename, bool &result) :
return;
}
- // Das Bild dekomprimieren
+ // Uncompress the image
if (!PNGLoader::decodeImage(pFileData, fileSize, _data, _width, _height, pitch)) {
error("Could not decode image.");
delete[] pFileData;
return;
}
- // Dateidaten freigeben
+ // Cleanup FileData
delete[] pFileData;
_doCleanup = true;
@@ -134,7 +134,7 @@ bool RenderedImage::fill(const Common::Rect *pFillRect, uint color) {
// -----------------------------------------------------------------------------
bool RenderedImage::setContent(const byte *pixeldata, uint size, uint offset, uint stride) {
- // Überprüfen, ob PixelData ausreichend viele Pixel enthält um ein Bild der Größe Width * Height zu erzeugen
+ // Check if PixelData contains enough pixel to create an image with image size equals width * height
if (size < static_cast<uint>(_width * _height * 4)) {
error("PixelData vector is too small to define a 32 bit %dx%d image.", _width, _height);
return false;
@@ -187,7 +187,8 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
// Create an encapsulating surface for the data
Graphics::Surface srcImage;
- srcImage.bytesPerPixel = 4;
+ // TODO: Is the data really in the screen format?
+ srcImage.format = g_system->getScreenFormat();
srcImage.pitch = _width * 4;
srcImage.w = _width;
srcImage.h = _height;
@@ -198,11 +199,11 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
srcImage.w = pPartRect->right - pPartRect->left;
srcImage.h = pPartRect->bottom - pPartRect->top;
- debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping,
+ debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping,
pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height);
} else {
- debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, 0, 0,
+ debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, 0, 0,
srcImage.w, srcImage.h, color, width, height);
}
@@ -267,10 +268,11 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
out = outo;
in = ino;
for (int j = 0; j < img->w; j++) {
- int b = in[0];
- int g = in[1];
- int r = in[2];
- int a = in[3];
+ uint32 pix = *(uint32 *)in;
+ int b = (pix >> 0) & 0xff;
+ int g = (pix >> 8) & 0xff;
+ int r = (pix >> 16) & 0xff;
+ int a = (pix >> 24) & 0xff;
in += inStep;
if (ca != 255) {
@@ -282,6 +284,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
out += 4;
break;
case 255: // Full opacity
+#if defined(SCUMM_LITTLE_ENDIAN)
if (cb != 255)
*out++ = (b * cb) >> 8;
else
@@ -298,9 +301,28 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
*out++ = r;
*out++ = a;
+#else
+ *out++ = a;
+
+ if (cr != 255)
+ *out++ = (r * cr) >> 8;
+ else
+ *out++ = r;
+
+ if (cg != 255)
+ *out++ = (g * cg) >> 8;
+ else
+ *out++ = g;
+
+ if (cb != 255)
+ *out++ = (b * cb) >> 8;
+ else
+ *out++ = b;
+#endif
break;
default: // alpha blending
+#if defined(SCUMM_LITTLE_ENDIAN)
if (cb != 255)
*out += ((b - *out) * a * cb) >> 16;
else
@@ -318,13 +340,32 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
out++;
*out = 255;
out++;
+#else
+ *out = 255;
+ out++;
+ if (cr != 255)
+ *out += ((r - *out) * a * cr) >> 16;
+ else
+ *out += ((r - *out) * a) >> 8;
+ out++;
+ if (cg != 255)
+ *out += ((g - *out) * a * cg) >> 16;
+ else
+ *out += ((g - *out) * a) >> 8;
+ out++;
+ if (cb != 255)
+ *out += ((b - *out) * a * cb) >> 16;
+ else
+ *out += ((b - *out) * a) >> 8;
+ out++;
+#endif
}
}
outo += _backSurface->pitch;
ino += inoStep;
}
- g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(posX, posY), _backSurface->pitch, posX, posY,
+ g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(posX, posY), _backSurface->pitch, posX, posY,
img->w, img->h);
}
@@ -369,7 +410,7 @@ void RenderedImage::copyDirectly(int posX, int posY) {
*/
Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int xSize, int ySize) {
Graphics::Surface *s = new Graphics::Surface();
- s->create(xSize, ySize, srcImage.bytesPerPixel);
+ s->create(xSize, ySize, srcImage.format);
int *horizUsage = scaleLine(xSize, srcImage.w);
int *vertUsage = scaleLine(ySize, srcImage.h);
@@ -380,8 +421,8 @@ Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int x
byte *destP = (byte *)s->getBasePtr(0, yp);
for (int xp = 0; xp < xSize; ++xp) {
- const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.bytesPerPixel);
- for (int byteCtr = 0; byteCtr < srcImage.bytesPerPixel; ++byteCtr) {
+ const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.format.bytesPerPixel);
+ for (int byteCtr = 0; byteCtr < srcImage.format.bytesPerPixel; ++byteCtr) {
*destP++ = *tempSrcP++;
}
}
@@ -413,7 +454,7 @@ int *RenderedImage::scaleLine(int size, int srcSize) {
distCtr -= 100;
}
}
-
+
return v;
}
diff --git a/engines/sword25/gfx/image/renderedimage.h b/engines/sword25/gfx/image/renderedimage.h
index 0375c7acbe..e3f23747da 100644
--- a/engines/sword25/gfx/image/renderedimage.h
+++ b/engines/sword25/gfx/image/renderedimage.h
@@ -50,12 +50,12 @@ public:
RenderedImage(const Common::String &filename, bool &result);
/**
- @brief Erzeugt ein leeres BS_RenderedImage
+ @brief Creates an empty BS_RenderedImage
- @param Width die Breite des zu erzeugenden Bildes.
- @param Height die Höhe des zu erzeugenden Bildes
- @param Result gibt dem Aufrufer bekannt, ob der Konstruktor erfolgreich ausgeführt wurde. Wenn es nach dem Aufruf false enthalten sollte,
- dürfen keine Methoden am Objekt aufgerufen werden und das Objekt ist sofort zu zerstören.
+ @param Width The width of the image to be created.
+ @param Height The height of the image to be created
+ @param Result Informs the caller, whether the constructor is executed successfully. If it contains false
+ after the call, do not call methods on the object and destroy the object immediately.
*/
RenderedImage(uint width, uint height, bool &result);
RenderedImage();
@@ -84,25 +84,25 @@ public:
void replaceContent(byte *pixeldata, int width, int height);
virtual uint getPixel(int x, int y);
- virtual bool isBlitSource() const {
+ virtual bool isBlitSource() const {
return true;
}
- virtual bool isBlitTarget() const {
+ virtual bool isBlitTarget() const {
return false;
}
- virtual bool isScalingAllowed() const {
+ virtual bool isScalingAllowed() const {
return true;
}
- virtual bool isFillingAllowed() const {
+ virtual bool isFillingAllowed() const {
return false;
}
- virtual bool isAlphaAllowed() const {
+ virtual bool isAlphaAllowed() const {
return true;
}
- virtual bool isColorModulationAllowed() const {
+ virtual bool isColorModulationAllowed() const {
return true;
}
- virtual bool isSetContentAllowed() const {
+ virtual bool isSetContentAllowed() const {
return true;
}
diff --git a/engines/sword25/gfx/image/swimage.cpp b/engines/sword25/gfx/image/swimage.cpp
index ff06491b36..3b9b939eb3 100644
--- a/engines/sword25/gfx/image/swimage.cpp
+++ b/engines/sword25/gfx/image/swimage.cpp
@@ -47,7 +47,7 @@ SWImage::SWImage(const Common::String &filename, bool &result) :
PackageManager *pPackage = Kernel::getInstance()->getPackage();
assert(pPackage);
- // Datei laden
+ // Load file
byte *pFileData;
uint fileSize;
pFileData = pPackage->getFile(filename, &fileSize);
@@ -56,21 +56,21 @@ SWImage::SWImage(const Common::String &filename, bool &result) :
return;
}
- // Bildeigenschaften bestimmen
+ // Determine image properties
int pitch;
if (!PNGLoader::imageProperties(pFileData, fileSize, _width, _height)) {
error("Could not read image properties.");
return;
}
- // Das Bild dekomprimieren
+ // Uncompress the image
byte *pUncompressedData;
if (!PNGLoader::decodeImage(pFileData, fileSize, pUncompressedData, _width, _height, pitch)) {
error("Could not decode image.");
return;
}
- // Dateidaten freigeben
+ // Cleanup FileData
delete[] pFileData;
_imageDataPtr = (uint *)pUncompressedData;
diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp
index 094e6a59a8..241e80bad3 100644
--- a/engines/sword25/gfx/image/vectorimage.cpp
+++ b/engines/sword25/gfx/image/vectorimage.cpp
@@ -47,15 +47,15 @@ namespace Sword25 {
#define BEZSMOOTHNESS 0.5
// -----------------------------------------------------------------------------
-// SWF Datentypen
+// SWF datatype
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-// Bitstream Hilfsklasse
+// Bitstream helper class
// -----------------------------------------------------------------------------
-// Das Parsen von SWF-Dateien erfordert sowohl bitweises Auslesen als auch an
-// Bytegrenzen ausgerichtetes Lesen.
-// Diese Klasse ist speziell dafür ausgestattet.
+// The parsing of SWF files requires both bitwise readout and on Byte boundaries
+// oriented reading.
+// This class is specially equipped for this.
// -----------------------------------------------------------------------------
class VectorImage::SWFBitStream {
@@ -85,10 +85,10 @@ public:
}
inline int32 getSignedBits(uint bitCount) {
- // Bits einlesen
+ // readout bits
uint32 temp = getBits(bitCount);
- // Falls das Sign-Bit gesetzt ist, den Rest des Rückgabewertes mit 1-Bits auffüllen (Sign Extension)
+ // If the sign-bit is set, fill the rest of the return value with 1-bit (sign extension)
if (temp & 1 << (bitCount - 1))
return (0xffffffff << bitCount) | temp;
else
@@ -151,28 +151,28 @@ private:
// -----------------------------------------------------------------------------
-// Konstanten und Hilfsfunktionen
+// Constants and utility functions
// -----------------------------------------------------------------------------
namespace {
// -----------------------------------------------------------------------------
-// Konstanten
+// Constants
// -----------------------------------------------------------------------------
-const uint32 MAX_ACCEPTED_FLASH_VERSION = 3; // Die höchste Flash-Dateiversion, die vom Lader akzeptiert wird
+const uint32 MAX_ACCEPTED_FLASH_VERSION = 3; // The maximum flash file version that is accepted by the loader
// -----------------------------------------------------------------------------
-// Konvertiert SWF-Rechteckdaten in einem Bitstrom in Common::Rect-Objekte
+// Converts SWF rectangle data in a bit stream in Common::Rect objects
// -----------------------------------------------------------------------------
Common::Rect flashRectToBSRect(VectorImage::SWFBitStream &bs) {
bs.flushByte();
- // Feststellen mit wie vielen Bits die einzelnen Komponenten kodiert sind
+ // Determines how many bits of the single components are encoded
uint32 bitsPerValue = bs.getBits(5);
- // Die einzelnen Komponenten einlesen
+ // Readout the single components
int32 xMin = bs.getSignedBits(bitsPerValue);
int32 xMax = bs.getSignedBits(bitsPerValue);
int32 yMin = bs.getSignedBits(bitsPerValue);
@@ -182,7 +182,7 @@ Common::Rect flashRectToBSRect(VectorImage::SWFBitStream &bs) {
}
// -----------------------------------------------------------------------------
-// Berechnet die Bounding-Box eines BS_VectorImageElement
+// Calculate the bounding box of a BS_VectorImageElement
// -----------------------------------------------------------------------------
Common::Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement) {
@@ -214,17 +214,17 @@ Common::Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement)
// -----------------------------------------------------------------------------
-// Konstruktion
+// Construction
// -----------------------------------------------------------------------------
VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success, const Common::String &fname) : _pixelData(0), _fname(fname) {
success = false;
- // Bitstream-Objekt erzeugen
- // Im Folgenden werden die Dateidaten aus diesem ausgelesen.
+ // Create bitstream object
+ // In the following the file data will be readout of the bitstream object.
SWFBitStream bs(pFileData, fileSize);
- // SWF-Signatur überprüfen
+ // Check SWF signature
uint32 signature[3];
signature[0] = bs.getByte();
signature[1] = bs.getByte();
@@ -236,37 +236,37 @@ VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success, co
return;
}
- // Versionsangabe überprüfen
+ // Check the version
uint32 version = bs.getByte();
if (version > MAX_ACCEPTED_FLASH_VERSION) {
error("File is of version %d. Highest accepted version is %d.", version, MAX_ACCEPTED_FLASH_VERSION);
return;
}
- // Dateigröße auslesen und mit der tatsächlichen Größe vergleichen
+ // Readout filesize and compare with the actual size
uint32 storedFileSize = bs.getUInt32();
if (storedFileSize != fileSize) {
error("File is not a valid SWF-file");
return;
}
- // SWF-Maße auslesen
+ // readout SWF size
Common::Rect movieRect = flashRectToBSRect(bs);
- // Framerate und Frameanzahl auslesen
+ // Get frame rate and frame count
/* uint32 frameRate = */
bs.getUInt16();
/* uint32 frameCount = */
bs.getUInt16();
- // Tags parsen
- // Da wir uns nur für das erste DefineShape-Tag interessieren
+ // Parse tags
+ // Because we are only interested in the first DifneShape-Tag...
bool keepParsing = true;
while (keepParsing) {
- // Tags beginnen immer an Bytegrenzen
+ // Tags always begin on byte boundaries
bs.flushByte();
- // Tagtyp und Länge auslesen
+ // Readout tag type and length
uint16 tagTypeAndLength = bs.getUInt16();
uint32 tagType = tagTypeAndLength >> 6;
uint32 tagLength = tagTypeAndLength & 0x3f;
@@ -286,13 +286,13 @@ VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success, co
success = parseDefineShape(3, bs);
return;
default:
- // Unbekannte Tags ignorieren
+ // Ignore unknown tags
bs.skipBytes(tagLength);
}
}
- // Die Ausführung darf nicht an dieser Stelle ankommen: Entweder es wird ein Shape gefunden, dann wird die Funktion mit vorher verlassen, oder
- // es wird keines gefunden, dann tritt eine Exception auf sobald über das Ende der Datei hinaus gelesen wird.
+ // The execution must not arrive at this point: Either a shape is found, then the function will be leaved before, or it is found none, then
+ // an exception occurs as soon as it is read beyond of the end of file.
assert(false);
}
@@ -336,13 +336,13 @@ ArtBpath *VectorImage::storeBez(ArtBpath *bez, int lineStyle, int fillStyle0, in
bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
/*uint32 shapeID = */bs.getUInt16();
- // Bounding Box auslesen
+ // readout bounding box
_boundingBox = flashRectToBSRect(bs);
- // Erstes Image-Element erzeugen
+ // create first image element
_elements.resize(1);
- // Styles einlesen
+ // read styles
uint numFillBits;
uint numLineBits;
if (!parseStyles(shapeType, bs, numFillBits, numLineBits))
@@ -352,7 +352,7 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
uint fillStyle0 = 0;
uint fillStyle1 = 0;
- // Shaperecord parsen
+ // parse shaperecord
// ------------------
double curX = 0;
@@ -367,7 +367,7 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
// Non-Edge Record
if (typeFlag == 0) {
- // Feststellen welche Parameter gesetzt werden
+ // Determines which parameters are set
uint32 stateNewStyles = bs.getBits(1);
uint32 stateLineStyle = bs.getBits(1);
uint32 stateFillStyle1 = bs.getBits(1);
@@ -378,10 +378,10 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
uint prevFillStyle0 = fillStyle0;
uint prevFillStyle1 = fillStyle1;
- // End der Shape-Definition erreicht?
+ // End of the shape definition is reached?
if (!stateNewStyles && !stateLineStyle && !stateFillStyle0 && !stateFillStyle1 && !stateMoveTo) {
endOfShapeDiscovered = true;
- // Parameter dekodieren
+ // Decode parameters
} else {
if (stateMoveTo) {
uint32 moveToBits = bs.getBits(5);
@@ -410,7 +410,7 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
numLineBits = 0;
}
- // Ein neuen Pfad erzeugen, es sei denn, es wurden nur neue Styles definiert
+ // Create a new path, unless there were only defined new styles
if (stateLineStyle || stateFillStyle0 || stateFillStyle1 || stateMoveTo) {
// Store previous curve if any
if (bezNodes) {
@@ -426,15 +426,15 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
}
if (stateNewStyles) {
- // An dieser Stelle werden in Flash die alten Style-Definitionen verworfen und mit den neuen überschrieben.
- // Es wird ein neues Element begonnen.
+ // The old style definitions will be discarded and overwritten with the new at this point in Flash.
+ // A new element will be started with a new element.
_elements.resize(_elements.size() + 1);
if (!parseStyles(shapeType, bs, numFillBits, numLineBits))
return false;
}
}
} else {
- // Edge Record
+ // Edge record
uint32 edgeFlag = bs.getBits(1);
uint32 numBits = bs.getBits(4) + 2;
@@ -499,7 +499,7 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
free(bez);
- // Bounding-Boxes der einzelnen Elemente berechnen
+ // Calculate the bounding boxes of each element
Common::Array<VectorImageElement>::iterator it = _elements.begin();
for (; it != _elements.end(); ++it)
it->_boundingBox = CalculateBoundingBox(*it);
@@ -513,16 +513,16 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) {
bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBits, uint &numLineBits) {
bs.flushByte();
- // Fillstyles parsen
+ // Parse fill styles
// -----------------
- // Anzahl an Fillstyles bestimmen
+ // Determine number of fill styles
uint fillStyleCount = bs.getByte();
if (fillStyleCount == 0xff)
fillStyleCount = bs.getUInt16();
- // Alle Fillstyles einlesen, falls ein Fillstyle mit Typ != 0 gefunden wird, wird das Parsen abgebrochen.
- // Es wird nur "solid fill" (Typ 0) unterstützt.
+ // Readout all fill styles. If a fill style with Typ != 0 is found, the parsing is aborted.
+ // Only "solid fill" (Typ 0) is supported.
_elements.back()._fillStyles.reserve(fillStyleCount);
for (uint i = 0; i < fillStyleCount; ++i) {
byte type = bs.getByte();
@@ -543,15 +543,15 @@ bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBit
_elements.back()._fillStyles.push_back(color);
}
- // Linestyles parsen
+ // Line styles parsen
// -----------------
- // Anzahl an Linestyles bestimmen
+ // Determine number of line styles
uint lineStyleCount = bs.getByte();
if (lineStyleCount == 0xff)
lineStyleCount = bs.getUInt16();
- // Alle Linestyles einlesen
+ // Readout all line styles
_elements.back()._lineStyles.reserve(lineStyleCount);
for (uint i = 0; i < lineStyleCount; ++i) {
double width = bs.getUInt16();
@@ -569,7 +569,7 @@ bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBit
_elements.back()._lineStyles.push_back(VectorImageElement::LineStyleType(width, color));
}
- // Bitbreite für die folgenden Styleindizes auslesen
+ // Readout the bit width for the following style indices
numFillBits = bs.getBits(4);
numLineBits = bs.getBits(4);
@@ -608,11 +608,11 @@ bool VectorImage::blit(int posX, int posY,
static int oldWidth = -2;
static int oldHeight = -2;
- // Falls Breite oder Höhe 0 sind, muss nichts dargestellt werden.
+ // If width or height to 0, nothing needs to be shown.
if (width == 0 || height == 0)
return true;
- // Feststellen, ob das alte Bild im Cache nicht wiederbenutzt werden kann und neu Berechnet werden muss
+ // Determine if the old image in the cache can not be reused and must be recalculated
if (!(oldThis == this && oldWidth == width && oldHeight == height)) {
render(width, height);
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp
index 7587aab4e5..99a47015fb 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.cpp
+++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp
@@ -48,7 +48,7 @@
namespace Sword25 {
-void art_rgb_fill_run1(art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n) {
+void art_rgb_fill_run1(byte *buf, byte r, byte g, byte b, int n) {
int i;
if (r == g && g == b && r == 255) {
@@ -62,11 +62,12 @@ void art_rgb_fill_run1(art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n) {
}
}
-void art_rgb_run_alpha1(art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n) {
+void art_rgb_run_alpha1(byte *buf, byte r, byte g, byte b, int alpha, int n) {
int i;
int v;
for (i = 0; i < n; i++) {
+#if defined(SCUMM_LITTLE_ENDIAN)
v = *buf;
*buf++ = v + (((b - v) * alpha + 0x80) >> 8);
v = *buf;
@@ -75,6 +76,16 @@ void art_rgb_run_alpha1(art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha, in
*buf++ = v + (((r - v) * alpha + 0x80) >> 8);
v = *buf;
*buf++ = MIN(v + alpha, 0xff);
+#else
+ v = *buf;
+ *buf++ = MIN(v + alpha, 0xff);
+ v = *buf;
+ *buf++ = v + (((r - v) * alpha + 0x80) >> 8);
+ v = *buf;
+ *buf++ = v + (((g - v) * alpha + 0x80) >> 8);
+ v = *buf;
+ *buf++ = v + (((b - v) * alpha + 0x80) >> 8);
+#endif
}
}
@@ -82,8 +93,8 @@ typedef struct _ArtRgbSVPAlphaData ArtRgbSVPAlphaData;
struct _ArtRgbSVPAlphaData {
int alphatab[256];
- art_u8 r, g, b, alpha;
- art_u8 *buf;
+ byte r, g, b, alpha;
+ byte *buf;
int rowstride;
int x0, x1;
};
@@ -91,12 +102,12 @@ struct _ArtRgbSVPAlphaData {
static void art_rgb_svp_alpha_callback1(void *callback_data, int y,
int start, ArtSVPRenderAAStep *steps, int n_steps) {
ArtRgbSVPAlphaData *data = (ArtRgbSVPAlphaData *)callback_data;
- art_u8 *linebuf;
+ byte *linebuf;
int run_x0, run_x1;
- art_u32 running_sum = start;
+ uint32 running_sum = start;
int x0, x1;
int k;
- art_u8 r, g, b;
+ byte r, g, b;
int *alphatab;
int alpha;
@@ -146,12 +157,12 @@ static void art_rgb_svp_alpha_opaque_callback1(void *callback_data, int y,
int start,
ArtSVPRenderAAStep *steps, int n_steps) {
ArtRgbSVPAlphaData *data = (ArtRgbSVPAlphaData *)callback_data;
- art_u8 *linebuf;
+ byte *linebuf;
int run_x0, run_x1;
- art_u32 running_sum = start;
+ uint32 running_sum = start;
int x0, x1;
int k;
- art_u8 r, g, b;
+ byte r, g, b;
int *alphatab;
int alpha;
@@ -216,7 +227,7 @@ static void art_rgb_svp_alpha_opaque_callback1(void *callback_data, int y,
void art_rgb_svp_alpha1(const ArtSVP *svp,
int x0, int y0, int x1, int y1,
uint32 color,
- art_u8 *buf, int rowstride) {
+ byte *buf, int rowstride) {
ArtRgbSVPAlphaData data;
byte r, g, b, alpha;
int i;
@@ -320,7 +331,7 @@ ArtVpath *art_vpath_reverse_free(ArtVpath *a) {
return dest;
}
-void drawBez(ArtBpath *bez1, ArtBpath *bez2, art_u8 *buffer, int width, int height, int deltaX, int deltaY, double scaleX, double scaleY, double penWidth, unsigned int color) {
+void drawBez(ArtBpath *bez1, ArtBpath *bez2, byte *buffer, int width, int height, int deltaX, int deltaY, double scaleX, double scaleY, double penWidth, unsigned int color) {
ArtVpath *vec = NULL;
ArtVpath *vec1 = NULL;
ArtVpath *vec2 = NULL;
diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp
index 35e94976eb..6ea2b574d6 100644
--- a/engines/sword25/gfx/screenshot.cpp
+++ b/engines/sword25/gfx/screenshot.cpp
@@ -36,6 +36,7 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "sword25/gfx/screenshot.h"
#include "sword25/kernel/filesystemutil.h"
#include <png.h>
@@ -127,14 +128,14 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data)
// generates a pixel of the target image. Finally, the result as a PNG file is stored as a file.
// The source image must be 800x600.
- if (data->w != 800 || data->h != 600 || data->bytesPerPixel != 4) {
+ if (data->w != 800 || data->h != 600 || data->format.bytesPerPixel != 4) {
error("The sreenshot dimensions have to be 800x600 in order to be saved as a thumbnail.");
return false;
}
// Buffer for the output thumbnail
Graphics::Surface thumbnail;
- thumbnail.create(200, 125, 4);
+ thumbnail.create(200, 125, g_system->getScreenFormat());
// Über das Zielbild iterieren und einen Pixel zur Zeit berechnen.
uint x, y;
diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index bbfc3804a3..b1c1708565 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -173,10 +173,8 @@ bool Text::doRender() {
Common::Rect curRect = fontPtr->getCharacterRect((byte)(*iter).text[i]);
Common::Rect renderRect(curX, curY, curX + curRect.width(), curY + curRect.height());
- int renderX = curX + (renderRect.left - renderRect.left);
- int renderY = curY + (renderRect.top - renderRect.top);
renderRect.translate(curRect.left - curX, curRect.top - curY);
- result = charMapPtr->blit(renderX, renderY, Image::FLIP_NONE, &renderRect, _modulationColor);
+ result = charMapPtr->blit(curX, curY, Image::FLIP_NONE, &renderRect, _modulationColor);
if (!result)
break;