OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
9 #include "Sk64.h" | 9 #include "Sk64.h" |
10 #include "SkFloatBits.h" | 10 #include "SkFloatBits.h" |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 SK_ScalarMax, SK_ScalarMax, SK_ScalarMax, | 1914 SK_ScalarMax, SK_ScalarMax, SK_ScalarMax, |
1915 SK_ScalarMax, SK_ScalarMax, SK_ScalarMax); | 1915 SK_ScalarMax, SK_ScalarMax, SK_ScalarMax); |
1916 gInvalid.getType(); // force the type to be computed | 1916 gInvalid.getType(); // force the type to be computed |
1917 gOnce = true; | 1917 gOnce = true; |
1918 } | 1918 } |
1919 return gInvalid; | 1919 return gInvalid; |
1920 } | 1920 } |
1921 | 1921 |
1922 /////////////////////////////////////////////////////////////////////////////// | 1922 /////////////////////////////////////////////////////////////////////////////// |
1923 | 1923 |
1924 uint32_t SkMatrix::writeToMemory(void* buffer) const { | |
1925 // TODO write less for simple matrices | |
1926 if (buffer) { | |
1927 memcpy(buffer, fMat, 9 * sizeof(SkScalar)); | |
1928 } | |
1929 return 9 * sizeof(SkScalar); | |
1930 } | |
1931 | |
1932 uint32_t SkMatrix::readFromMemory(const void* buffer) { | |
1933 if (buffer) { | |
1934 memcpy(fMat, buffer, 9 * sizeof(SkScalar)); | |
1935 this->setTypeMask(kUnknown_Mask); | |
1936 } | |
1937 return 9 * sizeof(SkScalar); | |
1938 } | |
1939 | |
1940 #ifdef SK_DEVELOPER | 1924 #ifdef SK_DEVELOPER |
1941 void SkMatrix::dump() const { | 1925 void SkMatrix::dump() const { |
1942 SkString str; | 1926 SkString str; |
1943 this->toString(&str); | 1927 this->toString(&str); |
1944 SkDebugf("%s\n", str.c_str()); | 1928 SkDebugf("%s\n", str.c_str()); |
1945 } | 1929 } |
1946 | 1930 |
1947 void SkMatrix::toString(SkString* str) const { | 1931 void SkMatrix::toString(SkString* str) const { |
1948 str->appendf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]", | 1932 str->appendf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]", |
1949 #ifdef SK_SCALAR_IS_FLOAT | 1933 #ifdef SK_SCALAR_IS_FLOAT |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 rotation1->fX = cos1; | 2087 rotation1->fX = cos1; |
2104 rotation1->fY = sin1; | 2088 rotation1->fY = sin1; |
2105 } | 2089 } |
2106 if (NULL != rotation2) { | 2090 if (NULL != rotation2) { |
2107 rotation2->fX = cos2; | 2091 rotation2->fX = cos2; |
2108 rotation2->fY = sin2; | 2092 rotation2->fY = sin2; |
2109 } | 2093 } |
2110 | 2094 |
2111 return true; | 2095 return true; |
2112 } | 2096 } |
OLD | NEW |