Some graphics primitives scaling comments and consistency edits
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3405 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -33,6 +33,7 @@ TFB_Prim_Point (POINT *p, Color color, POINT ctxOrigin)
|
|||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
|
// The caller must scale the origin!
|
||||||
r.corner.x = p->x + ctxOrigin.x;
|
r.corner.x = p->x + ctxOrigin.x;
|
||||||
r.corner.y = p->y + ctxOrigin.y;
|
r.corner.y = p->y + ctxOrigin.y;
|
||||||
r.extent.width = r.extent.height = 1;
|
r.extent.width = r.extent.height = 1;
|
||||||
@@ -48,6 +49,10 @@ TFB_Prim_Rect (RECT *r, Color color, POINT ctxOrigin)
|
|||||||
{
|
{
|
||||||
RECT arm;
|
RECT arm;
|
||||||
int gscale;
|
int gscale;
|
||||||
|
|
||||||
|
// XXX: Rect prim scaling is currently unused
|
||||||
|
// We scale the rect size just to be consistent with stamp prim,
|
||||||
|
// which does same. The caller must scale the origin!
|
||||||
gscale = GetGraphicScale ();
|
gscale = GetGraphicScale ();
|
||||||
arm = *r;
|
arm = *r;
|
||||||
arm.extent.width = r->extent.width;
|
arm.extent.width = r->extent.width;
|
||||||
@@ -79,6 +84,9 @@ TFB_Prim_FillRect (RECT *r, Color color, POINT ctxOrigin)
|
|||||||
rect.extent.width = r->extent.width;
|
rect.extent.width = r->extent.width;
|
||||||
rect.extent.height = r->extent.height;
|
rect.extent.height = r->extent.height;
|
||||||
|
|
||||||
|
// XXX: Rect prim scaling is currently unused
|
||||||
|
// We scale the rect size just to be consistent with stamp prim,
|
||||||
|
// which does same. The caller must scale the origin!
|
||||||
gscale = GetGraphicScale ();
|
gscale = GetGraphicScale ();
|
||||||
if (gscale != GSCALE_IDENTITY)
|
if (gscale != GSCALE_IDENTITY)
|
||||||
{ // rounding error correction here
|
{ // rounding error correction here
|
||||||
@@ -86,8 +94,6 @@ TFB_Prim_FillRect (RECT *r, Color color, POINT ctxOrigin)
|
|||||||
+ (GSCALE_IDENTITY >> 1)) / GSCALE_IDENTITY;
|
+ (GSCALE_IDENTITY >> 1)) / GSCALE_IDENTITY;
|
||||||
rect.extent.height = (rect.extent.height * gscale
|
rect.extent.height = (rect.extent.height * gscale
|
||||||
+ (GSCALE_IDENTITY >> 1)) / GSCALE_IDENTITY;
|
+ (GSCALE_IDENTITY >> 1)) / GSCALE_IDENTITY;
|
||||||
rect.corner.x += (r->extent.width - rect.extent.width) >> 1;
|
|
||||||
rect.corner.y += (r->extent.height - rect.extent.height) >> 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||||
@@ -101,6 +107,7 @@ TFB_Prim_Line (LINE *line, Color color, POINT ctxOrigin)
|
|||||||
{
|
{
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
|
||||||
|
// The caller must scale the origins!
|
||||||
x1=line->first.x + ctxOrigin.x;
|
x1=line->first.x + ctxOrigin.x;
|
||||||
y1=line->first.y + ctxOrigin.y;
|
y1=line->first.y + ctxOrigin.y;
|
||||||
x2=line->second.x + ctxOrigin.x;
|
x2=line->second.x + ctxOrigin.x;
|
||||||
@@ -140,6 +147,7 @@ TFB_Prim_Stamp (STAMP *stmp, POINT ctxOrigin)
|
|||||||
LockMutex (img->mutex);
|
LockMutex (img->mutex);
|
||||||
|
|
||||||
img->NormalHs = SrcFramePtr->HotSpot;
|
img->NormalHs = SrcFramePtr->HotSpot;
|
||||||
|
// We scale the image size here, but the caller must scale the origin!
|
||||||
x = stmp->origin.x + ctxOrigin.x;
|
x = stmp->origin.x + ctxOrigin.x;
|
||||||
y = stmp->origin.y + ctxOrigin.y;
|
y = stmp->origin.y + ctxOrigin.y;
|
||||||
|
|
||||||
@@ -188,6 +196,7 @@ TFB_Prim_StampFill (STAMP *stmp, Color color, POINT ctxOrigin)
|
|||||||
LockMutex (img->mutex);
|
LockMutex (img->mutex);
|
||||||
|
|
||||||
img->NormalHs = SrcFramePtr->HotSpot;
|
img->NormalHs = SrcFramePtr->HotSpot;
|
||||||
|
// We scale the image size here, but the caller must scale the origin!
|
||||||
x = stmp->origin.x + ctxOrigin.x;
|
x = stmp->origin.x + ctxOrigin.x;
|
||||||
y = stmp->origin.y + ctxOrigin.y;
|
y = stmp->origin.y + ctxOrigin.y;
|
||||||
|
|
||||||
@@ -210,6 +219,7 @@ TFB_Prim_FontChar (POINT charOrigin, TFB_Char *fontChar, TFB_Image *backing,
|
|||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
// Text prim does not scale
|
||||||
x = charOrigin.x + ctxOrigin.x;
|
x = charOrigin.x + ctxOrigin.x;
|
||||||
y = charOrigin.y + ctxOrigin.y;
|
y = charOrigin.y + ctxOrigin.y;
|
||||||
|
|
||||||
|
|||||||
@@ -937,7 +937,7 @@ PostProcessQueue (VIEW_STATE view_state, SIZE scroll_x,
|
|||||||
ElementPtr->next.image.frame);
|
ElementPtr->next.image.frame);
|
||||||
|
|
||||||
if (optMeleeScale == TFB_SCALE_TRILINEAR &&
|
if (optMeleeScale == TFB_SCALE_TRILINEAR &&
|
||||||
index < 2 && scale != 256)
|
index < 2 && scale != GSCALE_IDENTITY)
|
||||||
{
|
{
|
||||||
// enqueues drawcommand to assign next
|
// enqueues drawcommand to assign next
|
||||||
// (smaller) zoom level image as mipmap,
|
// (smaller) zoom level image as mipmap,
|
||||||
|
|||||||
Reference in New Issue
Block a user