Merge changes I244b5469,I32044e91 into gingerbread

* changes:
  [3253328, 3171580] Treat GONE and INVISIBLE views the same when calculating transparent regions
  [3171580] Fix two typos related to fixed-size buffers
This commit is contained in:
Mathias Agopian
2010-12-07 14:18:21 -08:00
committed by Android (Google) Code Review
5 changed files with 20 additions and 22 deletions

View File

@@ -3304,7 +3304,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
boolean noneOfTheChildrenAreTransparent = true; boolean noneOfTheChildrenAreTransparent = true;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
final View child = children[i]; final View child = children[i];
if ((child.mViewFlags & VISIBILITY_MASK) != GONE || child.getAnimation() != null) { if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null) {
if (!child.gatherTransparentRegion(region)) { if (!child.gatherTransparentRegion(region)) {
noneOfTheChildrenAreTransparent = false; noneOfTheChildrenAreTransparent = false;
} }

View File

@@ -57,7 +57,7 @@ Layer::Layer(SurfaceFlinger* flinger,
mSecure(false), mSecure(false),
mTextureManager(), mTextureManager(),
mBufferManager(mTextureManager), mBufferManager(mTextureManager),
mWidth(0), mHeight(0), mFixedSize(false) mWidth(0), mHeight(0), mNeedsScaling(false), mFixedSize(false)
{ {
} }
@@ -216,13 +216,10 @@ slowpath:
void Layer::drawForSreenShot() const void Layer::drawForSreenShot() const
{ {
bool currentFixedSize = mFixedSize; const bool currentFiltering = mNeedsFiltering;
bool currentBlending = mNeedsBlending; const_cast<Layer*>(this)->mNeedsFiltering = true;
const_cast<Layer*>(this)->mFixedSize = false;
const_cast<Layer*>(this)->mFixedSize = true;
LayerBase::drawForSreenShot(); LayerBase::drawForSreenShot();
const_cast<Layer*>(this)->mFixedSize = currentFixedSize; const_cast<Layer*>(this)->mNeedsFiltering = currentFiltering;
const_cast<Layer*>(this)->mNeedsBlending = currentBlending;
} }
void Layer::onDraw(const Region& clip) const void Layer::onDraw(const Region& clip) const
@@ -260,11 +257,10 @@ void Layer::onDraw(const Region& clip) const
bool Layer::needsFiltering() const bool Layer::needsFiltering() const
{ {
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
// NOTE: there is a race here, because mFixedSize is updated in a // if our buffer is not the same size than ourselves,
// binder transaction. however, it doesn't really matter since it is // we need filtering.
// evaluated each time we draw. To be perfectly correct, this flag Mutex::Autolock _l(mLock);
// would have to be associated with a buffer. if (mNeedsScaling)
if (mFixedSize)
return true; return true;
} }
return LayerBase::needsFiltering(); return LayerBase::needsFiltering();
@@ -321,6 +317,7 @@ sp<GraphicBuffer> Layer::requestBuffer(int index,
Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock);
// zero means default // zero means default
mFixedSize = reqWidth && reqHeight;
if (!reqFormat) reqFormat = mFormat; if (!reqFormat) reqFormat = mFormat;
if (!reqWidth) reqWidth = mWidth; if (!reqWidth) reqWidth = mWidth;
if (!reqHeight) reqHeight = mHeight; if (!reqHeight) reqHeight = mHeight;
@@ -334,6 +331,7 @@ sp<GraphicBuffer> Layer::requestBuffer(int index,
mReqWidth = reqWidth; mReqWidth = reqWidth;
mReqHeight = reqHeight; mReqHeight = reqHeight;
mReqFormat = reqFormat; mReqFormat = reqFormat;
mNeedsScaling = mWidth != mReqWidth || mHeight != mReqHeight;
lcblk->reallocateAllExcept(index); lcblk->reallocateAllExcept(index);
} }
@@ -457,6 +455,7 @@ void Layer::setBufferSize(uint32_t w, uint32_t h) {
Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock);
mWidth = w; mWidth = w;
mHeight = h; mHeight = h;
mNeedsScaling = mWidth != mReqWidth || mHeight != mReqHeight;
} }
bool Layer::isFixedSize() const { bool Layer::isFixedSize() const {

View File

@@ -230,6 +230,7 @@ private:
uint32_t mReqWidth; uint32_t mReqWidth;
uint32_t mReqHeight; uint32_t mReqHeight;
uint32_t mReqFormat; uint32_t mReqFormat;
bool mNeedsScaling;
bool mFixedSize; bool mFixedSize;
}; };

View File

@@ -216,14 +216,10 @@ uint32_t LayerBase::doTransaction(uint32_t flags)
flags |= eVisibleRegion; flags |= eVisibleRegion;
this->contentDirty = true; this->contentDirty = true;
mNeedsFiltering = false;
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
// we may use linear filtering, if the matrix scales us // we may use linear filtering, if the matrix scales us
const uint8_t type = temp.transform.getType(); const uint8_t type = temp.transform.getType();
if (!temp.transform.preserveRects() || (type >= Transform::SCALE)) { mNeedsFiltering = (!temp.transform.preserveRects() ||
mNeedsFiltering = true; (type >= Transform::SCALE));
}
}
} }
// Commit the transaction // Commit the transaction

View File

@@ -185,7 +185,9 @@ public:
/** /**
* needsLinearFiltering - true if this surface needs filtering * needsLinearFiltering - true if this surface needs filtering
*/ */
virtual bool needsFiltering() const { return mNeedsFiltering; } virtual bool needsFiltering() const {
return (!(mFlags & DisplayHardware::SLOW_CONFIG)) && mNeedsFiltering;
}
/** /**
* isSecure - true if this surface is secure, that is if it prevents * isSecure - true if this surface is secure, that is if it prevents