diff options
| author | Max Horn | 2004-11-25 23:51:52 +0000 | 
|---|---|---|
| committer | Max Horn | 2004-11-25 23:51:52 +0000 | 
| commit | e1cc9b9e591b1b29c1fa27a7d97cdb910aedf744 (patch) | |
| tree | 356c34892fd419f8ebffa77c8daa9b4abcba79e1 | |
| parent | 85ec4ee0b50cafba5663ca91958582f60438dcc2 (diff) | |
| download | scummvm-rg350-e1cc9b9e591b1b29c1fa27a7d97cdb910aedf744.tar.gz scummvm-rg350-e1cc9b9e591b1b29c1fa27a7d97cdb910aedf744.tar.bz2 scummvm-rg350-e1cc9b9e591b1b29c1fa27a7d97cdb910aedf744.zip | |
Make use of new graphic primitives (untested, I don't have saga -- please don't kill if this breaks, it should be trivial for you to fix it :-)
svn-id: r15888
| -rw-r--r-- | saga/gfx.cpp | 62 | ||||
| -rw-r--r-- | saga/gfx.h | 2 | 
2 files changed, 9 insertions, 55 deletions
| diff --git a/saga/gfx.cpp b/saga/gfx.cpp index 436ddfdb2e..0c190b5c70 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -355,49 +355,25 @@ int bufToBuffer(byte *dst_buf, int dst_w, int dst_h, const byte *src,  // Fills a rectangle in the surface ds from point 'p1' to point 'p2' using  // the specified color. -int drawRect(SURFACE *ds, Rect *dst_rect, int color) { -	byte *write_p; - -	int w; -	int h; -	int row; -	int left, top, right, bottom; +int drawRect(SURFACE *ds, const Rect *dst_rect, int color) { +	Rect r(ds->w, ds->h);  	if (dst_rect != NULL) { -		dst_rect->clip(ds->w, ds->h); +		r = *dst_rect; +		r.clip(ds->w, ds->h); -		left = dst_rect->left; -		top = dst_rect->top; -		right = dst_rect->right; -		bottom = dst_rect->bottom; - -		if ((left >= right) || (top >= bottom)) { +		if (!r.isValidRect()) {  			// Empty or negative region  			return FAILURE;  		} -	} else { -		left = 0; -		top = 0; -		right = ds->w; -		bottom = ds->h; -	} - -	w = right - left; -	h = bottom - top; - -	write_p = (byte *)ds->pixels + (ds->pitch * top) + left; - -	for (row = 0; row < h; row++) { -		memset(write_p, color, w); -		write_p += ds->pitch;  	} +	 +	ds->fillRect(r, color);  	return SUCCESS;  }  int drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color) { -	int left, top, right, bottom; -  	int min_x;  	int max_x;  	int min_y; @@ -410,29 +386,7 @@ int drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color) {  	assert((ds != NULL) && (p1 != NULL) && (p2 != NULL)); -	left = p1->x; -	top = p1->y; -	right = p2->x; -	bottom = p2->y; - -	min_x = MIN(left, right); -	min_y = MIN(top, bottom); -	max_x = MAX(left, right); -	max_y = MAX(top, bottom); - -	n_p1.x = min_x; -	n_p1.y = min_y; -	n_p2.x = max_x; -	n_p2.y = min_y; -	n_p3.x = max_x; -	n_p3.y = max_y; -	n_p4.x = min_x; -	n_p4.y = max_y; - -	drawLine(ds, &n_p1, &n_p2, color); -	drawLine(ds, &n_p2, &n_p3, color); -	drawLine(ds, &n_p3, &n_p4, color); -	drawLine(ds, &n_p4, &n_p1, color); +	ds->frameRect(Common::Rect(min_x, min_y, max_x+1, max_y+1), color);  	return SUCCESS;  } diff --git a/saga/gfx.h b/saga/gfx.h index 7188d7f134..25a054ddd8 100644 --- a/saga/gfx.h +++ b/saga/gfx.h @@ -87,7 +87,7 @@ int bufToSurface(SURFACE *ds, const byte *src, int src_w, int src_h, Rect *src_r  int bufToBuffer(byte * dst_buf, int dst_w, int dst_h, const byte *src,  	int src_w, int src_h, Rect *src_rect, Point *dst_pt);  int getClipInfo(CLIPINFO *clipinfo); -int drawRect(SURFACE *ds, Rect *dst_rect, int color); +int drawRect(SURFACE *ds, const Rect *dst_rect, int color);  int drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color);  int drawPolyLine(SURFACE *ds, const Point *pts, int pt_ct, int draw_color);  int clipLine(SURFACE *ds, const Point *src_p1, const Point *src_p2, Point *dst_p1, Point *dst_p2); | 
