Make sure to use filtering while in fixed-size mode
This commit is contained in:
parent
38ece279ea
commit
a7f669256f
|
@ -209,6 +209,19 @@ void Layer::onDraw(const Region& clip) const
|
|||
drawWithOpenGL(clip, tex);
|
||||
}
|
||||
|
||||
bool Layer::needsFiltering() const
|
||||
{
|
||||
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
|
||||
// NOTE: there is a race here, because mFixedSize is updated in a
|
||||
// binder transaction. however, it doesn't really matter since it is
|
||||
// evaluated each time we draw. To be perfectly correct, this flag
|
||||
// would have to be associated with a buffer.
|
||||
if (mFixedSize)
|
||||
return true;
|
||||
}
|
||||
return LayerBase::needsFiltering();
|
||||
}
|
||||
|
||||
|
||||
status_t Layer::setBufferCount(int bufferCount)
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
virtual void finishPageFlip();
|
||||
virtual bool needsBlending() const { return mNeedsBlending; }
|
||||
virtual bool needsDithering() const { return mNeedsDithering; }
|
||||
virtual bool needsFiltering() const;
|
||||
virtual bool isSecure() const { return mSecure; }
|
||||
virtual sp<Surface> createSurface() const;
|
||||
virtual status_t ditch();
|
||||
|
|
|
@ -43,7 +43,7 @@ LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display)
|
|||
: dpy(display), contentDirty(false),
|
||||
mFlinger(flinger),
|
||||
mTransformed(false),
|
||||
mUseLinearFiltering(false),
|
||||
mNeedsFiltering(false),
|
||||
mOrientation(0),
|
||||
mLeft(0), mTop(0),
|
||||
mTransactionFlags(0),
|
||||
|
@ -214,13 +214,12 @@ uint32_t LayerBase::doTransaction(uint32_t flags)
|
|||
flags |= eVisibleRegion;
|
||||
this->contentDirty = true;
|
||||
|
||||
const bool linearFiltering = mUseLinearFiltering;
|
||||
mUseLinearFiltering = false;
|
||||
mNeedsFiltering = false;
|
||||
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
|
||||
// we may use linear filtering, if the matrix scales us
|
||||
const uint8_t type = temp.transform.getType();
|
||||
if (!temp.transform.preserveRects() || (type >= Transform::SCALE)) {
|
||||
mUseLinearFiltering = true;
|
||||
mNeedsFiltering = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +465,7 @@ void LayerBase::validateTexture(GLint textureName) const
|
|||
glBindTexture(GL_TEXTURE_2D, textureName);
|
||||
// TODO: reload the texture if needed
|
||||
// this is currently done in loadTexture() below
|
||||
if (mUseLinearFiltering) {
|
||||
if (needsFiltering()) {
|
||||
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
|
|
|
@ -176,6 +176,11 @@ public:
|
|||
*/
|
||||
virtual bool needsDithering() const { return false; }
|
||||
|
||||
/**
|
||||
* needsLinearFiltering - true if this surface needs filtering
|
||||
*/
|
||||
virtual bool needsFiltering() const { return mNeedsFiltering; }
|
||||
|
||||
/**
|
||||
* transformed -- true is this surface needs a to be transformed
|
||||
*/
|
||||
|
@ -232,7 +237,7 @@ protected:
|
|||
|
||||
// cached during validateVisibility()
|
||||
bool mTransformed;
|
||||
bool mUseLinearFiltering;
|
||||
bool mNeedsFiltering;
|
||||
int32_t mOrientation;
|
||||
GLfloat mVertices[4][2];
|
||||
Rect mTransformedBounds;
|
||||
|
|
|
@ -118,7 +118,7 @@ uint32_t LayerBuffer::doTransaction(uint32_t flags)
|
|||
source->onTransaction(flags);
|
||||
uint32_t res = LayerBase::doTransaction(flags);
|
||||
// we always want filtering for these surfaces
|
||||
mUseLinearFiltering = !(mFlags & DisplayHardware::SLOW_CONFIG);
|
||||
mNeedsFiltering = !(mFlags & DisplayHardware::SLOW_CONFIG);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const
|
|||
// figure out if we need linear filtering
|
||||
if (buffers.w * h == buffers.h * w) {
|
||||
// same pixel area, don't use filtering
|
||||
mLayer.mUseLinearFiltering = false;
|
||||
mLayer.mNeedsFiltering = false;
|
||||
}
|
||||
|
||||
// Allocate a temporary buffer and create the corresponding EGLImageKHR
|
||||
|
|
Loading…
Reference in New Issue