Merge "Completely remove skia dependency from libinput."
This commit is contained in:
commit
7556c37b1c
|
@ -28,10 +28,6 @@
|
||||||
#include <utils/RefBase.h>
|
#include <utils/RefBase.h>
|
||||||
#include <utils/String8.h>
|
#include <utils/String8.h>
|
||||||
|
|
||||||
#ifdef HAVE_ANDROID_OS
|
|
||||||
class SkMatrix;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Additional private constants not defined in ndk/ui/input.h.
|
* Additional private constants not defined in ndk/ui/input.h.
|
||||||
*/
|
*/
|
||||||
|
@ -533,23 +529,6 @@ public:
|
||||||
// Matrix is in row-major form and compatible with SkMatrix.
|
// Matrix is in row-major form and compatible with SkMatrix.
|
||||||
void transform(const float matrix[9]);
|
void transform(const float matrix[9]);
|
||||||
|
|
||||||
#ifdef SkMatrix_DEFINED
|
|
||||||
// Helper for interoperating with Skia matrices since Skia isn't part of the PDK.
|
|
||||||
inline void transform(const SkMatrix* matrix) {
|
|
||||||
float m[9];
|
|
||||||
m[0] = SkScalarToFloat(matrix->get(SkMatrix::kMScaleX));
|
|
||||||
m[1] = SkScalarToFloat(matrix->get(SkMatrix::kMSkewX));
|
|
||||||
m[2] = SkScalarToFloat(matrix->get(SkMatrix::kMTransX));
|
|
||||||
m[3] = SkScalarToFloat(matrix->get(SkMatrix::kMSkewY));
|
|
||||||
m[4] = SkScalarToFloat(matrix->get(SkMatrix::kMScaleY));
|
|
||||||
m[5] = SkScalarToFloat(matrix->get(SkMatrix::kMTransY));
|
|
||||||
m[6] = SkScalarToFloat(matrix->get(SkMatrix::kMPersp0));
|
|
||||||
m[7] = SkScalarToFloat(matrix->get(SkMatrix::kMPersp1));
|
|
||||||
m[8] = SkScalarToFloat(matrix->get(SkMatrix::kMPersp2));
|
|
||||||
transform(m);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ANDROID_OS
|
#ifdef HAVE_ANDROID_OS
|
||||||
status_t readFromParcel(Parcel* parcel);
|
status_t readFromParcel(Parcel* parcel);
|
||||||
status_t writeToParcel(Parcel* parcel) const;
|
status_t writeToParcel(Parcel* parcel) const;
|
||||||
|
|
|
@ -14,8 +14,7 @@ shared_libraries := \
|
||||||
libutils \
|
libutils \
|
||||||
libbinder \
|
libbinder \
|
||||||
libui \
|
libui \
|
||||||
libstlport \
|
libstlport
|
||||||
libskia
|
|
||||||
|
|
||||||
static_libraries := \
|
static_libraries := \
|
||||||
libgtest \
|
libgtest \
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <binder/Parcel.h>
|
#include <binder/Parcel.h>
|
||||||
#include <core/SkMatrix.h>
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <input/Input.h>
|
#include <input/Input.h>
|
||||||
|
|
||||||
|
@ -519,6 +518,20 @@ TEST_F(MotionEventTest, Parcel) {
|
||||||
ASSERT_NO_FATAL_FAILURE(assertEqualsEventWithHistory(&outEvent));
|
ASSERT_NO_FATAL_FAILURE(assertEqualsEventWithHistory(&outEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setRotationMatrix(float matrix[9], float angle) {
|
||||||
|
float sin = sinf(angle);
|
||||||
|
float cos = cosf(angle);
|
||||||
|
matrix[0] = cos;
|
||||||
|
matrix[1] = -sin;
|
||||||
|
matrix[2] = 0;
|
||||||
|
matrix[3] = sin;
|
||||||
|
matrix[4] = cos;
|
||||||
|
matrix[5] = 0;
|
||||||
|
matrix[6] = 0;
|
||||||
|
matrix[7] = 0;
|
||||||
|
matrix[8] = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(MotionEventTest, Transform) {
|
TEST_F(MotionEventTest, Transform) {
|
||||||
// Generate some points on a circle.
|
// Generate some points on a circle.
|
||||||
// Each point 'i' is a point on a circle of radius ROTATION centered at (3,2) at an angle
|
// Each point 'i' is a point on a circle of radius ROTATION centered at (3,2) at an angle
|
||||||
|
@ -561,9 +574,9 @@ TEST_F(MotionEventTest, Transform) {
|
||||||
ASSERT_NEAR(originalRawY, event.getRawY(0), 0.001);
|
ASSERT_NEAR(originalRawY, event.getRawY(0), 0.001);
|
||||||
|
|
||||||
// Apply a rotation about the origin by ROTATION degrees clockwise.
|
// Apply a rotation about the origin by ROTATION degrees clockwise.
|
||||||
SkMatrix matrix;
|
float matrix[9];
|
||||||
matrix.setRotate(ROTATION);
|
setRotationMatrix(matrix, ROTATION * PI_180);
|
||||||
event.transform(&matrix);
|
event.transform(matrix);
|
||||||
|
|
||||||
// Check the points.
|
// Check the points.
|
||||||
for (size_t i = 0; i < pointerCount; i++) {
|
for (size_t i = 0; i < pointerCount; i++) {
|
||||||
|
|
Loading…
Reference in New Issue