aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kiryanov <rkir@google.com>2019-04-01 17:47:47 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-04-01 17:47:47 -0700
commit650dda1d7e8c642d8ad1f6b293f3b7360f57f8d0 (patch)
treecd6322f2673198316247fc1b04565b14b0ddfc0a
parent164ba60c2fa470fcf8d9974a413e7c4e52325782 (diff)
parentb869d4b4d3f2b07ecdd9e53e7e3c94706e32d9b0 (diff)
downloadgoldfish-opengl-650dda1d7e8c642d8ad1f6b293f3b7360f57f8d0.tar.gz
Replace a manual buffer allocation with std::vector am: b2b3323f45 am: 50cd609aa0
am: b869d4b4d3 Change-Id: I2b6d309b494c9090abbc46f27da0893adc6404e5
-rw-r--r--system/gralloc/gralloc.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index a08873d0..851f3b02 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -45,6 +45,7 @@
#include <set>
#include <map>
+#include <vector>
#include <string>
#include <sstream>
@@ -384,11 +385,11 @@ static void updateHostColorBuffer(cb_handle_t* cb,
cb->frameworkFormat != HAL_PIXEL_FORMAT_YV12 &&
cb->frameworkFormat != HAL_PIXEL_FORMAT_YCbCr_420_888;
- char* convertedBuf = NULL;
+ std::vector<char> convertedBuf;
if ((doLocked && is_rgb_format) ||
(!grdma && (doLocked || !is_rgb_format))) {
- convertedBuf = new char[rgbSz];
- to_send = convertedBuf;
+ convertedBuf.resize(rgbSz);
+ to_send = convertedBuf.data();
send_buffer_size = rgbSz;
}
@@ -439,8 +440,6 @@ static void updateHostColorBuffer(cb_handle_t* cb,
left, top, width, height,
cb->glFormat, cb->glType, to_send);
}
-
- if (convertedBuf) delete [] convertedBuf;
}
#ifndef GL_RGBA16F