Loading libs/ui/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ cc_library_shared { "PixelFormat.cpp", "Rect.cpp", "Region.cpp", "Transform.cpp", "UiConfig.cpp", ], Loading services/surfaceflinger/Transform.cpp→libs/ui/Transform.cpp +38 −53 Original line number Diff line number Diff line Loading @@ -17,17 +17,12 @@ #include <math.h> #include <cutils/compiler.h> #include <utils/String8.h> #include <ui/Region.h> #include "Transform.h" #include "clz.h" // --------------------------------------------------------------------------- #include <ui/Transform.h> #include <utils/String8.h> namespace android { // --------------------------------------------------------------------------- namespace ui { Transform::Transform() { reset(); Loading @@ -41,8 +36,7 @@ Transform::Transform(uint32_t orientation) { set(orientation, 0, 0); } Transform::~Transform() { } Transform::~Transform() = default; static const float EPSILON = 0.0f; Loading @@ -67,7 +61,7 @@ Transform Transform::operator * (const Transform& rhs) const const mat33& A(mMatrix); const mat33& B(rhs.mMatrix); mat33& D(r.mMatrix); for (int i=0 ; i<3 ; i++) { for (size_t i = 0; i < 3; i++) { const float v0 = A[0][i]; const float v1 = A[1][i]; const float v2 = A[2][i]; Loading @@ -83,6 +77,12 @@ Transform Transform::operator * (const Transform& rhs) const return r; } Transform& Transform::operator=(const Transform& other) { mMatrix = other.mMatrix; mType = other.mType; return *this; } const vec3& Transform::operator [] (size_t i) const { return mMatrix[i]; } Loading @@ -97,9 +97,9 @@ float Transform::ty() const { void Transform::reset() { mType = IDENTITY; for(int i=0 ; i<3 ; i++) { for(size_t i = 0; i < 3; i++) { vec3& v(mMatrix[i]); for (int j=0 ; j<3 ; j++) for (size_t j = 0; j < 3; j++) v[j] = ((i == j) ? 1.0f : 0.0f); } } Loading Loading @@ -137,7 +137,7 @@ status_t Transform::set(uint32_t flags, float w, float h) Transform H, V, R; if (flags & ROT_90) { // w & h are inverted when rotating by 90 degrees swap(w, h); std::swap(w, h); } if (flags & FLIP_H) { Loading Loading @@ -210,15 +210,15 @@ Rect Transform::transform(const Rect& bounds, bool roundOutwards) const rb = transform(rb); if (roundOutwards) { r.left = floorf(min(lt[0], rt[0], lb[0], rb[0])); r.top = floorf(min(lt[1], rt[1], lb[1], rb[1])); r.right = ceilf(max(lt[0], rt[0], lb[0], rb[0])); r.bottom = ceilf(max(lt[1], rt[1], lb[1], rb[1])); r.left = static_cast<int32_t>(floorf(std::min({lt[0], rt[0], lb[0], rb[0]}))); r.top = static_cast<int32_t>(floorf(std::min({lt[1], rt[1], lb[1], rb[1]}))); r.right = static_cast<int32_t>(ceilf(std::max({lt[0], rt[0], lb[0], rb[0]}))); r.bottom = static_cast<int32_t>(ceilf(std::max({lt[1], rt[1], lb[1], rb[1]}))); } else { r.left = floorf(min(lt[0], rt[0], lb[0], rb[0]) + 0.5f); r.top = floorf(min(lt[1], rt[1], lb[1], rb[1]) + 0.5f); r.right = floorf(max(lt[0], rt[0], lb[0], rb[0]) + 0.5f); r.bottom = floorf(max(lt[1], rt[1], lb[1], rb[1]) + 0.5f); r.left = static_cast<int32_t>(floorf(std::min({lt[0], rt[0], lb[0], rb[0]}) + 0.5f)); r.top = static_cast<int32_t>(floorf(std::min({lt[1], rt[1], lb[1], rb[1]}) + 0.5f)); r.right = static_cast<int32_t>(floorf(std::max({lt[0], rt[0], lb[0], rb[0]}) + 0.5f)); r.bottom = static_cast<int32_t>(floorf(std::max({lt[1], rt[1], lb[1], rb[1]}) + 0.5f)); } return r; Loading @@ -237,10 +237,10 @@ FloatRect Transform::transform(const FloatRect& bounds) const rb = transform(rb); FloatRect r; r.left = min(lt[0], rt[0], lb[0], rb[0]); r.top = min(lt[1], rt[1], lb[1], rb[1]); r.right = max(lt[0], rt[0], lb[0], rb[0]); r.bottom = max(lt[1], rt[1], lb[1], rb[1]); r.left = std::min({lt[0], rt[0], lb[0], rb[0]}); r.top = std::min({lt[1], rt[1], lb[1], rb[1]}); r.right = std::max({lt[0], rt[0], lb[0], rb[0]}); r.bottom = std::max({lt[1], rt[1], lb[1], rb[1]}); return r; } Loading @@ -259,8 +259,8 @@ Region Transform::transform(const Region& reg) const out.set(transform(reg.bounds())); } } else { int xpos = floorf(tx() + 0.5f); int ypos = floorf(ty() + 0.5f); int xpos = static_cast<int>(floorf(tx() + 0.5f)); int ypos = static_cast<int>(floorf(ty() + 0.5f)); out = reg.translate(xpos, ypos); } return out; Loading Loading @@ -343,7 +343,7 @@ Transform Transform::inverse() const { const float x = M[2][0]; const float y = M[2][1]; const float idet = 1.0 / (a*d - b*c); const float idet = 1.0f / (a*d - b*c); result.mMatrix[0][0] = d*idet; result.mMatrix[0][1] = -c*idet; result.mMatrix[1][0] = -b*idet; Loading Loading @@ -404,28 +404,13 @@ void Transform::dump(const char* name) const type.append("TRANSLATE "); ALOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string()); ALOGD("%.4f %.4f %.4f", m[0][0], m[1][0], m[2][0]); ALOGD("%.4f %.4f %.4f", m[0][1], m[1][1], m[2][1]); ALOGD("%.4f %.4f %.4f", m[0][2], m[1][2], m[2][2]); } Transform::orientation_flags Transform::fromRotation(ISurfaceComposer::Rotation rotation) { // Convert to surfaceflinger's internal rotation type. switch (rotation) { case ISurfaceComposer::eRotateNone: return Transform::ROT_0; case ISurfaceComposer::eRotate90: return Transform::ROT_90; case ISurfaceComposer::eRotate180: return Transform::ROT_180; case ISurfaceComposer::eRotate270: return Transform::ROT_270; default: ALOGE("Invalid rotation passed to captureScreen(): %d\n", rotation); return Transform::ROT_0; } ALOGD("%.4f %.4f %.4f", static_cast<double>(m[0][0]), static_cast<double>(m[1][0]), static_cast<double>(m[2][0])); ALOGD("%.4f %.4f %.4f", static_cast<double>(m[0][1]), static_cast<double>(m[1][1]), static_cast<double>(m[2][1])); ALOGD("%.4f %.4f %.4f", static_cast<double>(m[0][2]), static_cast<double>(m[1][2]), static_cast<double>(m[2][2])); } // --------------------------------------------------------------------------- }; // namespace android } // namespace ui } // namespace android services/surfaceflinger/Transform.h→libs/ui/include/ui/Transform.h +113 −0 Original line number Diff line number Diff line Loading @@ -20,23 +20,19 @@ #include <stdint.h> #include <sys/types.h> #include <ui/Point.h> #include <ui/Rect.h> #include <hardware/hardware.h> #include <math/vec2.h> #include <math/vec3.h> #include <gui/ISurfaceComposer.h> #include <hardware/hardware.h> #include <ui/Point.h> #include <ui/Rect.h> namespace android { class Region; // --------------------------------------------------------------------------- namespace ui { class Transform { class Transform { public: Transform(); Transform(const Transform& other); Loading @@ -53,9 +49,7 @@ public: ROT_INVALID = 0x80 }; static orientation_flags fromRotation(ISurfaceComposer::Rotation rotation); enum type_mask { enum type_mask : uint32_t { IDENTITY = 0, TRANSLATE = 0x1, ROTATE = 0x2, Loading Loading @@ -85,6 +79,7 @@ public: Rect transform(const Rect& bounds, bool roundOutwards = false) const; FloatRect transform(const FloatRect& bounds) const; Transform& operator = (const Transform& other); Transform operator * (const Transform& rhs) const; // assumes the last row is < 0 , 0 , 1 > vec2 transform(const vec2& v) const; Loading @@ -98,8 +93,8 @@ public: private: struct mat33 { vec3 v[3]; inline const vec3& operator [] (int i) const { return v[i]; } inline vec3& operator [] (int i) { return v[i]; } inline const vec3& operator [] (size_t i) const { return v[i]; } inline vec3& operator [] (size_t i) { return v[i]; } }; enum { UNKNOWN_TYPE = 0x80000000 }; Loading @@ -112,7 +107,7 @@ private: mutable uint32_t mType; }; // --------------------------------------------------------------------------- }; // namespace android } // namespace ui } // namespace android #endif /* ANDROID_TRANSFORM_H */ libs/vr/CleanSpec.mk 0 → 100644 +52 −0 Original line number Diff line number Diff line # Copyright (C) 2012 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # If you don't need to do a full clean build but would like to touch # a file or delete some intermediate files, add a clean step to the end # of the list. These steps will only be run once, if they haven't been # run before. # # E.g.: # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) # # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with # files that are missing or have been moved. # # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. # Use $(OUT_DIR) to refer to the "out" directory. # # If you need to re-do something that's already mentioned, just copy # the command and add it to the bottom of the list. E.g., if a change # that you made last week required touching a file and a change you # made today requires touching the same file, just copy the old # touch step and add it to the end of the list. # # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ # For example: #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ $(call add-clean-step, find $(PRODUCT_OUT) -type f -name "libdvr.so" -print0 | xargs -0 rm -f) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdvr_intermediates) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdvr_intermediates) libs/vr/libbufferhubqueue/benchmarks/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ cc_benchmark { "libbase", "libbinder", "libcutils", "libdvr", "libdvr.google", "libgui", "liblog", "libhardware", Loading Loading
libs/ui/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ cc_library_shared { "PixelFormat.cpp", "Rect.cpp", "Region.cpp", "Transform.cpp", "UiConfig.cpp", ], Loading
services/surfaceflinger/Transform.cpp→libs/ui/Transform.cpp +38 −53 Original line number Diff line number Diff line Loading @@ -17,17 +17,12 @@ #include <math.h> #include <cutils/compiler.h> #include <utils/String8.h> #include <ui/Region.h> #include "Transform.h" #include "clz.h" // --------------------------------------------------------------------------- #include <ui/Transform.h> #include <utils/String8.h> namespace android { // --------------------------------------------------------------------------- namespace ui { Transform::Transform() { reset(); Loading @@ -41,8 +36,7 @@ Transform::Transform(uint32_t orientation) { set(orientation, 0, 0); } Transform::~Transform() { } Transform::~Transform() = default; static const float EPSILON = 0.0f; Loading @@ -67,7 +61,7 @@ Transform Transform::operator * (const Transform& rhs) const const mat33& A(mMatrix); const mat33& B(rhs.mMatrix); mat33& D(r.mMatrix); for (int i=0 ; i<3 ; i++) { for (size_t i = 0; i < 3; i++) { const float v0 = A[0][i]; const float v1 = A[1][i]; const float v2 = A[2][i]; Loading @@ -83,6 +77,12 @@ Transform Transform::operator * (const Transform& rhs) const return r; } Transform& Transform::operator=(const Transform& other) { mMatrix = other.mMatrix; mType = other.mType; return *this; } const vec3& Transform::operator [] (size_t i) const { return mMatrix[i]; } Loading @@ -97,9 +97,9 @@ float Transform::ty() const { void Transform::reset() { mType = IDENTITY; for(int i=0 ; i<3 ; i++) { for(size_t i = 0; i < 3; i++) { vec3& v(mMatrix[i]); for (int j=0 ; j<3 ; j++) for (size_t j = 0; j < 3; j++) v[j] = ((i == j) ? 1.0f : 0.0f); } } Loading Loading @@ -137,7 +137,7 @@ status_t Transform::set(uint32_t flags, float w, float h) Transform H, V, R; if (flags & ROT_90) { // w & h are inverted when rotating by 90 degrees swap(w, h); std::swap(w, h); } if (flags & FLIP_H) { Loading Loading @@ -210,15 +210,15 @@ Rect Transform::transform(const Rect& bounds, bool roundOutwards) const rb = transform(rb); if (roundOutwards) { r.left = floorf(min(lt[0], rt[0], lb[0], rb[0])); r.top = floorf(min(lt[1], rt[1], lb[1], rb[1])); r.right = ceilf(max(lt[0], rt[0], lb[0], rb[0])); r.bottom = ceilf(max(lt[1], rt[1], lb[1], rb[1])); r.left = static_cast<int32_t>(floorf(std::min({lt[0], rt[0], lb[0], rb[0]}))); r.top = static_cast<int32_t>(floorf(std::min({lt[1], rt[1], lb[1], rb[1]}))); r.right = static_cast<int32_t>(ceilf(std::max({lt[0], rt[0], lb[0], rb[0]}))); r.bottom = static_cast<int32_t>(ceilf(std::max({lt[1], rt[1], lb[1], rb[1]}))); } else { r.left = floorf(min(lt[0], rt[0], lb[0], rb[0]) + 0.5f); r.top = floorf(min(lt[1], rt[1], lb[1], rb[1]) + 0.5f); r.right = floorf(max(lt[0], rt[0], lb[0], rb[0]) + 0.5f); r.bottom = floorf(max(lt[1], rt[1], lb[1], rb[1]) + 0.5f); r.left = static_cast<int32_t>(floorf(std::min({lt[0], rt[0], lb[0], rb[0]}) + 0.5f)); r.top = static_cast<int32_t>(floorf(std::min({lt[1], rt[1], lb[1], rb[1]}) + 0.5f)); r.right = static_cast<int32_t>(floorf(std::max({lt[0], rt[0], lb[0], rb[0]}) + 0.5f)); r.bottom = static_cast<int32_t>(floorf(std::max({lt[1], rt[1], lb[1], rb[1]}) + 0.5f)); } return r; Loading @@ -237,10 +237,10 @@ FloatRect Transform::transform(const FloatRect& bounds) const rb = transform(rb); FloatRect r; r.left = min(lt[0], rt[0], lb[0], rb[0]); r.top = min(lt[1], rt[1], lb[1], rb[1]); r.right = max(lt[0], rt[0], lb[0], rb[0]); r.bottom = max(lt[1], rt[1], lb[1], rb[1]); r.left = std::min({lt[0], rt[0], lb[0], rb[0]}); r.top = std::min({lt[1], rt[1], lb[1], rb[1]}); r.right = std::max({lt[0], rt[0], lb[0], rb[0]}); r.bottom = std::max({lt[1], rt[1], lb[1], rb[1]}); return r; } Loading @@ -259,8 +259,8 @@ Region Transform::transform(const Region& reg) const out.set(transform(reg.bounds())); } } else { int xpos = floorf(tx() + 0.5f); int ypos = floorf(ty() + 0.5f); int xpos = static_cast<int>(floorf(tx() + 0.5f)); int ypos = static_cast<int>(floorf(ty() + 0.5f)); out = reg.translate(xpos, ypos); } return out; Loading Loading @@ -343,7 +343,7 @@ Transform Transform::inverse() const { const float x = M[2][0]; const float y = M[2][1]; const float idet = 1.0 / (a*d - b*c); const float idet = 1.0f / (a*d - b*c); result.mMatrix[0][0] = d*idet; result.mMatrix[0][1] = -c*idet; result.mMatrix[1][0] = -b*idet; Loading Loading @@ -404,28 +404,13 @@ void Transform::dump(const char* name) const type.append("TRANSLATE "); ALOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string()); ALOGD("%.4f %.4f %.4f", m[0][0], m[1][0], m[2][0]); ALOGD("%.4f %.4f %.4f", m[0][1], m[1][1], m[2][1]); ALOGD("%.4f %.4f %.4f", m[0][2], m[1][2], m[2][2]); } Transform::orientation_flags Transform::fromRotation(ISurfaceComposer::Rotation rotation) { // Convert to surfaceflinger's internal rotation type. switch (rotation) { case ISurfaceComposer::eRotateNone: return Transform::ROT_0; case ISurfaceComposer::eRotate90: return Transform::ROT_90; case ISurfaceComposer::eRotate180: return Transform::ROT_180; case ISurfaceComposer::eRotate270: return Transform::ROT_270; default: ALOGE("Invalid rotation passed to captureScreen(): %d\n", rotation); return Transform::ROT_0; } ALOGD("%.4f %.4f %.4f", static_cast<double>(m[0][0]), static_cast<double>(m[1][0]), static_cast<double>(m[2][0])); ALOGD("%.4f %.4f %.4f", static_cast<double>(m[0][1]), static_cast<double>(m[1][1]), static_cast<double>(m[2][1])); ALOGD("%.4f %.4f %.4f", static_cast<double>(m[0][2]), static_cast<double>(m[1][2]), static_cast<double>(m[2][2])); } // --------------------------------------------------------------------------- }; // namespace android } // namespace ui } // namespace android
services/surfaceflinger/Transform.h→libs/ui/include/ui/Transform.h +113 −0 Original line number Diff line number Diff line Loading @@ -20,23 +20,19 @@ #include <stdint.h> #include <sys/types.h> #include <ui/Point.h> #include <ui/Rect.h> #include <hardware/hardware.h> #include <math/vec2.h> #include <math/vec3.h> #include <gui/ISurfaceComposer.h> #include <hardware/hardware.h> #include <ui/Point.h> #include <ui/Rect.h> namespace android { class Region; // --------------------------------------------------------------------------- namespace ui { class Transform { class Transform { public: Transform(); Transform(const Transform& other); Loading @@ -53,9 +49,7 @@ public: ROT_INVALID = 0x80 }; static orientation_flags fromRotation(ISurfaceComposer::Rotation rotation); enum type_mask { enum type_mask : uint32_t { IDENTITY = 0, TRANSLATE = 0x1, ROTATE = 0x2, Loading Loading @@ -85,6 +79,7 @@ public: Rect transform(const Rect& bounds, bool roundOutwards = false) const; FloatRect transform(const FloatRect& bounds) const; Transform& operator = (const Transform& other); Transform operator * (const Transform& rhs) const; // assumes the last row is < 0 , 0 , 1 > vec2 transform(const vec2& v) const; Loading @@ -98,8 +93,8 @@ public: private: struct mat33 { vec3 v[3]; inline const vec3& operator [] (int i) const { return v[i]; } inline vec3& operator [] (int i) { return v[i]; } inline const vec3& operator [] (size_t i) const { return v[i]; } inline vec3& operator [] (size_t i) { return v[i]; } }; enum { UNKNOWN_TYPE = 0x80000000 }; Loading @@ -112,7 +107,7 @@ private: mutable uint32_t mType; }; // --------------------------------------------------------------------------- }; // namespace android } // namespace ui } // namespace android #endif /* ANDROID_TRANSFORM_H */
libs/vr/CleanSpec.mk 0 → 100644 +52 −0 Original line number Diff line number Diff line # Copyright (C) 2012 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # If you don't need to do a full clean build but would like to touch # a file or delete some intermediate files, add a clean step to the end # of the list. These steps will only be run once, if they haven't been # run before. # # E.g.: # $(call add-clean-step, touch -c external/sqlite/sqlite3.h) # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) # # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with # files that are missing or have been moved. # # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. # Use $(OUT_DIR) to refer to the "out" directory. # # If you need to re-do something that's already mentioned, just copy # the command and add it to the bottom of the list. E.g., if a change # that you made last week required touching a file and a change you # made today requires touching the same file, just copy the old # touch step and add it to the end of the list. # # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ # For example: #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ $(call add-clean-step, find $(PRODUCT_OUT) -type f -name "libdvr.so" -print0 | xargs -0 rm -f) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdvr_intermediates) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdvr_intermediates)
libs/vr/libbufferhubqueue/benchmarks/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ cc_benchmark { "libbase", "libbinder", "libcutils", "libdvr", "libdvr.google", "libgui", "liblog", "libhardware", Loading