[webkit-reviews] review granted: [Bug 26425] Small Refactoring to Consolidate Common GDI Calls : [Attachment 31467] Part 2: (Refactor XFORM)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jun 17 17:35:28 PDT 2009
Adam Roben (aroben) <aroben at apple.com> has granted Brent Fulgham
<bfulgham at webkit.org>'s request for review:
Bug 26425: Small Refactoring to Consolidate Common GDI Calls
https://bugs.webkit.org/show_bug.cgi?id=26425
Attachment 31467: Part 2: (Refactor XFORM)
https://bugs.webkit.org/attachment.cgi?id=31467&action=review
------- Additional Comments from Adam Roben (aroben) <aroben at apple.com>
> // Apply a translation to our context so that the drawing done will
be at (0,0) of the bitmap.
> - XFORM xform;
> - xform.eM11 = 1.0f;
> - xform.eM12 = 0.0f;
> - xform.eM21 = 0.0f;
> - xform.eM22 = 1.0f;
> - xform.eDx = -dstRect.x();
> - xform.eDy = -dstRect.y();
> + TransformationMatrix translate(1.0f, 0.0f, 0.0f, 1.0f, -dstRect.x(),
-dstRect.y());
> + XFORM xform = translate;
Maybe this would be better as:
XFORM xform = TransformationMatrix().translate(-dstRect.x(), -dstRect.y());
> - XFORM xform;
> - xform.eM11 = size.width();
> - xform.eM12 = 0.0f;
> - xform.eM21 = 0.0f;
> - xform.eM22 = size.height();
> - xform.eDx = 0.0f;
> - xform.eDy = 0.0f;
> +
> + TransformationMatrix scale(size.width(), 0.0f, 0.0f, size.height(),
0.0f, 0.0f);
> +
> + XFORM xform = scale;
Maybe this would be better as:
XFORM xform = TransformationMatrix().scale(size.width(), size.height());
> - XFORM xform;
> - xform.eM11 = cosAngle;
> - xform.eM12 = -sinAngle;
> - xform.eM21 = sinAngle;
> - xform.eM22 = cosAngle;
> - xform.eDx = 0.0f;
> - xform.eDy = 0.0f;
> +
> + TransformationMatrix rotate(cosAngle, -sinAngle, sinAngle, cosAngle,
0.0f, 0.0f);
> +
> + XFORM xform = rotate;
You could probably use TransformationMatrix::rotate() here, but I don't know
the exactly incantation (probably just
TransformationMatrix().rotate(degreesAngle)).
...and so on for the other cases.
r=me
More information about the webkit-reviews
mailing list