Skip to content

Commit

Permalink
Bug 1933668 - Undo half-pixel shift from WGR when using AA-Stroke. r=…
Browse files Browse the repository at this point in the history
…aosmond, a=dmeehan

Differential Revision: https://phabricator.services.mozilla.com/D231471
  • Loading branch information
lsalzman committed Dec 7, 2024
1 parent f990082 commit 843778e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 6 additions & 1 deletion dom/canvas/DrawTargetWebgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3096,7 +3096,12 @@ static inline AAStroke::LineCap ToAAStrokeLineCap(CapStyle aCap) {
}

static inline Point WGRPointToPoint(const WGR::Point& aPoint) {
return Point(IntPoint(aPoint.x, aPoint.y)) * (1.0f / 16.0f);
// WGR points are 28.4 fixed-point where (0.0, 0.0) is assumed to be a pixel
// center, as opposed to (0.5, 0.5) in canvas device space. WGR thus shifts
// each point by (-0.5, -0.5). To undo this, transform from fixed-point back
// to floating-point, and reverse the pixel shift by adding back (0.5, 0.5).
return Point(IntPoint(aPoint.x, aPoint.y)) * (1.0f / 16.0f) +
Point(0.5f, 0.5f);
}

// Generates a vertex buffer for a stroked path using aa-stroke.
Expand Down

This file was deleted.

0 comments on commit 843778e

Please sign in to comment.