diff options
author | Mathias Agopian <mathias@google.com> | 2011-08-30 19:24:04 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-30 19:24:04 -0700 |
commit | c21843a8b5c395cbaae6db0f786bdee556075f5d (patch) | |
tree | 22a798f6c97054bd2cc40ceb0cc2ef910c5a84cd /services | |
parent | 66b665ab8b8b52450310b1a551bfa8f52dbb2c10 (diff) | |
parent | 34cb9f2a960c4173bdafb4b8a2444c1bca4c5f0d (diff) | |
download | frameworks_base-c21843a8b5c395cbaae6db0f786bdee556075f5d.zip frameworks_base-c21843a8b5c395cbaae6db0f786bdee556075f5d.tar.gz frameworks_base-c21843a8b5c395cbaae6db0f786bdee556075f5d.tar.bz2 |
Merge "fix Surface positions are not floats"
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/LayerBase.cpp | 9 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.h | 6 | ||||
-rw-r--r-- | services/surfaceflinger/Transform.cpp | 12 | ||||
-rw-r--r-- | services/surfaceflinger/Transform.h | 4 |
4 files changed, 13 insertions, 18 deletions
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp index 6a5c8e5..603fb60 100644 --- a/services/surfaceflinger/LayerBase.cpp +++ b/services/surfaceflinger/LayerBase.cpp @@ -45,7 +45,6 @@ LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display) mFlinger(flinger), mFiltering(false), mNeedsFiltering(false), mOrientation(0), - mLeft(0), mTop(0), mTransactionFlags(0), mPremultipliedAlpha(true), mName("unnamed"), mDebug(false), mInvalidate(0) @@ -119,7 +118,7 @@ uint32_t LayerBase::setTransactionFlags(uint32_t flags) { return android_atomic_or(flags, &mTransactionFlags); } -bool LayerBase::setPosition(int32_t x, int32_t y) { +bool LayerBase::setPosition(float x, float y) { if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y) return false; mCurrentState.sequence++; @@ -259,8 +258,6 @@ void LayerBase::validateVisibility(const Transform& planeTransform) mOrientation = tr.getOrientation(); mTransform = tr; mTransformedBounds = tr.makeBounds(w, h); - mLeft = tr.tx(); - mTop = tr.ty(); } void LayerBase::lockPageFlip(bool& recomputeVisibleRegions) @@ -477,10 +474,10 @@ void LayerBase::dump(String8& result, char* buffer, size_t SIZE) const snprintf(buffer, SIZE, "+ %s %p\n" " " - "z=%9d, pos=(%4d,%4d), size=(%4d,%4d), " + "z=%9d, pos=(%g,%g), size=(%4d,%4d), " "isOpaque=%1d, needsDithering=%1d, invalidate=%1d, " "alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n", - getTypeId(), this, s.z, tx(), ty(), s.w, s.h, + getTypeId(), this, s.z, s.transform.tx(), s.transform.ty(), s.w, s.h, isOpaque(), needsDithering(), contentDirty, s.alpha, s.flags, s.transform[0][0], s.transform[0][1], diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h index 2cd3a94..d20f06a 100644 --- a/services/surfaceflinger/LayerBase.h +++ b/services/surfaceflinger/LayerBase.h @@ -84,7 +84,7 @@ public: String8 getName() const; // modify current state - bool setPosition(int32_t x, int32_t y); + bool setPosition(float x, float y); bool setLayer(uint32_t z); bool setSize(uint32_t w, uint32_t h); bool setAlpha(uint8_t alpha); @@ -217,8 +217,6 @@ public: inline State& currentState() { return mCurrentState; } int32_t getOrientation() const { return mOrientation; } - int tx() const { return mLeft; } - int ty() const { return mTop; } protected: const GraphicPlane& graphicPlane(int dpy) const; @@ -250,8 +248,6 @@ protected: Transform mTransform; GLfloat mVertices[4][2]; Rect mTransformedBounds; - int mLeft; - int mTop; // these are protected by an external lock State mCurrentState; diff --git a/services/surfaceflinger/Transform.cpp b/services/surfaceflinger/Transform.cpp index 05b7527..ba345ce 100644 --- a/services/surfaceflinger/Transform.cpp +++ b/services/surfaceflinger/Transform.cpp @@ -91,12 +91,12 @@ bool Transform::transformed() const { return type() > TRANSLATE; } -int Transform::tx() const { - return floorf(mMatrix[2][0] + 0.5f); +float Transform::tx() const { + return mMatrix[2][0]; } -int Transform::ty() const { - return floorf(mMatrix[2][1] + 0.5f); +float Transform::ty() const { + return mMatrix[2][1]; } void Transform::reset() { @@ -239,7 +239,9 @@ Region Transform::transform(const Region& reg) const out.set(transform(reg.bounds())); } } else { - out = reg.translate(tx(), ty()); + int xpos = floorf(tx() + 0.5f); + int ypos = floorf(ty() + 0.5f); + out = reg.translate(xpos, ypos); } return out; } diff --git a/services/surfaceflinger/Transform.h b/services/surfaceflinger/Transform.h index 8fa5b86..ec74243 100644 --- a/services/surfaceflinger/Transform.h +++ b/services/surfaceflinger/Transform.h @@ -64,8 +64,8 @@ public: uint32_t getOrientation() const; float const* operator [] (int i) const; // returns column i - int tx() const; - int ty() const; + float tx() const; + float ty() const; // modify the transform void reset(); |