blob: 04c0892776b8ea9dff04f59ae1626e9e312cab71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkMatrixUtils_DEFINED
#define SkMatrixUtils_DEFINED
#include "SkMatrix.h"
/**
* Number of subpixel bits used in skia's bilerp.
* See SkBitmapProcState_procs.h and SkBitmapProcState_filter.h
*/
#define kSkSubPixelBitsForBilerp 4
/**
* Given a matrix and a src-rect, 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 "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);
#endif
|