Skip to content

Commit 05813b0

Browse files
pixelflingerAndroid (Google) Code Review
authored andcommitted
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
2 parents 4153bf3 + e338115 commit 05813b0

File tree

5 files changed

+20
-22
lines changed

5 files changed

+20
-22
lines changed

core/java/android/view/ViewGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3304,7 +3304,7 @@ public boolean gatherTransparentRegion(Region region) {
33043304
boolean noneOfTheChildrenAreTransparent = true;
33053305
for (int i = 0; i < count; i++) {
33063306
final View child = children[i];
3307-
if ((child.mViewFlags & VISIBILITY_MASK) != GONE || child.getAnimation() != null) {
3307+
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null) {
33083308
if (!child.gatherTransparentRegion(region)) {
33093309
noneOfTheChildrenAreTransparent = false;
33103310
}

services/surfaceflinger/Layer.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Layer::Layer(SurfaceFlinger* flinger,
5757
mSecure(false),
5858
mTextureManager(),
5959
mBufferManager(mTextureManager),
60-
mWidth(0), mHeight(0), mFixedSize(false)
60+
mWidth(0), mHeight(0), mNeedsScaling(false), mFixedSize(false)
6161
{
6262
}
6363

@@ -216,13 +216,10 @@ void Layer::reloadTexture(const Region& dirty)
216216

217217
void Layer::drawForSreenShot() const
218218
{
219-
bool currentFixedSize = mFixedSize;
220-
bool currentBlending = mNeedsBlending;
221-
const_cast<Layer*>(this)->mFixedSize = false;
222-
const_cast<Layer*>(this)->mFixedSize = true;
219+
const bool currentFiltering = mNeedsFiltering;
220+
const_cast<Layer*>(this)->mNeedsFiltering = true;
223221
LayerBase::drawForSreenShot();
224-
const_cast<Layer*>(this)->mFixedSize = currentFixedSize;
225-
const_cast<Layer*>(this)->mNeedsBlending = currentBlending;
222+
const_cast<Layer*>(this)->mNeedsFiltering = currentFiltering;
226223
}
227224

228225
void Layer::onDraw(const Region& clip) const
@@ -260,11 +257,10 @@ void Layer::onDraw(const Region& clip) const
260257
bool Layer::needsFiltering() const
261258
{
262259
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
263-
// NOTE: there is a race here, because mFixedSize is updated in a
264-
// binder transaction. however, it doesn't really matter since it is
265-
// evaluated each time we draw. To be perfectly correct, this flag
266-
// would have to be associated with a buffer.
267-
if (mFixedSize)
260+
// if our buffer is not the same size than ourselves,
261+
// we need filtering.
262+
Mutex::Autolock _l(mLock);
263+
if (mNeedsScaling)
268264
return true;
269265
}
270266
return LayerBase::needsFiltering();
@@ -321,6 +317,7 @@ sp<GraphicBuffer> Layer::requestBuffer(int index,
321317
Mutex::Autolock _l(mLock);
322318

323319
// zero means default
320+
mFixedSize = reqWidth && reqHeight;
324321
if (!reqFormat) reqFormat = mFormat;
325322
if (!reqWidth) reqWidth = mWidth;
326323
if (!reqHeight) reqHeight = mHeight;
@@ -334,6 +331,7 @@ sp<GraphicBuffer> Layer::requestBuffer(int index,
334331
mReqWidth = reqWidth;
335332
mReqHeight = reqHeight;
336333
mReqFormat = reqFormat;
334+
mNeedsScaling = mWidth != mReqWidth || mHeight != mReqHeight;
337335

338336
lcblk->reallocateAllExcept(index);
339337
}
@@ -457,6 +455,7 @@ void Layer::setBufferSize(uint32_t w, uint32_t h) {
457455
Mutex::Autolock _l(mLock);
458456
mWidth = w;
459457
mHeight = h;
458+
mNeedsScaling = mWidth != mReqWidth || mHeight != mReqHeight;
460459
}
461460

462461
bool Layer::isFixedSize() const {

services/surfaceflinger/Layer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ class Layer : public LayerBaseClient
230230
uint32_t mReqWidth;
231231
uint32_t mReqHeight;
232232
uint32_t mReqFormat;
233+
bool mNeedsScaling;
233234
bool mFixedSize;
234235
};
235236

services/surfaceflinger/LayerBase.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,10 @@ uint32_t LayerBase::doTransaction(uint32_t flags)
216216
flags |= eVisibleRegion;
217217
this->contentDirty = true;
218218

219-
mNeedsFiltering = false;
220-
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
221-
// we may use linear filtering, if the matrix scales us
222-
const uint8_t type = temp.transform.getType();
223-
if (!temp.transform.preserveRects() || (type >= Transform::SCALE)) {
224-
mNeedsFiltering = true;
225-
}
226-
}
219+
// we may use linear filtering, if the matrix scales us
220+
const uint8_t type = temp.transform.getType();
221+
mNeedsFiltering = (!temp.transform.preserveRects() ||
222+
(type >= Transform::SCALE));
227223
}
228224

229225
// Commit the transaction

services/surfaceflinger/LayerBase.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ class LayerBase : public RefBase
185185
/**
186186
* needsLinearFiltering - true if this surface needs filtering
187187
*/
188-
virtual bool needsFiltering() const { return mNeedsFiltering; }
188+
virtual bool needsFiltering() const {
189+
return (!(mFlags & DisplayHardware::SLOW_CONFIG)) && mNeedsFiltering;
190+
}
189191

190192
/**
191193
* isSecure - true if this surface is secure, that is if it prevents

0 commit comments

Comments
 (0)