On Mon, Jun 2, 2014 at 8:32 PM, Robert O'Callahan <rob...@ocallahan.org> wrote:
> On Tue, Jun 3, 2014 at 3:28 PM, Rik Cabanier <caban...@gmail.com> wrote: > >> Yes, isIdentity is used as an indication that nothing needs to be done or >> that the transform hasn't changed. >> Maybe we should rename it to isDefault, isInitial or isNoOp? >> > > I think isIdentity is the right name. > > Glancing through Gecko I see places where we're able to entirely skip > possibly-expensive transformation steps if we have an identity matrix, so I > guess isIdentity is useful to have since even if we make > multiplication-by-identity free, checking isIdentity might mean you can > completely avoid traversing some application data structure. > Yes, that's what I'm seeing in WebKit and Blink as well. For instance: const AffineTransform transform = context->getCTM(); if (m_shadowsIgnoreTransforms && !transform.isIdentity()) { FloatQuad transformedPolygon = transform.mapQuad(FloatQuad(shadowedRect)); transformedPolygon.move(m_offset); layerRect = transform.inverse().mapQuad(transformedPolygon).boundingBox(); } else { layerRect = shadowedRect; layerRect.move(m_offset); } and: if (!currentTransform.isIdentity()) { FloatPoint3D absoluteAnchorPoint(anchorPoint()); absoluteAnchorPoint.scale(size().width(), size().height(), 1); transform.translate3d(absoluteAnchorPoint.x(), absoluteAnchorPoint.y(), absoluteAnchorPoint.z()); transform.multiply(currentTransform); transform.translate3d(-absoluteAnchorPoint.x(), -absoluteAnchorPoint.y(), -absoluteAnchorPoint.z()); } _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform