summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-09-10 14:32:16 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-11 13:31:45 -0700
commit8cae124af2142687a6833dbaab8a43df6dd67b43 (patch)
tree662ea14668e4b07cb2336d62fdb0241713182480 /core/java/android/view
parent7ff269f359a8848fd0c39993d8fe21a8324806f9 (diff)
downloadframeworks_base-8cae124af2142687a6833dbaab8a43df6dd67b43.zip
frameworks_base-8cae124af2142687a6833dbaab8a43df6dd67b43.tar.gz
frameworks_base-8cae124af2142687a6833dbaab8a43df6dd67b43.tar.bz2
Various cleanup around resources and nine-patches.
Remove the stuff that doesn't use preloaded drawables when in compatibility mode, since this works fine ever since we were able to deal with drawables in a different density than the canvas. Change the snapshot function on View to return a snapshot at the same size that will actually be drawn on screen (when in compatibility mode), to be able to show scaling artifacts and all. This change was original an attempt to fix issue #2101917: Text field edges appears to be improperly rounded. That turns out to probably be something deeper in the graphics system, but also included here is the debugging code I did to try to track down the problem to make it easy to turn on again later. Change-Id: I34bfca629639c7ff103f3989d88874112ef778d9
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/View.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2f17bbc..f63c2f1 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6038,16 +6038,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* some form of this public, but should think about the API.
*/
Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor) {
- final int width = mRight - mLeft;
- final int height = mBottom - mTop;
+ int width = mRight - mLeft;
+ int height = mBottom - mTop;
- Bitmap bitmap = Bitmap.createBitmap(width, height, quality);
+ final AttachInfo attachInfo = mAttachInfo;
+ final float scale = attachInfo.mApplicationScale;
+ width = (int) ((width * scale) + 0.5f);
+ height = (int) ((height * scale) + 0.5f);
+
+ Bitmap bitmap = Bitmap.createBitmap(width > 0 ? width : 1,
+ height > 0 ? height : 1, quality);
if (bitmap == null) {
throw new OutOfMemoryError();
}
+ bitmap.setDensity(getResources().getDisplayMetrics().densityDpi);
+
Canvas canvas;
- final AttachInfo attachInfo = mAttachInfo;
if (attachInfo != null) {
canvas = attachInfo.mCanvas;
if (canvas == null) {
@@ -6070,6 +6077,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
computeScroll();
final int restoreCount = canvas.save();
+ canvas.scale(scale, scale);
canvas.translate(-mScrollX, -mScrollY);
// Temporarily remove the dirty mask