This source file includes following definitions.
- JNINamespace
- createBitmap
- drawBitmapIntoCanvas
package org.chromium.android_webview;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
@JNINamespace("android_webview")
public class JavaBrowserViewRendererHelper {
private static final String LOGTAG = "JavaBrowserViewRendererHelper";
@CalledByNative
private static Bitmap createBitmap(int width, int height, Canvas canvas) {
if (canvas != null) {
width = Math.min(width, canvas.getMaximumBitmapWidth());
height = Math.min(height, canvas.getMaximumBitmapHeight());
}
Bitmap bitmap = null;
try {
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
} catch (OutOfMemoryError e) {
android.util.Log.w(LOGTAG, "Error allocating bitmap");
}
return bitmap;
}
@CalledByNative
private static void drawBitmapIntoCanvas(Bitmap bitmap, Canvas canvas, int x, int y) {
canvas.drawBitmap(bitmap, x, y, null);
}
private JavaBrowserViewRendererHelper() {
}
}