| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ | 5 #ifndef ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ |
| 6 #define ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ | 6 #define ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| 11 #ifndef __cplusplus | 11 #ifndef __cplusplus |
| 12 #error "Can't mix C and C++ when using jni.h" | 12 #error "Can't mix C and C++ when using jni.h" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 class SkPicture; |
| 16 |
| 15 // Holds the information required to implement the SW draw to system canvas. | 17 // Holds the information required to implement the SW draw to system canvas. |
| 16 struct AwPixelInfo { | 18 struct AwPixelInfo { |
| 17 int config; // In SkBitmap::Config format. | 19 int config; // In SkBitmap::Config format. |
| 18 int width; // In pixels. | 20 int width; // In pixels. |
| 19 int height; // In pixels. | 21 int height; // In pixels. |
| 20 int row_bytes; // Number of bytes from start of one line to next. | 22 int row_bytes; // Number of bytes from start of one line to next. |
| 21 void* pixels; // The pixels, all (height * row_bytes) of them. | 23 void* pixels; // The pixels, all (height * row_bytes) of them. |
| 22 float matrix[9]; // The matrix currently in effect on the canvas. | 24 float matrix[9]; // The matrix currently in effect on the canvas. |
| 23 void* clip_region; // Flattened clip region. | 25 void* clip_region; // Flattened clip region. |
| 24 size_t clip_region_size; // Number of bytes in |clip_region|. | 26 size_t clip_region_size; // Number of bytes in |clip_region|. |
| 25 }; | 27 }; |
| 26 | 28 |
| 27 // Function that can be called to fish out the underlying native pixel data | 29 // Function that can be called to fish out the underlying native pixel data |
| 28 // from a Java canvas object, for optimized rendering path. | 30 // from a Java canvas object, for optimized rendering path. |
| 29 // Returns the pixel info on success, which must be freed via a call to | 31 // Returns the pixel info on success, which must be freed via a call to |
| 30 // AwReleasePixelsFunction, or NULL. | 32 // AwReleasePixelsFunction, or NULL. |
| 31 typedef AwPixelInfo* (AwAccessPixelsFunction)(JNIEnv* env, jobject canvas); | 33 typedef AwPixelInfo* (AwAccessPixelsFunction)(JNIEnv* env, jobject canvas); |
| 32 | 34 |
| 33 // Must be called to balance every *successful* call to AwAccessPixelsFunction | 35 // Must be called to balance every *successful* call to AwAccessPixelsFunction |
| 34 // (i.e. that returned true). | 36 // (i.e. that returned true). |
| 35 typedef void (AwReleasePixelsFunction)(AwPixelInfo* pixels); | 37 typedef void (AwReleasePixelsFunction)(AwPixelInfo* pixels); |
| 36 | 38 |
| 39 // Called to create an Android Picture object encapsulating a native SkPicture. |
| 40 typedef jobject (AwCreatePictureFunction)(JNIEnv* env, SkPicture* picture); |
| 41 |
| 42 // Method that returns the current Skia function. |
| 43 typedef void (SkiaVersionFunction)(int* major, int* minor, int* patch); |
| 44 |
| 45 // Called to verify if the Skia versions are compatible. |
| 46 typedef bool (AwIsSkiaVersionCompatibleFunction)(SkiaVersionFunction function); |
| 47 |
| 37 // "vtable" for the functions declared in this file. An instance must be set via | 48 // "vtable" for the functions declared in this file. An instance must be set via |
| 38 // AwContents.setAwDrawSWFunctionTable | 49 // AwContents.setAwDrawSWFunctionTable |
| 39 struct AwDrawSWFunctionTable { | 50 struct AwDrawSWFunctionTable { |
| 40 AwAccessPixelsFunction* access_pixels; | 51 AwAccessPixelsFunction* access_pixels; |
| 41 AwReleasePixelsFunction* release_pixels; | 52 AwReleasePixelsFunction* release_pixels; |
| 53 AwCreatePictureFunction* create_picture; |
| 54 AwIsSkiaVersionCompatibleFunction* is_skia_version_compatible; |
| 42 }; | 55 }; |
| 43 | 56 |
| 44 #endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ | 57 #endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ |
| OLD | NEW |