1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_
6 #define ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_
12 #error "Can't mix C and C++ when using jni.h"
18 static const int kAwPixelInfoVersion
= 3;
20 // Holds the information required to implement the SW draw to system canvas.
22 int version
; // The kAwPixelInfoVersion this struct was built with.
23 SkCanvasState
* state
; // The externalize state in skia format.
24 // NOTE: If you add more members, bump kAwPixelInfoVersion.
27 // Function that can be called to fish out the underlying native pixel data
28 // from a Java canvas object, for optimized rendering path.
29 // Returns the pixel info on success, which must be freed via a call to
30 // AwReleasePixelsFunction, or NULL.
31 typedef AwPixelInfo
* (AwAccessPixelsFunction
)(JNIEnv
* env
, jobject canvas
);
33 // Must be called to balance every *successful* call to AwAccessPixelsFunction
34 // (i.e. that returned true).
35 typedef void (AwReleasePixelsFunction
)(AwPixelInfo
* pixels
);
37 // Called to create an Android Picture object encapsulating a native SkPicture.
38 typedef jobject (AwCreatePictureFunction
)(JNIEnv
* env
, SkPicture
* picture
);
40 // Method that returns the current Skia function.
41 typedef void (SkiaVersionFunction
)(int* major
, int* minor
, int* patch
);
43 // Called to verify if the Skia versions are compatible.
44 typedef bool (AwIsSkiaVersionCompatibleFunction
)(SkiaVersionFunction function
);
46 static const int kAwDrawSWFunctionTableVersion
= 1;
48 // "vtable" for the functions declared in this file. An instance must be set via
49 // AwContents.setAwDrawSWFunctionTable
50 struct AwDrawSWFunctionTable
{
52 AwAccessPixelsFunction
* access_pixels
;
53 AwReleasePixelsFunction
* release_pixels
;
56 #endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_