Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2006 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #ifndef SkPerspIter_DEFINED |
michael@0 | 11 | #define SkPerspIter_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkMatrix.h" |
michael@0 | 14 | |
michael@0 | 15 | class SkPerspIter { |
michael@0 | 16 | public: |
michael@0 | 17 | /** Iterate a line through the matrix [x,y] ... [x+count-1, y]. |
michael@0 | 18 | @param m The matrix we will be iterating a line through |
michael@0 | 19 | @param x The initial X coordinate to be mapped through the matrix |
michael@0 | 20 | @param y The initial Y coordinate to be mapped through the matrix |
michael@0 | 21 | @param count The number of points (x,y) (x+1,y) (x+2,y) ... we will eventually map |
michael@0 | 22 | */ |
michael@0 | 23 | SkPerspIter(const SkMatrix& m, SkScalar x, SkScalar y, int count); |
michael@0 | 24 | |
michael@0 | 25 | /** Return the buffer of [x,y] fixed point values we will be filling. |
michael@0 | 26 | This always returns the same value, so it can be saved across calls to |
michael@0 | 27 | next(). |
michael@0 | 28 | */ |
michael@0 | 29 | const SkFixed* getXY() const { return fStorage; } |
michael@0 | 30 | |
michael@0 | 31 | /** Return the number of [x,y] pairs that have been filled in the getXY() buffer. |
michael@0 | 32 | When this returns 0, the iterator is finished. |
michael@0 | 33 | */ |
michael@0 | 34 | int next(); |
michael@0 | 35 | |
michael@0 | 36 | private: |
michael@0 | 37 | enum { |
michael@0 | 38 | kShift = 4, |
michael@0 | 39 | kCount = (1 << kShift) |
michael@0 | 40 | }; |
michael@0 | 41 | const SkMatrix& fMatrix; |
michael@0 | 42 | SkFixed fStorage[kCount * 2]; |
michael@0 | 43 | SkFixed fX, fY; |
michael@0 | 44 | SkScalar fSX, fSY; |
michael@0 | 45 | int fCount; |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | #endif |