Loading include/ui/egl/android_natives.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -315,6 +315,8 @@ static inline int native_window_set_buffer_count( * If all parameters are 0, the normal behavior is restored. That is, * 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. * 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( static inline int native_window_set_buffers_geometry( ANativeWindow* window, ANativeWindow* window, Loading libs/gui/SurfaceTextureClient.cpp +11 −6 Original line number Original line Diff line number Diff line Loading @@ -238,13 +238,15 @@ int SurfaceTextureClient::setCrop(Rect const* rect) LOGV("SurfaceTextureClient::setCrop"); LOGV("SurfaceTextureClient::setCrop"); Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); // empty/invalid rects are not allowed Rect realRect; if (rect->isEmpty()) if (rect == NULL || rect->isEmpty()) { return BAD_VALUE; realRect = Rect(0, 0); } else { realRect = *rect; } status_t err = mSurfaceTexture->setCrop(*rect); status_t err = mSurfaceTexture->setCrop(*rect); LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err)); strerror(-err)); return err; return err; } } Loading Loading @@ -280,7 +282,10 @@ int SurfaceTextureClient::setBuffersGeometry(int w, int h, int format) mReqHeight = h; mReqHeight = h; mReqFormat = format; 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) int SurfaceTextureClient::setBuffersTransform(int transform) Loading libs/surfaceflinger_client/Surface.cpp +10 −5 Original line number Original line Diff line number Diff line Loading @@ -827,13 +827,15 @@ int Surface::disconnect(int api) int Surface::crop(Rect const* rect) int Surface::crop(Rect const* rect) { { // empty/invalid rects are not allowed if (rect->isEmpty()) return BAD_VALUE; Mutex::Autolock _l(mSurfaceLock); Mutex::Autolock _l(mSurfaceLock); // TODO: validate rect size // TODO: validate rect size if (rect == NULL || rect->isEmpty()) { mNextBufferCrop = Rect(0,0); } else { mNextBufferCrop = *rect; mNextBufferCrop = *rect; } return NO_ERROR; return NO_ERROR; } } Loading Loading @@ -884,6 +886,9 @@ int Surface::setBuffersGeometry(int w, int h, int format) // EGLConfig validation. // EGLConfig validation. mFormat = format; mFormat = format; } } mNextBufferCrop = Rect(0,0); return NO_ERROR; return NO_ERROR; } } Loading services/surfaceflinger/LayerBase.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -498,13 +498,11 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const } } void LayerBase::setBufferCrop(const Rect& crop) { void LayerBase::setBufferCrop(const Rect& crop) { if (!crop.isEmpty()) { if (mBufferCrop != crop) { if (mBufferCrop != crop) { mBufferCrop = crop; mBufferCrop = crop; mFlinger->invalidateHwcGeometry(); mFlinger->invalidateHwcGeometry(); } } } } } void LayerBase::setBufferTransform(uint32_t transform) { void LayerBase::setBufferTransform(uint32_t transform) { if (mBufferTransform != transform) { if (mBufferTransform != transform) { Loading Loading
include/ui/egl/android_natives.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -315,6 +315,8 @@ static inline int native_window_set_buffer_count( * If all parameters are 0, the normal behavior is restored. That is, * 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. * 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( static inline int native_window_set_buffers_geometry( ANativeWindow* window, ANativeWindow* window, Loading
libs/gui/SurfaceTextureClient.cpp +11 −6 Original line number Original line Diff line number Diff line Loading @@ -238,13 +238,15 @@ int SurfaceTextureClient::setCrop(Rect const* rect) LOGV("SurfaceTextureClient::setCrop"); LOGV("SurfaceTextureClient::setCrop"); Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); // empty/invalid rects are not allowed Rect realRect; if (rect->isEmpty()) if (rect == NULL || rect->isEmpty()) { return BAD_VALUE; realRect = Rect(0, 0); } else { realRect = *rect; } status_t err = mSurfaceTexture->setCrop(*rect); status_t err = mSurfaceTexture->setCrop(*rect); LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err)); strerror(-err)); return err; return err; } } Loading Loading @@ -280,7 +282,10 @@ int SurfaceTextureClient::setBuffersGeometry(int w, int h, int format) mReqHeight = h; mReqHeight = h; mReqFormat = format; 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) int SurfaceTextureClient::setBuffersTransform(int transform) Loading
libs/surfaceflinger_client/Surface.cpp +10 −5 Original line number Original line Diff line number Diff line Loading @@ -827,13 +827,15 @@ int Surface::disconnect(int api) int Surface::crop(Rect const* rect) int Surface::crop(Rect const* rect) { { // empty/invalid rects are not allowed if (rect->isEmpty()) return BAD_VALUE; Mutex::Autolock _l(mSurfaceLock); Mutex::Autolock _l(mSurfaceLock); // TODO: validate rect size // TODO: validate rect size if (rect == NULL || rect->isEmpty()) { mNextBufferCrop = Rect(0,0); } else { mNextBufferCrop = *rect; mNextBufferCrop = *rect; } return NO_ERROR; return NO_ERROR; } } Loading Loading @@ -884,6 +886,9 @@ int Surface::setBuffersGeometry(int w, int h, int format) // EGLConfig validation. // EGLConfig validation. mFormat = format; mFormat = format; } } mNextBufferCrop = Rect(0,0); return NO_ERROR; return NO_ERROR; } } Loading
services/surfaceflinger/LayerBase.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -498,13 +498,11 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const } } void LayerBase::setBufferCrop(const Rect& crop) { void LayerBase::setBufferCrop(const Rect& crop) { if (!crop.isEmpty()) { if (mBufferCrop != crop) { if (mBufferCrop != crop) { mBufferCrop = crop; mBufferCrop = crop; mFlinger->invalidateHwcGeometry(); mFlinger->invalidateHwcGeometry(); } } } } } void LayerBase::setBufferTransform(uint32_t transform) { void LayerBase::setBufferTransform(uint32_t transform) { if (mBufferTransform != transform) { if (mBufferTransform != transform) { Loading