Index: content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java b/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java |
index 25fc8b62b5847dc1ab90c64cb0eeb0fab2d2a607..a7d551a1c0e2d58f9524fb005fbbe3f4094ad996 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/input/HandleViewResources.java |
@@ -10,6 +10,7 @@ import android.content.res.TypedArray; |
import android.graphics.Bitmap; |
import android.graphics.BitmapFactory; |
import android.graphics.Canvas; |
+import android.graphics.Matrix; |
import android.graphics.drawable.Drawable; |
import org.chromium.base.CalledByNative; |
@@ -77,6 +78,16 @@ public class HandleViewResources { |
return canvasBitmap; |
} |
+ private static Bitmap invertBitmap(Bitmap source) { |
+ Matrix matrix = new Matrix(); |
+ matrix.postRotate(180, source.getWidth() / 2, source.getHeight() / 2); |
+ Bitmap scaledBitmap = Bitmap.createScaledBitmap(source, source.getWidth(), |
jdduke (slow)
2014/08/20 15:15:01
Why do we need to invert the bitmap explicitly whe
AviD
2014/08/21 16:15:20
Please correct if my understanding is wrong. Does
jdduke (slow)
2014/08/22 18:04:08
Right, we can use the same bitmap/drawable, but si
|
+ source.getHeight(), true); |
+ source = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), |
+ scaledBitmap.getHeight(), matrix, true); |
+ return source; |
+ } |
+ |
@CalledByNative |
private static Bitmap getLeftHandleBitmap(Context context) { |
return getHandleBitmap(context, LEFT_HANDLE_ATTRS); |
@@ -91,4 +102,22 @@ public class HandleViewResources { |
private static Bitmap getRightHandleBitmap(Context context) { |
return getHandleBitmap(context, RIGHT_HANDLE_ATTRS); |
} |
+ |
+ @CalledByNative |
+ private static Bitmap getRightHandleBitmapInverted(Context context) { |
+ Bitmap leftBitmap = getHandleBitmap(context, LEFT_HANDLE_ATTRS); |
+ return invertBitmap(leftBitmap); |
+ } |
+ |
+ @CalledByNative |
+ private static Bitmap getLeftHandleBitmapInverted(Context context) { |
+ Bitmap rightBitmap = getHandleBitmap(context, RIGHT_HANDLE_ATTRS); |
+ return invertBitmap(rightBitmap); |
+ } |
+ |
+ @CalledByNative |
+ private static Bitmap getCenterHandleBitmapInverted(Context context) { |
+ Bitmap centerBitmap = getHandleBitmap(context, CENTER_HANDLE_ATTRS); |
+ return invertBitmap(centerBitmap); |
+ } |
} |