Lines Matching refs:SkMatrix
8 #include "include/core/SkMatrix.h"
24 void SkMatrix::doNormalizePerspective() {
30 if (0 == fMat[SkMatrix::kMPersp0] && 0 == fMat[SkMatrix::kMPersp1]) {
31 SkScalar p2 = fMat[SkMatrix::kMPersp2];
37 fMat[SkMatrix::kMPersp2] = 1;
63 SkMatrix& SkMatrix::reset() { *this = SkMatrix(); return *this; }
65 SkMatrix& SkMatrix::set9(const SkScalar buffer[]) {
71 SkMatrix& SkMatrix::setAffine(const SkScalar buffer[]) {
96 uint8_t SkMatrix::computePerspectiveTypeMask() const {
111 uint8_t SkMatrix::computeTypeMask() const {
124 int m00 = SkScalarAs2sCompliment(fMat[SkMatrix::kMScaleX]);
125 int m01 = SkScalarAs2sCompliment(fMat[SkMatrix::kMSkewX]);
126 int m10 = SkScalarAs2sCompliment(fMat[SkMatrix::kMSkewY]);
127 int m11 = SkScalarAs2sCompliment(fMat[SkMatrix::kMScaleY]);
174 bool operator==(const SkMatrix& a, const SkMatrix& b) {
194 bool SkMatrix::isSimilarity(SkScalar tol) const {
223 bool SkMatrix::preservesRightAngles(SkScalar tol) const {
268 SkMatrix& SkMatrix::setTranslate(SkScalar dx, SkScalar dy) {
269 *this = SkMatrix(1, 0, dx,
277 SkMatrix& SkMatrix::preTranslate(SkScalar dx, SkScalar dy) {
284 SkMatrix m;
295 SkMatrix& SkMatrix::postTranslate(SkScalar dx, SkScalar dy) {
297 SkMatrix m;
310 SkMatrix& SkMatrix::setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) {
319 SkMatrix& SkMatrix::setScale(SkScalar sx, SkScalar sy) {
320 *this = SkMatrix(sx, 0, 0,
328 SkMatrix& SkMatrix::preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) {
333 SkMatrix m;
338 SkMatrix& SkMatrix::preScale(SkScalar sx, SkScalar sy) {
369 SkMatrix& SkMatrix::postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) {
373 SkMatrix m;
378 SkMatrix& SkMatrix::postScale(SkScalar sx, SkScalar sy) {
382 SkMatrix m;
389 bool SkMatrix::postIDiv(int divx, int divy) {
411 SkMatrix& SkMatrix::setSinCos(SkScalar sinV, SkScalar cosV, SkScalar px, SkScalar py) {
429 SkMatrix& SkMatrix::setRSXform(const SkRSXform& xform) {
445 SkMatrix& SkMatrix::setSinCos(SkScalar sinV, SkScalar cosV) {
461 SkMatrix& SkMatrix::setRotate(SkScalar degrees, SkScalar px, SkScalar py) {
466 SkMatrix& SkMatrix::setRotate(SkScalar degrees) {
471 SkMatrix& SkMatrix::preRotate(SkScalar degrees, SkScalar px, SkScalar py) {
472 SkMatrix m;
477 SkMatrix& SkMatrix::preRotate(SkScalar degrees) {
478 SkMatrix m;
483 SkMatrix& SkMatrix::postRotate(SkScalar degrees, SkScalar px, SkScalar py) {
484 SkMatrix m;
489 SkMatrix& SkMatrix::postRotate(SkScalar degrees) {
490 SkMatrix m;
497 SkMatrix& SkMatrix::setSkew(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) {
498 *this = SkMatrix(1, sx, -sx * py,
505 SkMatrix& SkMatrix::setSkew(SkScalar sx, SkScalar sy) {
521 SkMatrix& SkMatrix::preSkew(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) {
522 SkMatrix m;
527 SkMatrix& SkMatrix::preSkew(SkScalar sx, SkScalar sy) {
528 SkMatrix m;
533 SkMatrix& SkMatrix::postSkew(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) {
534 SkMatrix m;
539 SkMatrix& SkMatrix::postSkew(SkScalar sx, SkScalar sy) {
540 SkMatrix m;
547 bool SkMatrix::setRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit align) {
609 return 0 == (mask & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask));
612 SkMatrix& SkMatrix::setConcat(const SkMatrix& a, const SkMatrix& b) {
626 SkMatrix tmp;
683 SkMatrix& SkMatrix::preConcat(const SkMatrix& mat) {
692 SkMatrix& SkMatrix::postConcat(const SkMatrix& mat) {
725 return mat[SkMatrix::kMScaleX] *
726 dcross(mat[SkMatrix::kMScaleY], mat[SkMatrix::kMPersp2],
727 mat[SkMatrix::kMTransY], mat[SkMatrix::kMPersp1])
729 mat[SkMatrix::kMSkewX] *
730 dcross(mat[SkMatrix::kMTransY], mat[SkMatrix::kMPersp0],
731 mat[SkMatrix::kMSkewY], mat[SkMatrix::kMPersp2])
733 mat[SkMatrix::kMTransX] *
734 dcross(mat[SkMatrix::kMSkewY], mat[SkMatrix::kMPersp1],
735 mat[SkMatrix::kMScaleY], mat[SkMatrix::kMPersp0]);
737 return dcross(mat[SkMatrix::kMScaleX], mat[SkMatrix::kMScaleY],
738 mat[SkMatrix::kMSkewX], mat[SkMatrix::kMSkewY]);
755 void SkMatrix::SetAffineIdentity(SkScalar affine[6]) {
764 bool SkMatrix::asAffine(SkScalar affine[6]) const {
779 void SkMatrix::mapPoints(SkPoint dst[], const SkPoint src[], int count) const {
786 void SkMatrix::mapXY(SkScalar x, SkScalar y, SkPoint* result) const {
791 void SkMatrix::ComputeInv(SkScalar dst[9], const SkScalar src[9], double invDet, bool isPersp) {
822 bool SkMatrix::invertNonIdentity(SkMatrix* inv) const {
873 SkMatrix* tmp = inv;
875 SkMatrix storage;
896 void SkMatrix::Identity_pts(const SkMatrix& m, SkPoint dst[], const SkPoint src[], int count) {
904 void SkMatrix::Trans_pts(const SkMatrix& m, SkPoint dst[], const SkPoint src[], int count) {
905 SkASSERT(m.getType() <= SkMatrix::kTranslate_Mask);
932 void SkMatrix::Scale_pts(const SkMatrix& m, SkPoint dst[], const SkPoint src[], int count) {
933 SkASSERT(m.getType() <= (SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask));
963 void SkMatrix::Persp_pts(const SkMatrix& m, SkPoint dst[],
991 void SkMatrix::Affine_vpts(const SkMatrix& m, SkPoint dst[], const SkPoint src[], int count) {
992 SkASSERT(m.getType() != SkMatrix::kPerspective_Mask);
1020 const SkMatrix::MapPtsProc SkMatrix::gMapPtsProcs[] = {
1021 SkMatrix::Identity_pts, SkMatrix::Trans_pts,
1022 SkMatrix::Scale_pts, SkMatrix::Scale_pts,
1023 SkMatrix::Affine_vpts, SkMatrix::Affine_vpts,
1024 SkMatrix::Affine_vpts, SkMatrix::Affine_vpts,
1026 SkMatrix::Persp_pts, SkMatrix::Persp_pts,
1027 SkMatrix::Persp_pts, SkMatrix::Persp_pts,
1028 SkMatrix::Persp_pts, SkMatrix::Persp_pts,
1029 SkMatrix::Persp_pts, SkMatrix::Persp_pts
1034 void SkMatrixPriv::MapHomogeneousPointsWithStride(const SkMatrix& mx, SkPoint3 dst[],
1063 typedef SkMatrix M;
1074 void SkMatrix::mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const {
1079 void SkMatrix::mapHomogeneousPoints(SkPoint3 dst[], const SkPoint src[], int count) const {
1105 void SkMatrix::mapVectors(SkPoint dst[], const SkPoint src[], int count) const {
1119 SkMatrix tmp = *this;
1136 void SkMatrix::mapRectScaleTranslate(SkRect* dst, const SkRect& src) const {
1149 bool SkMatrix::mapRect(SkRect* dst, const SkRect& src, SkApplyPerspectiveClip pc) const {
1178 SkScalar SkMatrix::mapRadius(SkScalar radius) const {
1194 void SkMatrix::Persp_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
1208 void SkMatrix::RotTrans_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
1221 void SkMatrix::Rot_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
1236 void SkMatrix::ScaleTrans_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
1245 void SkMatrix::Scale_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
1256 void SkMatrix::Trans_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
1264 void SkMatrix::Identity_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
1272 const SkMatrix::MapXYProc SkMatrix::gMapXYProcs[] = {
1273 SkMatrix::Identity_xy, SkMatrix::Trans_xy,
1274 SkMatrix::Scale_xy, SkMatrix::ScaleTrans_xy,
1275 SkMatrix::Rot_xy, SkMatrix::RotTrans_xy,
1276 SkMatrix::Rot_xy, SkMatrix::RotTrans_xy,
1278 SkMatrix::Persp_xy, SkMatrix::Persp_xy,
1279 SkMatrix::Persp_xy, SkMatrix::Persp_xy,
1280 SkMatrix::Persp_xy, SkMatrix::Persp_xy,
1281 SkMatrix::Persp_xy, SkMatrix::Persp_xy
1289 bool SkMatrix::isFixedStepInX() const {
1293 SkVector SkMatrix::fixedStepInX(SkScalar y) const {
1311 bool SkMatrix::Poly2Proc(const SkPoint srcPt[], SkMatrix* dst) {
1327 bool SkMatrix::Poly3Proc(const SkPoint srcPt[], SkMatrix* dst) {
1343 bool SkMatrix::Poly4Proc(const SkPoint srcPt[], SkMatrix* dst) {
1399 typedef bool (*PolyMapProc)(const SkPoint[], SkMatrix*);
1403 bool SkMatrix::setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count) {
1405 SkDebugf("--- SkMatrix::setPolyToPoly count out of range %d\n", count);
1419 SkMatrix::Poly2Proc, SkMatrix::Poly3Proc, SkMatrix::Poly4Proc
1423 SkMatrix tempMap, result;
1446 template <MinMaxOrBoth MIN_MAX_OR_BOTH> bool get_scale_factor(SkMatrix::TypeMask typeMask,
1449 if (typeMask & SkMatrix::kPerspective_Mask) {
1452 if (SkMatrix::kIdentity_Mask == typeMask) {
1459 if (!(typeMask & SkMatrix::kAffine_Mask)) {
1461 results[0] = std::min(SkScalarAbs(m[SkMatrix::kMScaleX]),
1462 SkScalarAbs(m[SkMatrix::kMScaleY]));
1464 results[0] = std::max(SkScalarAbs(m[SkMatrix::kMScaleX]),
1465 SkScalarAbs(m[SkMatrix::kMScaleY]));
1467 results[0] = SkScalarAbs(m[SkMatrix::kMScaleX]);
1468 results[1] = SkScalarAbs(m[SkMatrix::kMScaleY]);
1479 SkScalar a = sdot(m[SkMatrix::kMScaleX], m[SkMatrix::kMScaleX],
1480 m[SkMatrix::kMSkewY], m[SkMatrix::kMSkewY]);
1481 SkScalar b = sdot(m[SkMatrix::kMScaleX], m[SkMatrix::kMSkewX],
1482 m[SkMatrix::kMScaleY], m[SkMatrix::kMSkewY]);
1483 SkScalar c = sdot(m[SkMatrix::kMSkewX], m[SkMatrix::kMSkewX],
1484 m[SkMatrix::kMScaleY], m[SkMatrix::kMScaleY]);
1540 SkScalar SkMatrix::getMinScale() const {
1549 SkScalar SkMatrix::getMaxScale() const {
1558 bool SkMatrix::getMinMaxScales(SkScalar scaleFactors[2]) const {
1562 const SkMatrix& SkMatrix::I() {
1563 static constexpr SkMatrix identity;
1568 const SkMatrix& SkMatrix::InvalidMatrix() {
1569 static constexpr SkMatrix invalid(SK_ScalarMax, SK_ScalarMax, SK_ScalarMax,
1577 bool SkMatrix::decomposeScale(SkSize* scale, SkMatrix* remaining) const {
1601 size_t SkMatrix::writeToMemory(void* buffer) const {
1610 size_t SkMatrix::readFromMemory(const void* buffer, size_t length) {
1622 void SkMatrix::dump() const {
1630 void SkMatrix::dump(std::string& desc, int depth) const {
1635 desc += split + "\n SkMatrix:{ \n";
1647 bool SkTreatAsSprite(const SkMatrix& mat, const SkISize& size, const SkSamplingOptions& sampling,
1661 if (mat.getType() & ~(SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask)) {
1666 if (!subpixelBits && !(mat.getType() & ~SkMatrix::kTranslate_Mask)) {
1713 bool SkDecomposeUpper2x2(const SkMatrix& matrix,
1718 SkScalar A = matrix[SkMatrix::kMScaleX];
1719 SkScalar B = matrix[SkMatrix::kMSkewX];
1720 SkScalar C = matrix[SkMatrix::kMSkewY];
1721 SkScalar D = matrix[SkMatrix::kMScaleY];
1817 SkMatrix m;
1850 SkScalar SkMatrixPriv::DifferentialAreaScale(const SkMatrix& m, const SkPoint& p) {
1875 SkMatrix jacobian = SkMatrix::MakeAll(xyw.fX, xyw.fY, xyw.fZ,