Bug 1408612 - patch 1 - Use single-precision floats more consistently for glyph position computations when drawing text. r=jrmuizel

This commit is contained in:
Jonathan Kew 2017-10-24 09:59:09 +01:00
parent 6a25f52bd6
commit 793b63713b
11 changed files with 117 additions and 115 deletions

View File

@ -4360,12 +4360,12 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
virtual void DrawText(nscoord aXOffset, nscoord aWidth)
{
gfxPoint point = mPt;
gfx::Point point = mPt;
bool rtl = mTextRun->IsRightToLeft();
bool verticalRun = mTextRun->IsVertical();
RefPtr<gfxPattern> pattern;
gfxFloat& inlineCoord = verticalRun ? point.y : point.x;
float& inlineCoord = verticalRun ? point.y : point.x;
inlineCoord += aXOffset;
// offset is given in terms of left side of string
@ -4475,7 +4475,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
CanvasRenderingContext2D* mCtx;
// position of the left side of the string, alphabetic baseline
gfxPoint mPt;
gfx::Point mPt;
// current font
gfxFontGroup* mFontgrp;
@ -4590,7 +4590,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
: gfx::ShapedTextFlags();
GetAppUnitsValues(&processor.mAppUnitsPerDevPixel, nullptr);
processor.mPt = gfxPoint(aX, aY);
processor.mPt = gfx::Point(aX, aY);
processor.mDrawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
@ -4697,7 +4697,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
// correct bounding box to get it to be the correct size/position
processor.mBoundingBox.width = totalWidth;
processor.mBoundingBox.MoveBy(processor.mPt);
processor.mBoundingBox.MoveBy(gfxPoint(processor.mPt.x, processor.mPt.y));
processor.mPt.x *= processor.mAppUnitsPerDevPixel;
processor.mPt.y *= processor.mAppUnitsPerDevPixel;

View File

@ -364,7 +364,7 @@ nsFontMetrics::DrawString(const char *aString, uint32_t aLength,
if (!textRun.get()) {
return;
}
gfxPoint pt(aX, aY);
gfx::Point pt(aX, aY);
Range range(0, aLength);
if (mTextRunRTL) {
if (mVertical) {
@ -392,7 +392,7 @@ nsFontMetrics::DrawString(const char16_t* aString, uint32_t aLength,
if (!textRun.get()) {
return;
}
gfxPoint pt(aX, aY);
gfx::Point pt(aX, aY);
Range range(0, aLength);
if (mTextRunRTL) {
if (mVertical) {

View File

@ -1601,13 +1601,11 @@ public:
Flush(true); // flush any remaining buffered glyphs
}
void OutputGlyph(uint32_t aGlyphID, const gfxPoint& aPt)
void OutputGlyph(uint32_t aGlyphID, const gfx::Point& aPt)
{
Glyph *glyph = AppendGlyph();
glyph->mIndex = aGlyphID;
glyph->mPosition.x = aPt.x;
glyph->mPosition.y = aPt.y;
glyph->mPosition = mFontParams.matInv.TransformPoint(glyph->mPosition);
glyph->mPosition = mFontParams.matInv.TransformPoint(aPt);
Flush(false); // this will flush only if the buffer is full
}
@ -1833,13 +1831,13 @@ gfxFont::CalcXScale(DrawTarget* aDrawTarget)
// *aPt is the glyph position in appUnits; it is converted to device
// coordinates (devPt) here.
void
gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
gfxFont::DrawOneGlyph(uint32_t aGlyphID, float aAdvance, gfx::Point *aPt,
GlyphBufferAzure& aBuffer, bool *aEmittedGlyphs) const
{
const TextRunDrawParams& runParams(aBuffer.mRunParams);
const FontDrawParams& fontParams(aBuffer.mFontParams);
double glyphX, glyphY;
float glyphX, glyphY;
if (fontParams.isVerticalFont) {
glyphX = aPt->x;
if (runParams.isRTL) {
@ -1859,8 +1857,8 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
aPt->x += aAdvance;
}
}
gfxPoint devPt(ToDeviceUnits(glyphX, runParams.devPerApp),
ToDeviceUnits(glyphY, runParams.devPerApp));
Point devPt(ToDeviceUnits(glyphX, runParams.devPerApp),
ToDeviceUnits(glyphY, runParams.devPerApp));
if (fontParams.haveSVGGlyphs) {
if (!runParams.paintSVGGlyphs) {
@ -1880,7 +1878,7 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
RenderColorGlyph(runParams.dt, runParams.context,
fontParams.scaledFont, fontParams.renderingOptions,
fontParams.drawOptions,
fontParams.matInv.TransformPoint(gfx::Point(devPt.x, devPt.y)),
fontParams.matInv.TransformPoint(devPt),
aGlyphID)) {
return;
}
@ -1903,17 +1901,17 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
// Draw a run of CharacterGlyph records from the given offset in aShapedText.
// Returns true if glyph paths were actually emitted.
bool
gfxFont::DrawGlyphs(const gfxShapedText *aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
gfxPoint *aPt,
const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams)
gfxFont::DrawGlyphs(const gfxShapedText* aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
gfx::Point* aPt,
const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams)
{
bool emittedGlyphs = false;
GlyphBufferAzure buffer(aRunParams, aFontParams);
gfxFloat& inlineCoord = aFontParams.isVerticalFont ? aPt->y : aPt->x;
float& inlineCoord = aFontParams.isVerticalFont ? aPt->y : aPt->x;
if (aRunParams.spacing) {
inlineCoord += aRunParams.isRTL ? -aRunParams.spacing[0].mBefore
@ -1935,7 +1933,7 @@ gfxFont::DrawGlyphs(const gfxShapedText *aShapedText,
aShapedText->GetDetailedGlyphs(aOffset + i);
NS_ASSERTION(details, "detailedGlyph should not be missing!");
for (uint32_t j = 0; j < glyphCount; ++j, ++details) {
double advance = details->mAdvance;
float advance = details->mAdvance;
if (glyphData->IsMissing()) {
// Default-ignorable chars will have zero advance width;
@ -1948,8 +1946,8 @@ gfxFont::DrawGlyphs(const gfxShapedText *aShapedText,
return false;
}
double glyphX = aPt->x;
double glyphY = aPt->y;
float glyphX = aPt->x;
float glyphY = aPt->y;
if (aRunParams.isRTL) {
if (aFontParams.isVerticalFont) {
glyphY -= advance;
@ -1990,7 +1988,7 @@ gfxFont::DrawGlyphs(const gfxShapedText *aShapedText,
}
}
} else {
gfxPoint glyphXY(*aPt);
Point glyphXY(*aPt);
if (aFontParams.isVerticalFont) {
glyphXY.x += details->mYOffset;
glyphXY.y += details->mXOffset;
@ -2008,7 +2006,7 @@ gfxFont::DrawGlyphs(const gfxShapedText *aShapedText,
}
if (aRunParams.spacing) {
double space = aRunParams.spacing[i].mAfter;
float space = aRunParams.spacing[i].mAfter;
if (i + 1 < aCount) {
space += aRunParams.spacing[i + 1].mBefore;
}
@ -2021,22 +2019,22 @@ gfxFont::DrawGlyphs(const gfxShapedText *aShapedText,
// This method is mostly parallel to DrawGlyphs.
void
gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfx::Point* aPt,
uint32_t aOffset, uint32_t aCount,
const EmphasisMarkDrawParams& aParams)
{
gfxFloat& inlineCoord = aParams.isVertical ? aPt->y : aPt->x;
float& inlineCoord = aParams.isVertical ? aPt->y : aPt->x;
gfxTextRun::Range markRange(aParams.mark);
gfxTextRun::DrawParams params(aParams.context);
gfxFloat clusterStart = -std::numeric_limits<gfxFloat>::infinity();
float clusterStart = -std::numeric_limits<float>::infinity();
bool shouldDrawEmphasisMark = false;
for (uint32_t i = 0, idx = aOffset; i < aCount; ++i, ++idx) {
if (aParams.spacing) {
inlineCoord += aParams.direction * aParams.spacing[i].mBefore;
}
if (aShapedText->IsClusterStart(idx) ||
clusterStart == -std::numeric_limits<gfxFloat>::infinity()) {
clusterStart == -std::numeric_limits<float>::infinity()) {
clusterStart = inlineCoord;
}
if (aShapedText->CharMayHaveEmphasisMark(idx)) {
@ -2045,9 +2043,9 @@ gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
inlineCoord += aParams.direction * aShapedText->GetAdvanceForGlyph(idx);
if (shouldDrawEmphasisMark &&
(i + 1 == aCount || aShapedText->IsClusterStart(idx + 1))) {
gfxFloat clusterAdvance = inlineCoord - clusterStart;
float clusterAdvance = inlineCoord - clusterStart;
// Move the coord backward to get the needed start point.
gfxFloat delta = (clusterAdvance + aParams.advance) / 2;
float delta = (clusterAdvance + aParams.advance) / 2;
inlineCoord -= delta;
aParams.mark->Draw(markRange, *aPt, params);
inlineCoord += delta;
@ -2061,7 +2059,7 @@ gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
void
gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfxPoint *aPt, const TextRunDrawParams& aRunParams,
gfx::Point* aPt, const TextRunDrawParams& aRunParams,
gfx::ShapedTextFlags aOrientation)
{
NS_ASSERTION(aRunParams.drawMode == DrawMode::GLYPH_PATH ||
@ -2099,7 +2097,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
bool sideways = false;
gfxContextMatrixAutoSaveRestore matrixRestore;
gfxPoint origPt = *aPt;
gfx::Point origPt = *aPt;
if (aRunParams.isVerticalRun && !fontParams.isVerticalFont) {
if (textDrawer) {
@ -2221,8 +2219,8 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
}
}
gfxFloat& baseline = fontParams.isVerticalFont ? aPt->x : aPt->y;
gfxFloat origBaseline = baseline;
float& baseline = fontParams.isVerticalFont ? aPt->x : aPt->y;
float origBaseline = baseline;
if (mStyle.baselineOffset != 0.0) {
baseline +=
mStyle.baselineOffset * aTextRun->GetAppUnitsPerDevUnit();
@ -2243,18 +2241,18 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
if (sideways) {
// adjust updated aPt to account for the transform we were using
gfxFloat advance = aPt->x - origPt.x;
float advance = aPt->x - origPt.x;
if (aOrientation ==
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT) {
*aPt = gfxPoint(origPt.x, origPt.y - advance);
*aPt = gfx::Point(origPt.x, origPt.y - advance);
} else {
*aPt = gfxPoint(origPt.x, origPt.y + advance);
*aPt = gfx::Point(origPt.x, origPt.y + advance);
}
}
}
bool
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint) const
{
if (!GetFontEntry()->HasSVGGlyph(aGlyphId)) {
@ -2277,7 +2275,7 @@ gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
}
bool
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint,
gfxTextRunDrawCallbacks *aCallbacks,
bool& aEmittedGlyphs) const

View File

@ -1701,7 +1701,7 @@ public:
* -- all glyphs use this font
*/
void Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfxPoint *aPt, const TextRunDrawParams& aRunParams,
mozilla::gfx::Point* aPt, const TextRunDrawParams& aRunParams,
mozilla::gfx::ShapedTextFlags aOrientation);
/**
@ -1710,7 +1710,8 @@ public:
* @param aPt the baseline origin of the emphasis marks.
* @param aParams some drawing parameters, see EmphasisMarkDrawParams.
*/
void DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
void DrawEmphasisMarks(const gfxTextRun* aShapedText,
mozilla::gfx::Point* aPt,
uint32_t aOffset, uint32_t aCount,
const EmphasisMarkDrawParams& aParams);
@ -1955,21 +1956,21 @@ protected:
// Normal glyphs are simply accumulated in aBuffer until it is full and
// gets flushed, but SVG or color-font glyphs will instead be rendered
// directly to the destination (found from the buffer's parameters).
void DrawOneGlyph(uint32_t aGlyphID,
double aAdvance,
gfxPoint *aPt,
GlyphBufferAzure& aBuffer,
bool *aEmittedGlyphs) const;
void DrawOneGlyph(uint32_t aGlyphID,
float aAdvance,
mozilla::gfx::Point* aPt,
GlyphBufferAzure& aBuffer,
bool* aEmittedGlyphs) const;
// Output a run of glyphs at *aPt, which is updated to follow the last glyph
// in the run. This method also takes account of any letter-spacing provided
// in aRunParams.
bool DrawGlyphs(const gfxShapedText *aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
gfxPoint *aPt,
const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams);
bool DrawGlyphs(const gfxShapedText* aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
mozilla::gfx::Point* aPt,
const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams);
// set the font size and offset used for
// synthetic subscript/superscript glyphs
@ -2243,9 +2244,9 @@ protected:
// if this font has bad underline offset, aIsBadUnderlineFont should be true.
void SanitizeMetrics(Metrics *aMetrics, bool aIsBadUnderlineFont);
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
bool RenderSVGGlyph(gfxContext *aContext, mozilla::gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint) const;
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
bool RenderSVGGlyph(gfxContext *aContext, mozilla::gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint,
gfxTextRunDrawCallbacks *aCallbacks,
bool& aEmittedGlyphs) const;

View File

@ -428,8 +428,8 @@ gfxTextRun::ShrinkToLigatureBoundaries(Range* aRange) const
}
void
gfxTextRun::DrawGlyphs(gfxFont *aFont, Range aRange, gfxPoint *aPt,
PropertyProvider *aProvider, Range aSpacingRange,
gfxTextRun::DrawGlyphs(gfxFont* aFont, Range aRange, gfx::Point* aPt,
PropertyProvider* aProvider, Range aSpacingRange,
TextRunDrawParams& aParams,
gfx::ShapedTextFlags aOrientation) const
{
@ -465,8 +465,8 @@ ClipPartialLigature(const gfxTextRun* aTextRun,
}
void
gfxTextRun::DrawPartialLigature(gfxFont *aFont, Range aRange,
gfxPoint *aPt, PropertyProvider *aProvider,
gfxTextRun::DrawPartialLigature(gfxFont* aFont, Range aRange,
gfx::Point* aPt, PropertyProvider* aProvider,
TextRunDrawParams& aParams,
gfx::ShapedTextFlags aOrientation) const
{
@ -507,11 +507,11 @@ gfxTextRun::DrawPartialLigature(gfxFont *aFont, Range aRange,
aParams.context->Clip(clipRect);
}
gfxPoint pt;
gfx::Point pt;
if (aParams.isVerticalRun) {
pt = gfxPoint(aPt->x, aPt->y - aParams.direction * data.mPartAdvance);
pt = Point(aPt->x, aPt->y - aParams.direction * data.mPartAdvance);
} else {
pt = gfxPoint(aPt->x - aParams.direction * data.mPartAdvance, aPt->y);
pt = Point(aPt->x - aParams.direction * data.mPartAdvance, aPt->y);
}
DrawGlyphs(aFont, data.mRange, &pt,
@ -600,7 +600,7 @@ struct MOZ_STACK_CLASS BufferAlphaColor {
};
void
gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
gfxTextRun::Draw(Range aRange, gfx::Point aPt, const DrawParams& aParams) const
{
NS_ASSERTION(aRange.end <= GetLength(), "Substring out of range");
NS_ASSERTION(aParams.drawMode == DrawMode::GLYPH_PATH ||
@ -655,7 +655,7 @@ gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
metrics.mBoundingBox.MoveBy(gfxPoint(aPt.x - metrics.mAdvanceWidth,
aPt.y));
} else {
metrics.mBoundingBox.MoveBy(aPt);
metrics.mBoundingBox.MoveBy(gfxPoint(aPt.x, aPt.y));
}
syntheticBoldBuffer.PushSolidColor(metrics.mBoundingBox, currentColor,
GetAppUnitsPerDevUnit());
@ -695,7 +695,7 @@ gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
bool drawPartial = (aParams.drawMode & DrawMode::GLYPH_FILL) ||
(aParams.drawMode == DrawMode::GLYPH_PATH &&
aParams.callbacks);
gfxPoint origPt = aPt;
gfx::Point origPt = aPt;
if (drawPartial) {
DrawPartialLigature(font, Range(start, ligatureRange.start),
@ -734,7 +734,7 @@ gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
void
gfxTextRun::DrawEmphasisMarks(gfxContext *aContext,
gfxTextRun* aMark,
gfxFloat aMarkAdvance, gfxPoint aPt,
gfxFloat aMarkAdvance, gfx::Point aPt,
Range aRange, PropertyProvider* aProvider) const
{
MOZ_ASSERT(aRange.end <= GetLength());
@ -746,8 +746,8 @@ gfxTextRun::DrawEmphasisMarks(gfxContext *aContext,
params.direction = GetDirection();
params.isVertical = IsVertical();
gfxFloat& inlineCoord = params.isVertical ? aPt.y : aPt.x;
gfxFloat direction = params.direction;
float& inlineCoord = params.isVertical ? aPt.y : aPt.x;
float direction = params.direction;
GlyphRunIterator iter(this, aRange);
while (iter.NextRun()) {

View File

@ -277,7 +277,8 @@ public:
* Glyphs should be drawn in logical content order, which can be significant
* if they overlap (perhaps due to negative spacing).
*/
void Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const;
void Draw(Range aRange, mozilla::gfx::Point aPt,
const DrawParams& aParams) const;
/**
* Draws the emphasis marks for this text run. Uses only GetSpacing
@ -286,7 +287,7 @@ public:
*/
void DrawEmphasisMarks(gfxContext* aContext,
gfxTextRun* aMark,
gfxFloat aMarkAdvance, gfxPoint aPt,
gfxFloat aMarkAdvance, mozilla::gfx::Point aPt,
Range aRange, PropertyProvider* aProvider) const;
/**
@ -756,8 +757,9 @@ private:
PropertyProvider *aProvider) const;
gfxFloat ComputePartialLigatureWidth(Range aPartRange,
PropertyProvider *aProvider) const;
void DrawPartialLigature(gfxFont *aFont, Range aRange,
gfxPoint *aPt, PropertyProvider *aProvider,
void DrawPartialLigature(gfxFont* aFont, Range aRange,
mozilla::gfx::Point* aPt,
PropertyProvider* aProvider,
TextRunDrawParams& aParams,
mozilla::gfx::ShapedTextFlags aOrientation) const;
// Advance aRange.start to the start of the nearest ligature, back
@ -784,8 +786,8 @@ private:
Metrics *aMetrics) const;
// **** drawing helper ****
void DrawGlyphs(gfxFont *aFont, Range aRange, gfxPoint *aPt,
PropertyProvider *aProvider, Range aSpacingRange,
void DrawGlyphs(gfxFont* aFont, Range aRange, mozilla::gfx::Point* aPt,
PropertyProvider* aProvider, Range aSpacingRange,
TextRunDrawParams& aParams,
mozilla::gfx::ShapedTextFlags aOrientation) const;

View File

@ -279,7 +279,7 @@ nsDisplayTextOverflowMarker::PaintTextToContext(gfxContext* aCtx,
if (textRun) {
NS_ASSERTION(!textRun->IsRightToLeft(),
"Ellipsis textruns should always be LTR!");
gfxPoint gfxPt(pt.x, pt.y);
gfx::Point gfxPt(pt.x, pt.y);
textRun->Draw(gfxTextRun::Range(textRun), gfxPt,
gfxTextRun::DrawParams(aCtx));
}

View File

@ -5196,7 +5196,7 @@ nsDisplayText::RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder,
}
}
nsTextFrame::PaintTextParams params(aCtx);
params.framePt = gfxPoint(framePt.x, framePt.y);
params.framePt = gfx::Point(framePt.x, framePt.y);
params.dirtyRect = extraVisible;
if (aBuilder->IsForGenerateGlyphMask()) {
@ -6271,7 +6271,7 @@ nsTextFrame::PaintOneShadow(const PaintShadowParams& aParams,
{
AUTO_PROFILER_LABEL("nsTextFrame::PaintOneShadow", GRAPHICS);
gfxPoint shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset);
gfx::Point shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset);
nscoord blurRadius = std::max(aShadowDetails->mRadius, 0);
nscolor shadowColor = aShadowDetails->mHasColor ? aShadowDetails->mColor
@ -6312,7 +6312,7 @@ nsTextFrame::PaintOneShadow(const PaintShadowParams& aParams,
aBoundingBox + gfxPoint(aParams.framePt.x + aParams.leftSideOffset,
aParams.textBaselinePt.y);
}
shadowGfxRect += shadowOffset;
shadowGfxRect += gfxPoint(shadowOffset.x, shadowOffset.y);
nsRect shadowRect(NSToCoordRound(shadowGfxRect.X()),
NSToCoordRound(shadowGfxRect.Y()),
@ -6497,9 +6497,9 @@ nsTextFrame::PaintTextWithSelectionColors(
rangeStyle, &foreground, &background);
}
gfxPoint textBaselinePt = vertical ?
gfxPoint(aParams.textBaselinePt.x, aParams.framePt.y + iOffset) :
gfxPoint(aParams.framePt.x + iOffset, aParams.textBaselinePt.y);
gfx::Point textBaselinePt = vertical ?
gfx::Point(aParams.textBaselinePt.x, aParams.framePt.y + iOffset) :
gfx::Point(aParams.framePt.x + iOffset, aParams.textBaselinePt.y);
// Determine what shadow, if any, to draw - either from textStyle
// or from the ::-moz-selection pseudo-class if specified there
@ -6667,8 +6667,8 @@ nsTextFrame::PaintTextWithSelection(
void
nsTextFrame::DrawEmphasisMarks(gfxContext* aContext,
WritingMode aWM,
const gfxPoint& aTextBaselinePt,
const gfxPoint& aFramePt, Range aRange,
const gfx::Point& aTextBaselinePt,
const gfx::Point& aFramePt, Range aRange,
const nscolor* aDecorationOverrideColor,
PropertyProvider* aProvider)
{
@ -6681,7 +6681,7 @@ nsTextFrame::DrawEmphasisMarks(gfxContext* aContext,
nscolor color = aDecorationOverrideColor ? *aDecorationOverrideColor :
nsLayoutUtils::GetColor(this, &nsStyleText::mTextEmphasisColor);
aContext->SetColor(Color::FromABGR(color));
gfxPoint pt;
gfx::Point pt;
if (!isTextCombined) {
pt = aTextBaselinePt;
} else {
@ -6987,9 +6987,9 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
const bool reversed = mTextRun->IsInlineReversed();
const bool verticalRun = mTextRun->IsVertical();
WritingMode wm = GetWritingMode();
const gfxFloat frameWidth = GetSize().width;
const gfxFloat frameHeight = GetSize().height;
gfxPoint textBaselinePt;
const float frameWidth = GetSize().width;
const float frameHeight = GetSize().height;
gfx::Point textBaselinePt;
if (verticalRun) {
if (wm.IsVerticalLR()) {
textBaselinePt.x = nsLayoutUtils::GetSnappedBaselineX(
@ -7003,9 +7003,9 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
: aParams.framePt.y;
} else {
textBaselinePt =
gfxPoint(reversed ? aParams.framePt.x + frameWidth : aParams.framePt.x,
nsLayoutUtils::GetSnappedBaselineY(
this, aParams.context, aParams.framePt.y, mAscent));
gfx::Point(reversed ? aParams.framePt.x + frameWidth : aParams.framePt.x,
nsLayoutUtils::GetSnappedBaselineY(
this, aParams.context, aParams.framePt.y, mAscent));
}
Range range = ComputeTransformedRange(provider);
uint32_t startOffset = range.start;
@ -7100,7 +7100,7 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
static void
DrawTextRun(const gfxTextRun* aTextRun,
const gfxPoint& aTextBaselinePt,
const gfx::Point& aTextBaselinePt,
gfxTextRun::Range aRange,
const nsTextFrame::DrawTextRunParams& aParams)
{
@ -7141,7 +7141,7 @@ DrawTextRun(const gfxTextRun* aTextRun,
}
void
nsTextFrame::DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
nsTextFrame::DrawTextRun(Range aRange, const gfx::Point& aTextBaselinePt,
const DrawTextRunParams& aParams)
{
MOZ_ASSERT(aParams.advanceWidth, "Must provide advanceWidth");
@ -7156,14 +7156,14 @@ nsTextFrame::DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
if (hyphenTextRun) {
// For right-to-left text runs, the soft-hyphen is positioned at the left
// of the text, minus its own width
gfxFloat hyphenBaselineX = aTextBaselinePt.x +
float hyphenBaselineX = aTextBaselinePt.x +
mTextRun->GetDirection() * (*aParams.advanceWidth) -
(mTextRun->IsRightToLeft() ? hyphenTextRun->GetAdvanceWidth() : 0);
DrawTextRunParams params = aParams;
params.provider = nullptr;
params.advanceWidth = nullptr;
::DrawTextRun(hyphenTextRun.get(),
gfxPoint(hyphenBaselineX, aTextBaselinePt.y),
gfx::Point(hyphenBaselineX, aTextBaselinePt.y),
Range(hyphenTextRun.get()), params);
}
}
@ -7171,7 +7171,7 @@ nsTextFrame::DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
void
nsTextFrame::DrawTextRunAndDecorations(Range aRange,
const gfxPoint& aTextBaselinePt,
const gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams,
const TextDecorations& aDecorations)
{
@ -7312,7 +7312,7 @@ nsTextFrame::DrawTextRunAndDecorations(Range aRange,
}
void
nsTextFrame::DrawText(Range aRange, const gfxPoint& aTextBaselinePt,
nsTextFrame::DrawText(Range aRange, const gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams)
{
TextDecorations decorations;

View File

@ -441,7 +441,7 @@ public:
struct PaintTextParams
{
gfxContext* context;
gfxPoint framePt;
mozilla::gfx::Point framePt;
LayoutDeviceRect dirtyRect;
mozilla::SVGContextPaint* contextPaint = nullptr;
DrawPathCallbacks* callbacks = nullptr;
@ -468,7 +468,7 @@ public:
struct PaintTextSelectionParams : PaintTextParams
{
gfxPoint textBaselinePt;
mozilla::gfx::Point textBaselinePt;
PropertyProvider* provider = nullptr;
Range contentRange;
nsTextPaintStyle* textPaintStyle = nullptr;
@ -495,7 +495,7 @@ public:
struct DrawTextParams : DrawTextRunParams
{
gfxPoint framePt;
mozilla::gfx::Point framePt;
LayoutDeviceRect dirtyRect;
const nsTextPaintStyle* textStyle = nullptr;
const nsCharClipDisplayItem::ClipEdges* clipEdges = nullptr;
@ -535,8 +535,8 @@ public:
void DrawEmphasisMarks(gfxContext* aContext,
mozilla::WritingMode aWM,
const gfxPoint& aTextBaselinePt,
const gfxPoint& aFramePt,
const mozilla::gfx::Point& aTextBaselinePt,
const mozilla::gfx::Point& aFramePt,
Range aRange,
const nscolor* aDecorationOverrideColor,
PropertyProvider* aProvider);
@ -703,8 +703,8 @@ protected:
{
gfxTextRun::Range range;
LayoutDeviceRect dirtyRect;
gfxPoint framePt;
gfxPoint textBaselinePt;
mozilla::gfx::Point framePt;
mozilla::gfx::Point textBaselinePt;
gfxContext* context;
nscolor foregroundColor = NS_RGBA(0, 0, 0, 0);
const nsCharClipDisplayItem::ClipEdges* clipEdges = nullptr;
@ -801,16 +801,16 @@ protected:
TextDecorations& aDecorations);
void DrawTextRun(Range aRange,
const gfxPoint& aTextBaselinePt,
const mozilla::gfx::Point& aTextBaselinePt,
const DrawTextRunParams& aParams);
void DrawTextRunAndDecorations(Range aRange,
const gfxPoint& aTextBaselinePt,
const mozilla::gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams,
const TextDecorations& aDecorations);
void DrawText(Range aRange,
const gfxPoint& aTextBaselinePt,
const mozilla::gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams);
// Set non empty rect to aRect, it should be overflow rect or frame rect.

View File

@ -2079,7 +2079,8 @@ nsMathMLChar::PaintForeground(nsIFrame* aForFrame,
// draw a single glyph (base size or size variant)
// XXXfredw verify if mGlyphs[0] is non-null to workaround bug 973322.
if (mGlyphs[0]) {
mGlyphs[0]->Draw(Range(mGlyphs[0].get()), gfxPoint(0.0, mUnscaledAscent),
mGlyphs[0]->Draw(Range(mGlyphs[0].get()),
gfx::Point(0.0, mUnscaledAscent),
gfxTextRun::DrawParams(&aRenderingContext));
}
break;
@ -2237,7 +2238,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
}
if (!clipRect.IsEmpty()) {
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfxPoint(dx, dy), params);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfx::Point(dx, dy), params);
}
}
}
@ -2303,7 +2304,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
clipRect.height = std::min(bm.ascent + bm.descent, fillEnd - dy);
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
dy += bm.ascent;
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfxPoint(dx, dy), params);
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfx::Point(dx, dy), params);
dy += bm.descent;
}
}
@ -2407,7 +2408,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
}
if (!clipRect.IsEmpty()) {
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfxPoint(dx, dy), params);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfx::Point(dx, dy), params);
}
}
}
@ -2471,7 +2472,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
clipRect.width = std::min(bm.rightBearing - bm.leftBearing, fillEnd - dx);
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
dx -= bm.leftBearing;
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfxPoint(dx, dy), params);
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfx::Point(dx, dy), params);
dx += bm.rightBearing;
}
}

View File

@ -3691,7 +3691,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
if (drawMode != DrawMode(0)) {
bool paintSVGGlyphs;
nsTextFrame::PaintTextParams params(&aContext);
params.framePt = gfxPoint();
params.framePt = gfx::Point();
params.dirtyRect = LayoutDevicePixel::
FromAppUnits(frame->GetVisualOverflowRect(), auPerDevPx);
params.contextPaint = contextPaint;