Пример #1
0
already_AddRefed<SVGMatrix> SVGMatrix::SkewX(float angle, ErrorResult& rv) {
  double ta = tan(angle * radPerDegree);
  if (!IsFinite(ta)) {
    rv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
    return nullptr;
  }

  const gfxMatrix& mx = GetMatrix();
  gfxMatrix skewMx(mx._11, mx._12, (float)(mx._21 + mx._11 * ta),
                   (float)(mx._22 + mx._12 * ta), mx._31, mx._32);
  RefPtr<SVGMatrix> matrix = new SVGMatrix(skewMx);
  return matrix.forget();
}
Пример #2
0
already_AddRefed<SVGMatrix>
SVGMatrix::SkewX(float angle, ErrorResult& rv)
{
  double ta = tan( angle*radPerDegree );
  if (!NS_finite(ta)) {
    rv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
    return nullptr;
  }

  const gfxMatrix& mx = Matrix();
  gfxMatrix skewMx(mx.xx, mx.yx,
                   (float) (mx.xy + mx.xx*ta), (float) (mx.yy + mx.yx*ta),
                   mx.x0, mx.y0);
  nsRefPtr<SVGMatrix> matrix = new SVGMatrix(skewMx);
  return matrix.forget();
}