summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-07-29 10:41:12 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-29 10:41:12 -0700
commitf4fd53b381d794af77dc887454032ed5f299a22e (patch)
tree575f7d283f346e3196cbc4f367fa34e62fc3a35b /core/jni
parent1e833b31ee04c35b5a3494db1acb0068350d8391 (diff)
parentc4c458c678567b899aae04631570460c5e729512 (diff)
downloadframeworks_base-f4fd53b381d794af77dc887454032ed5f299a22e.zip
frameworks_base-f4fd53b381d794af77dc887454032ed5f299a22e.tar.gz
frameworks_base-f4fd53b381d794af77dc887454032ed5f299a22e.tar.bz2
Merge "Fix NinePatch decoder when the target is smaller than the source."
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/NinePatchImpl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/jni/android/graphics/NinePatchImpl.cpp b/core/jni/android/graphics/NinePatchImpl.cpp
index a3e36ee..579749a 100644
--- a/core/jni/android/graphics/NinePatchImpl.cpp
+++ b/core/jni/android/graphics/NinePatchImpl.cpp
@@ -160,6 +160,14 @@ void NinePatch_Draw(SkCanvas* canvas, const SkRect& bounds,
return;
}
+ // if the nine patch is bigger than the dst on a given axis we cannot
+ // stretch properly so just draw the bitmap as best as possible and return
+ if (bitmap.width() >= bounds.width() || bitmap.height() >= bounds.height())
+ {
+ canvas->drawBitmapRect(bitmap, NULL, bounds, paint);
+ return;
+ }
+
// should try a quick-reject test before calling lockPixels
SkAutoLockPixels alp(bitmap);