зеркало из https://github.com/mozilla/pjs.git
Bug 378023 - Fix build warnings compiling nsSVGGlyphFrame. r+sr=tor
This commit is contained in:
Родитель
b7deb8d7be
Коммит
40e8b6c4c7
|
@ -78,6 +78,12 @@ NS_NewSVGPoint(nsIDOMSVGPoint** result, float x, float y)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
NS_NewSVGPoint(nsIDOMSVGPoint** result, const gfxPoint& point)
|
||||||
|
{
|
||||||
|
return NS_NewSVGPoint(result, float(point.x), float(point.y));
|
||||||
|
}
|
||||||
|
|
||||||
nsSVGPoint::nsSVGPoint(float x, float y)
|
nsSVGPoint::nsSVGPoint(float x, float y)
|
||||||
: mX(x), mY(y)
|
: mX(x), mY(y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,10 +41,14 @@
|
||||||
#define __NS_SVGPOINT_H__
|
#define __NS_SVGPOINT_H__
|
||||||
|
|
||||||
#include "nsIDOMSVGPoint.h"
|
#include "nsIDOMSVGPoint.h"
|
||||||
|
#include "gfxPoint.h"
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewSVGPoint(nsIDOMSVGPoint** result, float x = 0.0f, float y = 0.0f);
|
NS_NewSVGPoint(nsIDOMSVGPoint** result, float x = 0.0f, float y = 0.0f);
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
NS_NewSVGPoint(nsIDOMSVGPoint** result, const gfxPoint& point);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewSVGReadonlyPoint(nsIDOMSVGPoint** result, float x = 0.0f, float y = 0.0f);
|
NS_NewSVGReadonlyPoint(nsIDOMSVGPoint** result, float x = 0.0f, float y = 0.0f);
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ nsSVGGlyphFrame::GetCharacterPosition(gfxContext *aContext,
|
||||||
if (!data)
|
if (!data)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
float length = data->GetLength();
|
gfxFloat length = data->GetLength();
|
||||||
PRUint32 strLength = aText.Length();
|
PRUint32 strLength = aText.Length();
|
||||||
|
|
||||||
nsAutoPtr<gfxTextRun> textRun(GetTextRun(aContext, aText));
|
nsAutoPtr<gfxTextRun> textRun(GetTextRun(aContext, aText));
|
||||||
|
@ -619,16 +619,16 @@ nsSVGGlyphFrame::GetCharacterPosition(gfxContext *aContext,
|
||||||
for (PRUint32 k = 0; k < strLength; k++)
|
for (PRUint32 k = 0; k < strLength; k++)
|
||||||
cp[k].draw = PR_FALSE;
|
cp[k].draw = PR_FALSE;
|
||||||
|
|
||||||
float x = mPosition.x;
|
gfxFloat x = mPosition.x;
|
||||||
for (PRUint32 i = 0; i < strLength; i++) {
|
for (PRUint32 i = 0; i < strLength; i++) {
|
||||||
float halfAdvance = textRun->GetAdvanceWidth(i, 1, nsnull) / 2.0;
|
gfxFloat halfAdvance = textRun->GetAdvanceWidth(i, 1, nsnull) / 2.0;
|
||||||
|
|
||||||
/* have we run off the end of the path? */
|
/* have we run off the end of the path? */
|
||||||
if (x + halfAdvance > length)
|
if (x + halfAdvance > length)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* check that we've advanced to the start of the path */
|
/* check that we've advanced to the start of the path */
|
||||||
if (x + halfAdvance >= 0.0f) {
|
if (x + halfAdvance >= 0.0) {
|
||||||
cp[i].draw = PR_TRUE;
|
cp[i].draw = PR_TRUE;
|
||||||
|
|
||||||
// add y (normal)
|
// add y (normal)
|
||||||
|
@ -829,7 +829,7 @@ nsSVGGlyphFrame::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_NewSVGPoint(_retval, pt.x, pt.y);
|
return NS_NewSVGPoint(_retval, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -847,23 +847,22 @@ nsSVGGlyphFrame::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval
|
||||||
if (!textRun)
|
if (!textRun)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
gfxPoint pt;
|
||||||
|
|
||||||
if (cp) {
|
if (cp) {
|
||||||
if (cp[charnum].draw == PR_FALSE) {
|
if (cp[charnum].draw == PR_FALSE) {
|
||||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
float advance = textRun->GetAdvanceWidth(charnum, 1, nsnull);
|
gfxFloat advance = textRun->GetAdvanceWidth(charnum, 1, nsnull);
|
||||||
|
pt = cp[charnum].pos +
|
||||||
return NS_NewSVGPoint(_retval,
|
gfxPoint(cos(cp[charnum].angle), sin(cp[charnum].angle)) * advance;
|
||||||
cp[charnum].pos.x + advance * cos(cp[charnum].angle),
|
} else {
|
||||||
cp[charnum].pos.y + advance * sin(cp[charnum].angle));
|
pt = mPosition;
|
||||||
|
pt.x += textRun->GetAdvanceWidth(0, charnum + 1, nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_NewSVGPoint(_retval,
|
return NS_NewSVGPoint(_retval, pt);
|
||||||
mPosition.x + textRun->GetAdvanceWidth(0,
|
|
||||||
charnum + 1,
|
|
||||||
nsnull),
|
|
||||||
mPosition.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -923,7 +922,7 @@ nsSVGGlyphFrame::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSVGGlyphFrame::GetRotationOfChar(PRUint32 charnum, float *_retval)
|
nsSVGGlyphFrame::GetRotationOfChar(PRUint32 charnum, float *_retval)
|
||||||
{
|
{
|
||||||
const double radPerDeg = M_PI/180.0;
|
const gfxFloat radPerDeg = M_PI/180.0;
|
||||||
|
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
GetCharacterData(text);
|
GetCharacterData(text);
|
||||||
|
@ -937,9 +936,9 @@ nsSVGGlyphFrame::GetRotationOfChar(PRUint32 charnum, float *_retval)
|
||||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*_retval = cp[charnum].angle / radPerDeg;
|
*_retval = float(cp[charnum].angle / radPerDeg);
|
||||||
} else {
|
} else {
|
||||||
*_retval = 0.0;
|
*_retval = 0.0f;
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -965,18 +964,18 @@ nsSVGGlyphFrame::GetBaselineOffset(PRUint16 baselineIdentifier)
|
||||||
// not really right, but the best we can do with the information provided
|
// not really right, but the best we can do with the information provided
|
||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
case BASELINE_TEXT_BEFORE_EDGE:
|
case BASELINE_TEXT_BEFORE_EDGE:
|
||||||
_retval = -metrics.mAscent;
|
_retval = -float(metrics.mAscent);
|
||||||
break;
|
break;
|
||||||
case BASELINE_TEXT_AFTER_EDGE:
|
case BASELINE_TEXT_AFTER_EDGE:
|
||||||
_retval = metrics.mDescent;
|
_retval = float(metrics.mDescent);
|
||||||
break;
|
break;
|
||||||
case BASELINE_CENTRAL:
|
case BASELINE_CENTRAL:
|
||||||
case BASELINE_MIDDLE:
|
case BASELINE_MIDDLE:
|
||||||
_retval = - (metrics.mAscent - metrics.mDescent) / 2.0;
|
_retval = -float(metrics.mAscent - metrics.mDescent) / 2.0f;
|
||||||
break;
|
break;
|
||||||
case BASELINE_ALPHABETIC:
|
case BASELINE_ALPHABETIC:
|
||||||
default:
|
default:
|
||||||
_retval = 0.0;
|
_retval = 0.0f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,7 +995,7 @@ nsSVGGlyphFrame::GetAdvance()
|
||||||
if (!textRun)
|
if (!textRun)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
return textRun->GetAdvanceWidth(0, text.Length(), nsnull);
|
return float(textRun->GetAdvanceWidth(0, text.Length(), nsnull));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsSVGTextPathFrame*)
|
NS_IMETHODIMP_(nsSVGTextPathFrame*)
|
||||||
|
@ -1138,7 +1137,7 @@ nsSVGGlyphFrame::GetSubStringLength(PRUint32 charnum, PRUint32 fragmentChars)
|
||||||
if (!textRun)
|
if (!textRun)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
return textRun->GetAdvanceWidth(charnum, fragmentChars, nsnull);
|
return float(textRun->GetAdvanceWidth(charnum, fragmentChars, nsnull));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(PRInt32)
|
NS_IMETHODIMP_(PRInt32)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче