OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 #ifndef SkMatrixUtils_DEFINED | 8 #ifndef SkMatrixUtils_DEFINED |
9 #define SkMatrixUtils_DEFINED | 9 #define SkMatrixUtils_DEFINED |
10 | 10 |
11 #include "SkMatrix.h" | 11 #include "SkMatrix.h" |
12 | 12 |
13 /** | 13 /** |
14 * Number of subpixel bits used in skia's bilerp. | 14 * Number of subpixel bits used in skia's bilerp. |
15 * See SkBitmapProcState_procs.h and SkBitmapProcState_filter.h | 15 * See SkBitmapProcState_procs.h and SkBitmapProcState_filter.h |
16 */ | 16 */ |
17 #define kSkSubPixelBitsForBilerp 4 | 17 #define kSkSubPixelBitsForBilerp 4 |
18 | 18 |
| 19 bool SkRectIsOnGrid(int width, int height, const SkRect& r, unsigned subpixelBit
s); |
| 20 |
19 /** | 21 /** |
20 * Given a matrix and width/height, return true if the computed dst-rect would | 22 * Given a matrix and width/height, return true if the computed dst-rect would |
21 * align such that there is a 1-to-1 coorspondence between src and dst pixels. | 23 * align such that there is a 1-to-1 coorspondence between src and dst pixels. |
22 * This can be called by drawing code to see if drawBitmap can be turned into | 24 * This can be called by drawing code to see if drawBitmap can be turned into |
23 * drawSprite (which is faster). | 25 * drawSprite (which is faster). |
24 * | 26 * |
25 * The src-rect is defined to be { 0, 0, width, height } | 27 * The src-rect is defined to be { 0, 0, width, height } |
26 * | 28 * |
27 * The "closeness" test is based on the subpixelBits parameter. Pass 0 for | 29 * The "closeness" test is based on the subpixelBits parameter. Pass 0 for |
28 * round-to-nearest behavior (e.g. nearest neighbor sampling). Pass the number | 30 * round-to-nearest behavior (e.g. nearest neighbor sampling). Pass the number |
(...skipping 16 matching lines...) Expand all Loading... |
45 followed by another rotation. If there is a reflection, one of the scale | 47 followed by another rotation. If there is a reflection, one of the scale |
46 factors will be negative. | 48 factors will be negative. |
47 Returns true if successful. Returns false if the matrix is degenerate. | 49 Returns true if successful. Returns false if the matrix is degenerate. |
48 */ | 50 */ |
49 bool SkDecomposeUpper2x2(const SkMatrix& matrix, | 51 bool SkDecomposeUpper2x2(const SkMatrix& matrix, |
50 SkPoint* rotation1, | 52 SkPoint* rotation1, |
51 SkPoint* scale, | 53 SkPoint* scale, |
52 SkPoint* rotation2); | 54 SkPoint* rotation2); |
53 | 55 |
54 #endif | 56 #endif |
OLD | NEW |