diff options
| author | Romain Guy <romainguy@google.com> | 2010-09-16 14:43:11 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-09-16 14:43:11 -0700 |
| commit | c5958f8a659969b40aa624043264aee32c3c61af (patch) | |
| tree | 7477c41f0633bfe9d5347e08232048234675ca25 /libs | |
| parent | 885b1f21d95c5c356d7dbe40a4d033d558c2c772 (diff) | |
| parent | bf434114cbf55b216fdc76fc8d65a75e84c9dab5 (diff) | |
| download | frameworks_base-c5958f8a659969b40aa624043264aee32c3c61af.zip frameworks_base-c5958f8a659969b40aa624043264aee32c3c61af.tar.gz frameworks_base-c5958f8a659969b40aa624043264aee32c3c61af.tar.bz2 | |
Merge "Snap layer bounds to pixel boundaries."
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/Rect.h | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 670d049..d6c0053 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -353,6 +353,8 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, // Layers only make sense if they are in the framebuffer's bounds bounds.intersect(*mSnapshot->clipRect); + bounds.snapToPixelBoundaries(); + if (bounds.isEmpty() || bounds.getWidth() > mMaxTextureSize || bounds.getHeight() > mMaxTextureSize) { return false; diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h index 6b22c2b..5166ee9 100644 --- a/libs/hwui/Rect.h +++ b/libs/hwui/Rect.h @@ -148,6 +148,13 @@ struct Rect { return false; } + void snapToPixelBoundaries() { + left = floor(left); + top = floor(top); + right = ceil(right); + bottom = ceil(bottom); + } + void dump() const { LOGD("Rect[l=%f t=%f r=%f b=%f]", left, top, right, bottom); } |
