diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:43 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:43 -0800 |
commit | e09fd9e819c23dc90bca68375645e15544861330 (patch) | |
tree | 9a9fdadd1301625f875a3c126c986c79e3363ac4 /libs/surfaceflinger/LayerBlur.cpp | |
parent | 7c1b96a165f970a09ed239bb4fb3f1b0d8f2a407 (diff) | |
download | frameworks_native-e09fd9e819c23dc90bca68375645e15544861330.zip frameworks_native-e09fd9e819c23dc90bca68375645e15544861330.tar.gz frameworks_native-e09fd9e819c23dc90bca68375645e15544861330.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'libs/surfaceflinger/LayerBlur.cpp')
-rw-r--r-- | libs/surfaceflinger/LayerBlur.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libs/surfaceflinger/LayerBlur.cpp b/libs/surfaceflinger/LayerBlur.cpp index 192ceda..e3ae7fb 100644 --- a/libs/surfaceflinger/LayerBlur.cpp +++ b/libs/surfaceflinger/LayerBlur.cpp @@ -145,11 +145,13 @@ void LayerBlur::onDraw(const Region& clip) const mRefreshCache = false; mAutoRefreshPending = false; - uint16_t* const pixels = (uint16_t*)malloc(w*h*2); + // allocate enough memory for 4-bytes (2 pixels) aligned data + const int32_t s = (w + 1) & ~1; + uint16_t* const pixels = (uint16_t*)malloc(s*h*2); - // this reads the frame-buffer, so a h/w GL would have to + // This reads the frame-buffer, so a h/w GL would have to // finish() its rendering first. we don't want to do that - // too often. + // too often. Read data is 4-bytes aligned. glReadPixels(X, Y, w, h, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, pixels); // blur that texture. @@ -157,7 +159,7 @@ void LayerBlur::onDraw(const Region& clip) const bl.version = sizeof(GGLSurface); bl.width = w; bl.height = h; - bl.stride = w; + bl.stride = s; bl.format = GGL_PIXEL_FORMAT_RGB_565; bl.data = (GGLubyte*)pixels; blurFilter(&bl, 8, 2); |