Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: src/core/SkMatrix.cpp

Issue 1692013002: Change SkMatrix::fixedStepInX to return SkVector rather than SkFixed. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Split fixedStepInX into bool isFixedStepInX and SkVector fixedStepInX. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkMatrix.h ('k') | src/core/SkShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMatrix.cpp
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 7ae4ed21eb4cbd78dcbafaed0694816782f4173b..f60ce85a6cacaa5d9c095d249e0485d515e2531a 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1150,30 +1150,19 @@ const SkMatrix::MapXYProc SkMatrix::gMapXYProcs[] = {
// if its nearly zero (just made up 26, perhaps it should be bigger or smaller)
#define PerspNearlyZero(x) SkScalarNearlyZero(x, (1.0f / (1 << 26)))
-bool SkMatrix::fixedStepInX(SkScalar y, SkFixed* stepX, SkFixed* stepY) const {
- if (PerspNearlyZero(fMat[kMPersp0])) {
- if (stepX || stepY) {
- if (PerspNearlyZero(fMat[kMPersp1]) &&
- PerspNearlyZero(fMat[kMPersp2] - 1)) {
- if (stepX) {
- *stepX = SkScalarToFixed(fMat[kMScaleX]);
- }
- if (stepY) {
- *stepY = SkScalarToFixed(fMat[kMSkewY]);
- }
- } else {
- SkScalar z = y * fMat[kMPersp1] + fMat[kMPersp2];
- if (stepX) {
- *stepX = SkScalarToFixed(fMat[kMScaleX] / z);
- }
- if (stepY) {
- *stepY = SkScalarToFixed(fMat[kMSkewY] / z);
- }
- }
- }
- return true;
+bool SkMatrix::isFixedStepInX() const {
+ return PerspNearlyZero(fMat[kMPersp0]);
+}
+
+SkVector SkMatrix::fixedStepInX(SkScalar y) const {
+ SkASSERT(PerspNearlyZero(fMat[kMPersp0]));
+ if (PerspNearlyZero(fMat[kMPersp1]) &&
+ PerspNearlyZero(fMat[kMPersp2] - 1)) {
+ return SkVector::Make(fMat[kMScaleX], fMat[kMSkewY]);
+ } else {
+ SkScalar z = y * fMat[kMPersp1] + fMat[kMPersp2];
+ return SkVector::Make(fMat[kMScaleX] / z, fMat[kMSkewY] / z);
}
- return false;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1800,4 +1789,3 @@ void SkRSXform::toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const {
quad[3].set(m01 * height + m02, m11 * height + m12);
#endif
}
-
« no previous file with comments | « include/core/SkMatrix.h ('k') | src/core/SkShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698