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

Side by Side Diff: src/core/SkMatrixUtils.h

Issue 1569873003: Revert of SkTreatAsSprite should take AA into account (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/core/SkMatrix.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkSize.h" 11 #include "SkMatrix.h"
12
13 class SkMatrix;
14 class SkPaint;
15 12
16 /** 13 /**
17 * Given a matrix, size and paint, return true if the computed dst-rect would 14 * Number of subpixel bits used in skia's bilerp.
15 * See SkBitmapProcState_procs.h and SkBitmapProcState_filter.h
16 */
17 #define kSkSubPixelBitsForBilerp 4
18
19 /**
20 * Given a matrix and width/height, return true if the computed dst-rect would
18 * align such that there is a 1-to-1 coorspondence between src and dst pixels. 21 * align such that there is a 1-to-1 coorspondence between src and dst pixels.
19 * This can be called by drawing code to see if drawBitmap can be turned into 22 * This can be called by drawing code to see if drawBitmap can be turned into
20 * drawSprite (which is faster). 23 * drawSprite (which is faster).
21 * 24 *
22 * The src-rect is defined to be { 0, 0, size.width(), size.height() } 25 * The src-rect is defined to be { 0, 0, width, height }
26 *
27 * 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
29 * of subpixel-bits to simulate filtering.
23 */ 30 */
24 bool SkTreatAsSprite(const SkMatrix&, const SkISize& size, const SkPaint& paint) ; 31 bool SkTreatAsSprite(const SkMatrix&, int width, int height,
32 unsigned subpixelBits);
33
34 /**
35 * Calls SkTreatAsSprite() with default subpixelBits value to match Skia's
36 * filter-bitmap implementation (i.e. kSkSubPixelBitsForBilerp).
37 */
38 static inline bool SkTreatAsSpriteFilter(const SkMatrix& matrix,
39 int width, int height) {
40 return SkTreatAsSprite(matrix, width, height, kSkSubPixelBitsForBilerp);
41 }
25 42
26 /** Decomposes the upper-left 2x2 of the matrix into a rotation (represented by 43 /** Decomposes the upper-left 2x2 of the matrix into a rotation (represented by
27 the cosine and sine of the rotation angle), followed by a non-uniform scale, 44 the cosine and sine of the rotation angle), followed by a non-uniform scale,
28 followed by another rotation. If there is a reflection, one of the scale 45 followed by another rotation. If there is a reflection, one of the scale
29 factors will be negative. 46 factors will be negative.
30 Returns true if successful. Returns false if the matrix is degenerate. 47 Returns true if successful. Returns false if the matrix is degenerate.
31 */ 48 */
32 bool SkDecomposeUpper2x2(const SkMatrix& matrix, 49 bool SkDecomposeUpper2x2(const SkMatrix& matrix,
33 SkPoint* rotation1, 50 SkPoint* rotation1,
34 SkPoint* scale, 51 SkPoint* scale,
35 SkPoint* rotation2); 52 SkPoint* rotation2);
36 53
37 #endif 54 #endif
OLDNEW
« no previous file with comments | « src/core/SkMatrix.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698