aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar keyar@chromium.org <keyar@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 20:53:25 +0000
committerGravatar keyar@chromium.org <keyar@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 20:53:25 +0000
commitf4959ab11827bef99e8985031feb457cae1f987a (patch)
tree17fca024b8acab7acd438eecd6e5f080eea67e64 /include
parentac4b86cdcf30c59958edd95f6d2d106350bb7d0f (diff)
Implemented power of two tiling.
Review URL: https://codereview.appspot.com/6485056 git-svn-id: http://skia.googlecode.com/svn/trunk@5274 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkScalar.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
index ed419689d8..4c3bdb277f 100644
--- a/include/core/SkScalar.h
+++ b/include/core/SkScalar.h
@@ -336,6 +336,12 @@ static inline SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t) {
return A + SkScalarMul(B - A, t);
}
+static inline SkScalar SkScalarLog2(SkScalar x) {
+ static const SkScalar log2_conversion_factor = SkScalarDiv(1, SkScalarLog(2));
+
+ return SkScalarMul(SkScalarLog(x), log2_conversion_factor);
+}
+
/** Interpolate along the function described by (keys[length], values[length])
for the passed searchKey. SearchKeys outside the range keys[0]-keys[Length]
clamp to the min or max value. This function was inspired by a desire