diff options
| -rw-r--r-- | core/java/android/util/TimeUtils.java | 5 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/util/TimeUtilsTest.java | 18 | ||||
| -rw-r--r-- | libs/rs/rsContext.cpp | 1 | ||||
| -rw-r--r-- | libs/rs/rsContext.h | 2 | ||||
| -rw-r--r-- | libs/rs/rsSampler.cpp | 6 |
5 files changed, 28 insertions, 4 deletions
diff --git a/core/java/android/util/TimeUtils.java b/core/java/android/util/TimeUtils.java index 60ca3849d6f9..85ce5e1e55d0 100644 --- a/core/java/android/util/TimeUtils.java +++ b/core/java/android/util/TimeUtils.java @@ -158,18 +158,17 @@ public class TimeUtils { static private int printField(char[] formatStr, int amt, char suffix, int pos, boolean always, int zeropad) { if (always || amt > 0) { + final int startPos = pos; if ((always && zeropad >= 3) || amt > 99) { int dig = amt/100; formatStr[pos] = (char)(dig + '0'); pos++; - always = true; amt -= (dig*100); } - if ((always && zeropad >= 2) || amt > 9) { + if ((always && zeropad >= 2) || amt > 9 || startPos != pos) { int dig = amt/10; formatStr[pos] = (char)(dig + '0'); pos++; - always = true; amt -= (dig*10); } formatStr[pos] = (char)(amt + '0'); diff --git a/core/tests/coretests/src/android/util/TimeUtilsTest.java b/core/tests/coretests/src/android/util/TimeUtilsTest.java index 65a6078f692c..8d9f8e55df80 100644 --- a/core/tests/coretests/src/android/util/TimeUtilsTest.java +++ b/core/tests/coretests/src/android/util/TimeUtilsTest.java @@ -429,4 +429,22 @@ public class TimeUtilsTest extends TestCase { c.getTimeInMillis(), country); } + + public void testFormatDuration() { + assertFormatDuration("0", 0); + assertFormatDuration("-1ms", -1); + assertFormatDuration("+1ms", 1); + assertFormatDuration("+10ms", 10); + assertFormatDuration("+100ms", 100); + assertFormatDuration("+101ms", 101); + assertFormatDuration("+330ms", 330); + assertFormatDuration("+1s330ms", 1330); + assertFormatDuration("+10s24ms", 10024); + } + + private void assertFormatDuration(String expected, long duration) { + StringBuilder sb = new StringBuilder(); + TimeUtils.formatDuration(duration, sb); + assertEquals("formatDuration(" + duration + ")", expected, sb.toString()); + } } diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index 92c66193530f..90a2c79267ae 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -572,6 +572,7 @@ void Context::setSurface(uint32_t w, uint32_t h, ANativeWindow *sur) glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &mGL.mMaxFragmentUniformVectors); mGL.OES_texture_npot = NULL != strstr((const char *)mGL.mExtensions, "GL_OES_texture_npot"); + mGL.GL_IMG_texture_npot = NULL != strstr((const char *)mGL.mExtensions, "GL_IMG_texture_npot"); } } diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h index 709730efe5f1..e24fd09d547e 100644 --- a/libs/rs/rsContext.h +++ b/libs/rs/rsContext.h @@ -166,6 +166,7 @@ public: mutable const ObjectBase * mObjHead; bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;} + bool ext_GL_IMG_texture_npot() const {return mGL.GL_IMG_texture_npot;} protected: Device *mDev; @@ -202,6 +203,7 @@ protected: int32_t mMaxVertexTextureUnits; bool OES_texture_npot; + bool GL_IMG_texture_npot; } mGL; uint32_t mWidth; diff --git a/libs/rs/rsSampler.cpp b/libs/rs/rsSampler.cpp index 71f508fa9a1e..5693c8abeda8 100644 --- a/libs/rs/rsSampler.cpp +++ b/libs/rs/rsSampler.cpp @@ -70,7 +70,11 @@ void Sampler::setupGL(const Context *rsc, bool npot) } if ((mMinFilter == RS_SAMPLER_LINEAR_MIP_LINEAR) && forceNonMip) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + if (rsc->ext_GL_IMG_texture_npot()) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, trans[mMinFilter]); } |