Search in sources :

Example 1 with DrawData

use of android.webkit.WebViewCore.DrawData in project android_frameworks_base by ParanoidAndroid.

the class ViewStateSerializer method deserializeViewState.

static DrawData deserializeViewState(InputStream stream) throws IOException {
    DataInputStream dis = new DataInputStream(stream);
    int version = dis.readInt();
    if (version > VERSION) {
        throw new IOException("Unexpected version: " + version);
    }
    int contentWidth = dis.readInt();
    int contentHeight = dis.readInt();
    int baseLayer = nativeDeserializeViewState(version, dis, new byte[WORKING_STREAM_STORAGE]);
    final WebViewCore.DrawData draw = new WebViewCore.DrawData();
    draw.mViewState = new WebViewCore.ViewState();
    draw.mContentSize = new Point(contentWidth, contentHeight);
    draw.mBaseLayer = baseLayer;
    stream.close();
    return draw;
}
Also used : DrawData(android.webkit.WebViewCore.DrawData) DrawData(android.webkit.WebViewCore.DrawData) IOException(java.io.IOException) Point(android.graphics.Point) DataInputStream(java.io.DataInputStream) Point(android.graphics.Point)

Example 2 with DrawData

use of android.webkit.WebViewCore.DrawData in project XobotOS by xamarin.

the class ViewStateSerializer method deserializeViewState.

static DrawData deserializeViewState(InputStream stream, WebView web) throws IOException {
    DataInputStream dis = new DataInputStream(stream);
    int version = dis.readInt();
    if (version != VERSION) {
        throw new IOException("Unexpected version: " + version);
    }
    int contentWidth = dis.readInt();
    int contentHeight = dis.readInt();
    int baseLayer = nativeDeserializeViewState(dis, new byte[WORKING_STREAM_STORAGE]);
    final WebViewCore.DrawData draw = new WebViewCore.DrawData();
    draw.mViewState = new WebViewCore.ViewState();
    int viewWidth = web.getViewWidth();
    int viewHeight = web.getViewHeightWithTitle() - web.getTitleHeight();
    draw.mViewSize = new Point(viewWidth, viewHeight);
    draw.mContentSize = new Point(contentWidth, contentHeight);
    draw.mViewState.mDefaultScale = web.getDefaultZoomScale();
    draw.mBaseLayer = baseLayer;
    draw.mInvalRegion = new Region(0, 0, contentWidth, contentHeight);
    return draw;
}
Also used : DrawData(android.webkit.WebViewCore.DrawData) DrawData(android.webkit.WebViewCore.DrawData) Region(android.graphics.Region) IOException(java.io.IOException) Point(android.graphics.Point) DataInputStream(java.io.DataInputStream) Point(android.graphics.Point)

Aggregations

Point (android.graphics.Point)2 DrawData (android.webkit.WebViewCore.DrawData)2 DataInputStream (java.io.DataInputStream)2 IOException (java.io.IOException)2 Region (android.graphics.Region)1