Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: android_webview/public/browser/draw_sw.h

Issue 20234002: Make the AwPixelInfo more skia version independent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sgurun Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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; 15 class SkPicture;
16 16
17 static const int kAwPixelInfoVersion = 2;
18
19 // Values of the AwPixelInfo::config field.
20 enum AwPixelConfig {
21 AwConfig_RGB_565 = 4,
22 AwConfig_ARGB_4444 = 5,
23 AwConfig_ARGB_8888 = 6,
24 };
25
17 // Holds the information required to implement the SW draw to system canvas. 26 // Holds the information required to implement the SW draw to system canvas.
18 struct AwPixelInfo { 27 struct AwPixelInfo {
19 int config; // In SkBitmap::Config format. 28 AwPixelInfo() : version(kAwPixelInfoVersion) {}
20 int width; // In pixels. 29 int version; // The kAwPixelInfoVersion this struct was built with.
21 int height; // In pixels. 30 int config; // |pixel| format: a value from AwPixelConfig.
22 int row_bytes; // Number of bytes from start of one line to next. 31 int width; // In pixels.
23 void* pixels; // The pixels, all (height * row_bytes) of them. 32 int height; // In pixels.
24 float matrix[9]; // The matrix currently in effect on the canvas. 33 int row_bytes; // Number of bytes from start of one line to next.
25 void* clip_region; // Flattened clip region. 34 void* pixels; // The pixels, all (height * row_bytes) of them.
26 size_t clip_region_size; // Number of bytes in |clip_region|. 35 // The Matrix and Clip are relative to |pixels|, not the source canvas.
36 float matrix[9]; // The matrix currently in effect on the canvas.
37 int clip_rect_count; // Number of rects in |clip_rects|.
38 int* clip_rects; // Clip area: 4 ints per rect in {x,y,w,h} format.
39 void* clip_region; // TODO(joth): remove clip_region and clip_region_size.
40 size_t clip_region_size;
41 // NOTE: If you add more members, bump kAwPixelInfoVersion.
27 }; 42 };
28 43
29 // Function that can be called to fish out the underlying native pixel data 44 // Function that can be called to fish out the underlying native pixel data
30 // from a Java canvas object, for optimized rendering path. 45 // from a Java canvas object, for optimized rendering path.
31 // Returns the pixel info on success, which must be freed via a call to 46 // Returns the pixel info on success, which must be freed via a call to
32 // AwReleasePixelsFunction, or NULL. 47 // AwReleasePixelsFunction, or NULL.
33 typedef AwPixelInfo* (AwAccessPixelsFunction)(JNIEnv* env, jobject canvas); 48 typedef AwPixelInfo* (AwAccessPixelsFunction)(JNIEnv* env, jobject canvas);
34 49
35 // Must be called to balance every *successful* call to AwAccessPixelsFunction 50 // Must be called to balance every *successful* call to AwAccessPixelsFunction
36 // (i.e. that returned true). 51 // (i.e. that returned true).
(...skipping 11 matching lines...) Expand all
48 // "vtable" for the functions declared in this file. An instance must be set via 63 // "vtable" for the functions declared in this file. An instance must be set via
49 // AwContents.setAwDrawSWFunctionTable 64 // AwContents.setAwDrawSWFunctionTable
50 struct AwDrawSWFunctionTable { 65 struct AwDrawSWFunctionTable {
51 AwAccessPixelsFunction* access_pixels; 66 AwAccessPixelsFunction* access_pixels;
52 AwReleasePixelsFunction* release_pixels; 67 AwReleasePixelsFunction* release_pixels;
53 AwCreatePictureFunction* create_picture; 68 AwCreatePictureFunction* create_picture;
54 AwIsSkiaVersionCompatibleFunction* is_skia_version_compatible; 69 AwIsSkiaVersionCompatibleFunction* is_skia_version_compatible;
55 }; 70 };
56 71
57 #endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ 72 #endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698