[Webkit-unassigned] [Bug 26425] Small Refactoring to Consolidate Common GDI Calls

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 17 17:35:28 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=26425


aroben at apple.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #31467|review?                     |review+
               Flag|                            |




------- Comment #19 from aroben at apple.com  2009-06-17 17:35 PDT -------
(From update of attachment 31467)
>          // 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


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list