am 09443aeb: am 62884505: Merge "Reset ANativeWindow crop on buffer geometry changes." into honeycomb

* commit '09443aeb6470d66f5bc1938b70d74b3e2f9bbbb9':
  Reset ANativeWindow crop on buffer geometry changes.
This commit is contained in:
Jamie Gennis 2011-01-30 15:05:42 -08:00 committed by Android Git Automerger
commit 79676ac8e6
4 changed files with 26 additions and 16 deletions

View File

@ -315,6 +315,8 @@ static inline int native_window_set_buffer_count(
* If all parameters are 0, the normal behavior is restored. That is,
* dequeued buffers following this call will be sized to the window's size.
*
* Calling this function will reset the window crop to a NULL value, which
* disables cropping of the buffers.
*/
static inline int native_window_set_buffers_geometry(
ANativeWindow* window,

View File

@ -238,13 +238,15 @@ int SurfaceTextureClient::setCrop(Rect const* rect)
LOGV("SurfaceTextureClient::setCrop");
Mutex::Autolock lock(mMutex);
// empty/invalid rects are not allowed
if (rect->isEmpty())
return BAD_VALUE;
Rect realRect;
if (rect == NULL || rect->isEmpty()) {
realRect = Rect(0, 0);
} else {
realRect = *rect;
}
status_t err = mSurfaceTexture->setCrop(*rect);
LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s",
strerror(-err));
LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
return err;
}
@ -280,7 +282,10 @@ int SurfaceTextureClient::setBuffersGeometry(int w, int h, int format)
mReqHeight = h;
mReqFormat = format;
return NO_ERROR;
status_t err = mSurfaceTexture->setCrop(Rect(0, 0));
LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
return err;
}
int SurfaceTextureClient::setBuffersTransform(int transform)

View File

@ -827,13 +827,15 @@ int Surface::disconnect(int api)
int Surface::crop(Rect const* rect)
{
// empty/invalid rects are not allowed
if (rect->isEmpty())
return BAD_VALUE;
Mutex::Autolock _l(mSurfaceLock);
// TODO: validate rect size
mNextBufferCrop = *rect;
if (rect == NULL || rect->isEmpty()) {
mNextBufferCrop = Rect(0,0);
} else {
mNextBufferCrop = *rect;
}
return NO_ERROR;
}
@ -884,6 +886,9 @@ int Surface::setBuffersGeometry(int w, int h, int format)
// EGLConfig validation.
mFormat = format;
}
mNextBufferCrop = Rect(0,0);
return NO_ERROR;
}

View File

@ -498,11 +498,9 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
}
void LayerBase::setBufferCrop(const Rect& crop) {
if (!crop.isEmpty()) {
if (mBufferCrop != crop) {
mBufferCrop = crop;
mFlinger->invalidateHwcGeometry();
}
if (mBufferCrop != crop) {
mBufferCrop = crop;
mFlinger->invalidateHwcGeometry();
}
}