Merge "StorageManager: Introduce StorageManager"
diff --git a/common/java/com/android/common/speech/LoggingEvents.java b/common/java/com/android/common/speech/LoggingEvents.java
index eb9476f..3b3ecb8 100644
--- a/common/java/com/android/common/speech/LoggingEvents.java
+++ b/common/java/com/android/common/speech/LoggingEvents.java
@@ -16,9 +16,6 @@
package com.android.common.speech;
-import android.content.Intent;
-import android.content.Context;
-
/**
* Logging event constants used for Voice Search and VoiceIME. These are the
* keys and values of extras to be specified in logging broadcast intents.
diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h
index b9c2bbe..2c29bfb 100644
--- a/include/ui/CameraParameters.h
+++ b/include/ui/CameraParameters.h
@@ -34,8 +34,10 @@
void set(const char *key, const char *value);
void set(const char *key, int value);
+ void setFloat(const char *key, float value);
const char *get(const char *key) const;
int getInt(const char *key) const;
+ float getFloat(const char *key) const;
/* preview-size=176x144 */
void setPreviewSize(int width, int height);
diff --git a/libs/ui/CameraParameters.cpp b/libs/ui/CameraParameters.cpp
index 495e164..c4958a0 100644
--- a/libs/ui/CameraParameters.cpp
+++ b/libs/ui/CameraParameters.cpp
@@ -209,6 +209,13 @@
set(key, str);
}
+void CameraParameters::setFloat(const char *key, float value)
+{
+ char str[16]; // 14 should be enough. We overestimate to be safe.
+ snprintf(str, sizeof(str), "%g", value);
+ set(key, str);
+}
+
const char *CameraParameters::get(const char *key) const
{
String8 v = mMap.valueFor(String8(key));
@@ -225,6 +232,13 @@
return strtol(v, 0, 0);
}
+float CameraParameters::getFloat(const char *key) const
+{
+ const char *v = get(key);
+ if (v == 0) return -1;
+ return strtof(v, 0);
+}
+
static int parse_size(const char *str, int &width, int &height)
{
// Find the width.
diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp
index 2875c13..fae89b9 100644
--- a/opengl/libagl/texture.cpp
+++ b/opengl/libagl/texture.cpp
@@ -1389,9 +1389,20 @@
// (x,y) is the lower-left corner of colorBuffer
y = cbSurface.height - (y + height);
+ /* The GLES spec says:
+ * If any of the pixels within the specified rectangle are outside
+ * the framebuffer associated with the current rendering context,
+ * then the values obtained for those pixels are undefined.
+ */
+ if (x+width > GLint(cbSurface.width))
+ width = cbSurface.width - x;
+
+ if (y+height > GLint(cbSurface.height))
+ height = cbSurface.height - y;
+
int err = copyPixels(c,
txSurface, 0, 0,
- cbSurface, x, y, cbSurface.width, cbSurface.height);
+ cbSurface, x, y, width, height);
if (err) {
ogles_error(c, err);
}
@@ -1439,6 +1450,17 @@
const GGLSurface& cbSurface = c->rasterizer.state.buffers.color.s;
y = cbSurface.height - (y + height);
+ /* The GLES spec says:
+ * If any of the pixels within the specified rectangle are outside
+ * the framebuffer associated with the current rendering context,
+ * then the values obtained for those pixels are undefined.
+ */
+ if (x+width > GLint(cbSurface.width))
+ width = cbSurface.width - x;
+
+ if (y+height > GLint(cbSurface.height))
+ height = cbSurface.height - y;
+
int err = copyPixels(c,
surface, xoffset, yoffset,
cbSurface, x, y, width, height);