diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-03 15:22:40 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-03 15:22:40 +0000 |
commit | ae57358447bac678e3fc458fa2857a349a6a7081 (patch) | |
tree | 3d583ee5f60faa53de876703cef47f7e8d088ed8 /src/core/SkMatrixUtils.h | |
parent | 9c81bd5540119b61756239a540216b108c11b6c5 (diff) |
use SkTreatAsSprite in SkDraw (with guard for chrome if needed)
git-svn-id: http://skia.googlecode.com/svn/trunk@6994 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkMatrixUtils.h')
-rw-r--r-- | src/core/SkMatrixUtils.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/core/SkMatrixUtils.h b/src/core/SkMatrixUtils.h index 04c0892776..2074267b7d 100644 --- a/src/core/SkMatrixUtils.h +++ b/src/core/SkMatrixUtils.h @@ -17,16 +17,27 @@ #define kSkSubPixelBitsForBilerp 4 /** - * Given a matrix and a src-rect, return true if the computed dst-rect would + * Given a matrix and width/height, return true if the computed dst-rect would * align such that there is a 1-to-1 coorspondence between src and dst pixels. * This can be called by drawing code to see if drawBitmap can be turned into * drawSprite (which is faster). * + * The src-rect is defined to be { 0, 0, width, height } + * * The "closeness" test is based on the subpixelBits parameter. Pass 0 for * round-to-nearest behavior (e.g. nearest neighbor sampling). Pass the number * of subpixel-bits to simulate filtering. */ -bool SkTreatAsSprite(const SkMatrix&, const SkRect& src, unsigned subpixelBits); +bool SkTreatAsSprite(const SkMatrix&, int width, int height, + unsigned subpixelBits); +/** + * Calls SkTreatAsSprite() with default subpixelBits value to match Skia's + * filter-bitmap implementation (i.e. kSkSubPixelBitsForBilerp). + */ +static inline bool SkTreatAsSpriteFilter(const SkMatrix& matrix, + int width, int height) { + return SkTreatAsSprite(matrix, width, height, kSkSubPixelBitsForBilerp); +} #endif |