summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian2017-03-13 14:27:35 -0500
committerMathias Agopian2017-03-13 14:27:35 -0500
commitbcd592053ae60e569e9b24f3f2d69b218c24d174 (patch)
treee34ca21adb51da574c86b117be696e9d2ab5bd58 /libutils/include
parentcc9d94ce04dbb63a745001323213bb667ea2e00f (diff)
downloadplatform-system-core-bcd592053ae60e569e9b24f3f2d69b218c24d174.tar.gz
platform-system-core-bcd592053ae60e569e9b24f3f2d69b218c24d174.tar.xz
platform-system-core-bcd592053ae60e569e9b24f3f2d69b218c24d174.zip
get rid of LinearTransform
it had a single client in frameworks/base Test: compile & run Bug: treble cleanup Change-Id: I9a17bbffed4724f8a329c5a15d621293bb800d45
Diffstat (limited to 'libutils/include')
-rw-r--r--libutils/include/utils/LinearTransform.h64
1 files changed, 0 insertions, 64 deletions
diff --git a/libutils/include/utils/LinearTransform.h b/libutils/include/utils/LinearTransform.h
deleted file mode 100644
index 04cb355c7..000000000
--- a/libutils/include/utils/LinearTransform.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _LIBS_UTILS_LINEAR_TRANSFORM_H
18#define _LIBS_UTILS_LINEAR_TRANSFORM_H
19
20#include <stdint.h>
21
22namespace android {
23
24// LinearTransform defines a structure which hold the definition of a
25// transformation from single dimensional coordinate system A into coordinate
26// system B (and back again). Values in A and in B are 64 bit, the linear
27// scale factor is expressed as a rational number using two 32 bit values.
28//
29// Specifically, let
30// f(a) = b
31// F(b) = f^-1(b) = a
32// then
33//
34// f(a) = (((a - a_zero) * a_to_b_numer) / a_to_b_denom) + b_zero;
35//
36// and
37//
38// F(b) = (((b - b_zero) * a_to_b_denom) / a_to_b_numer) + a_zero;
39//
40struct LinearTransform {
41 int64_t a_zero;
42 int64_t b_zero;
43 int32_t a_to_b_numer;
44 uint32_t a_to_b_denom;
45
46 // Transform from A->B
47 // Returns true on success, or false in the case of a singularity or an
48 // overflow.
49 bool doForwardTransform(int64_t a_in, int64_t* b_out) const;
50
51 // Transform from B->A
52 // Returns true on success, or false in the case of a singularity or an
53 // overflow.
54 bool doReverseTransform(int64_t b_in, int64_t* a_out) const;
55
56 // Helpers which will reduce the fraction N/D using Euclid's method.
57 template <class T> static void reduce(T* N, T* D);
58 static void reduce(int32_t* N, uint32_t* D);
59};
60
61
62}
63
64#endif // _LIBS_UTILS_LINEAR_TRANSFORM_H