diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/androidfw/misc.cpp | 4 | ||||
-rw-r--r-- | libs/hwui/Matrix.cpp | 36 | ||||
-rw-r--r-- | libs/hwui/renderthread/RenderThread.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/thread/TaskManager.cpp | 6 |
4 files changed, 37 insertions, 15 deletions
diff --git a/libs/androidfw/misc.cpp b/libs/androidfw/misc.cpp index 29686ef..a9b46d2 100644 --- a/libs/androidfw/misc.cpp +++ b/libs/androidfw/misc.cpp @@ -56,9 +56,11 @@ FileType getFileType(const char* fileName) return kFileTypeBlockDev; else if (S_ISFIFO(sb.st_mode)) return kFileTypeFifo; -#ifdef HAVE_SYMLINKS +#if defined(S_ISLNK) else if (S_ISLNK(sb.st_mode)) return kFileTypeSymlink; +#endif +#if defined(S_ISSOCK) else if (S_ISSOCK(sb.st_mode)) return kFileTypeSocket; #endif diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp index 9f2014f..061d26a 100644 --- a/libs/hwui/Matrix.cpp +++ b/libs/hwui/Matrix.cpp @@ -203,6 +203,34 @@ void Matrix4::copyTo(SkMatrix& v) const { } void Matrix4::loadInverse(const Matrix4& v) { + // Fast case for common translation matrices + if (v.isPureTranslate()) { + // Reset the matrix + // Unnamed fields are never written to except by + // loadIdentity(), they don't need to be reset + data[kScaleX] = 1.0f; + data[kSkewX] = 0.0f; + + data[kScaleY] = 1.0f; + data[kSkewY] = 0.0f; + + data[kScaleZ] = 1.0f; + + data[kPerspective0] = 0.0f; + data[kPerspective1] = 0.0f; + data[kPerspective2] = 1.0f; + + // No need to deal with kTranslateZ because isPureTranslate() + // only returns true when the kTranslateZ component is 0 + data[kTranslateX] = -v.data[kTranslateX]; + data[kTranslateY] = -v.data[kTranslateY]; + data[kTranslateZ] = 0.0f; + + // A "pure translate" matrix can be identity or translation + mType = v.getType(); + return; + } + double scale = 1.0 / (v.data[kScaleX] * ((double) v.data[kScaleY] * v.data[kPerspective2] - (double) v.data[kTranslateY] * v.data[kPerspective1]) + @@ -212,18 +240,18 @@ void Matrix4::loadInverse(const Matrix4& v) { (double) v.data[kScaleY] * v.data[kPerspective0])); data[kScaleX] = (v.data[kScaleY] * v.data[kPerspective2] - - v.data[kTranslateY] * v.data[kPerspective1]) * scale; + v.data[kTranslateY] * v.data[kPerspective1]) * scale; data[kSkewX] = (v.data[kTranslateX] * v.data[kPerspective1] - v.data[kSkewX] * v.data[kPerspective2]) * scale; data[kTranslateX] = (v.data[kSkewX] * v.data[kTranslateY] - - v.data[kTranslateX] * v.data[kScaleY]) * scale; + v.data[kTranslateX] * v.data[kScaleY]) * scale; data[kSkewY] = (v.data[kTranslateY] * v.data[kPerspective0] - v.data[kSkewY] * v.data[kPerspective2]) * scale; data[kScaleY] = (v.data[kScaleX] * v.data[kPerspective2] - - v.data[kTranslateX] * v.data[kPerspective0]) * scale; + v.data[kTranslateX] * v.data[kPerspective0]) * scale; data[kTranslateY] = (v.data[kTranslateX] * v.data[kSkewY] - - v.data[kScaleX] * v.data[kTranslateY]) * scale; + v.data[kScaleX] * v.data[kTranslateY]) * scale; data[kPerspective0] = (v.data[kSkewY] * v.data[kPerspective1] - v.data[kScaleY] * v.data[kPerspective0]) * scale; diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp index 403e164..9dfe75e 100644 --- a/libs/hwui/renderthread/RenderThread.cpp +++ b/libs/hwui/renderthread/RenderThread.cpp @@ -16,10 +16,8 @@ #include "RenderThread.h" -#if defined(HAVE_PTHREADS) -#include <sys/resource.h> -#endif #include <gui/DisplayEventReceiver.h> +#include <sys/resource.h> #include <utils/Log.h> #include "../RenderState.h" @@ -245,9 +243,7 @@ void RenderThread::requestVsync() { } bool RenderThread::threadLoop() { -#if defined(HAVE_PTHREADS) setpriority(PRIO_PROCESS, 0, PRIORITY_DISPLAY); -#endif initThreadLocals(); int timeoutMillis = -1; diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp index d600797..c69b2fd 100644 --- a/libs/hwui/thread/TaskManager.cpp +++ b/libs/hwui/thread/TaskManager.cpp @@ -14,10 +14,8 @@ * limitations under the License. */ -#include <sys/sysinfo.h> -#if defined(HAVE_PTHREADS) #include <sys/resource.h> -#endif +#include <sys/sysinfo.h> #include "TaskManager.h" #include "Task.h" @@ -83,9 +81,7 @@ bool TaskManager::addTaskBase(const sp<TaskBase>& task, const sp<TaskProcessorBa /////////////////////////////////////////////////////////////////////////////// status_t TaskManager::WorkerThread::readyToRun() { -#if defined(HAVE_PTHREADS) setpriority(PRIO_PROCESS, 0, PRIORITY_FOREGROUND); -#endif return NO_ERROR; } |