This source file includes following definitions.
- JNINamespace
- run
- beginRecording
- endRecording
- getWidth
- getHeight
- draw
- SuppressWarnings
- writeToStream
- unsupportedOperation
- nativeDestroy
- nativeGetWidth
- nativeGetHeight
- nativeDraw
package org.chromium.android_webview;
import android.graphics.Canvas;
import android.graphics.Picture;
import android.graphics.Rect;
import org.chromium.base.JNINamespace;
import org.chromium.content.common.CleanupReference;
import java.io.OutputStream;
@JNINamespace("android_webview")
class AwPicture extends Picture {
private long mNativeAwPicture;
private static final class DestroyRunnable implements Runnable {
private long mNativeAwPicture;
private DestroyRunnable(long nativeAwPicture) {
mNativeAwPicture = nativeAwPicture;
}
@Override
public void run() {
nativeDestroy(mNativeAwPicture);
}
}
private CleanupReference mCleanupReference;
AwPicture(long nativeAwPicture) {
mNativeAwPicture = nativeAwPicture;
mCleanupReference = new CleanupReference(this, new DestroyRunnable(nativeAwPicture));
}
@Override
public Canvas beginRecording(int width, int height) {
unsupportedOperation();
return null;
}
@Override
public void endRecording() {
}
@Override
public int getWidth() {
return nativeGetWidth(mNativeAwPicture);
}
@Override
public int getHeight() {
return nativeGetHeight(mNativeAwPicture);
}
private Rect mClipBoundsTemporary = new Rect();
@Override
public void draw(Canvas canvas) {
canvas.getClipBounds(mClipBoundsTemporary);
nativeDraw(mNativeAwPicture, canvas,
mClipBoundsTemporary.left, mClipBoundsTemporary.top,
mClipBoundsTemporary.right, mClipBoundsTemporary.bottom);
}
@Override
@SuppressWarnings("deprecation")
public void writeToStream(OutputStream stream) {
unsupportedOperation();
}
private void unsupportedOperation() {
throw new IllegalStateException("Unsupported in AwPicture");
}
private static native void nativeDestroy(long nativeAwPicture);
private native int nativeGetWidth(long nativeAwPicture);
private native int nativeGetHeight(long nativeAwPicture);
private native void nativeDraw(long nativeAwPicture, Canvas canvas,
int left, int top, int right, int bottom);
}