cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / android_webview / public / browser / draw_gl.h
blob91966951878404356b1a129c25b407bc0f1e1b95
1 // Copyright 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_GL_H_
6 #define ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_GL_H_
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
13 // 1 is L/L MR1
15 // 2 starts at M, and added an imperfect workaround for complex clipping by
16 // elevating the WebView into an FBO layer. If any transform, clip, or outline
17 // clip occurs that would either likely use the stencil buffer for clipping, or
18 // require shader based clipping in HWUI, the WebView is drawn into an FBO (if
19 // it fits).
20 // This is a temporary workaround for a lack of WebView support for stencil/
21 // shader based round rect clipping, and should be removed when webview is
22 // capable of supporting these clips internally when drawing.
23 static const int kAwDrawGLInfoVersion = 2;
25 // Holds the information required to trigger an OpenGL drawing operation.
26 struct AwDrawGLInfo {
27 int version; // The AwDrawGLInfo this struct was built with.
29 // Input: tells the draw function what action to perform.
30 enum Mode {
31 kModeDraw = 0,
32 kModeProcess,
33 kModeProcessNoContext,
34 kModeSync,
35 } mode;
37 // Input: current clip rect in surface coordinates. Reflects the current state
38 // of the OpenGL scissor rect. Both the OpenGL scissor rect and viewport are
39 // set by the caller of the draw function and updated during View animations.
40 int clip_left;
41 int clip_top;
42 int clip_right;
43 int clip_bottom;
45 // Input: current width/height of destination surface.
46 int width;
47 int height;
49 // Input: is the View rendered into an independent layer.
50 // If false, the surface is likely to hold to the full screen contents, with
51 // the scissor box set by the caller to the actual View location and size.
52 // Also the transformation matrix will contain at least a translation to the
53 // position of the View to render, plus any other transformations required as
54 // part of any ongoing View animation. View translucency (alpha) is ignored,
55 // although the framework will set is_layer to true for non-opaque cases.
56 // Can be requested via the View.setLayerType(View.LAYER_TYPE_NONE, ...)
57 // Android API method.
59 // If true, the surface is dedicated to the View and should have its size.
60 // The viewport and scissor box are set by the caller to the whole surface.
61 // Animation transformations are handled by the caller and not reflected in
62 // the provided transformation matrix. Translucency works normally.
63 // Can be requested via the View.setLayerType(View.LAYER_TYPE_HARDWARE, ...)
64 // Android API method.
65 bool is_layer;
67 // Input: current transformation matrix in surface pixels.
68 // Uses the column-based OpenGL matrix format.
69 float transform[16];
72 // Function to invoke a direct GL draw into the client's pre-configured
73 // GL context. Obtained via AwContents.getDrawGLFunction() (static).
74 // |view_context| is an opaque identifier that was returned by the corresponding
75 // call to AwContents.getAwDrawGLViewContext().
76 // |draw_info| carries the in and out parameters for this draw.
77 // |spare| ignored; pass NULL.
78 typedef void (AwDrawGLFunction)(long view_context,
79 AwDrawGLInfo* draw_info,
80 void* spare);
81 enum AwMapMode {
82 MAP_READ_ONLY,
83 MAP_WRITE_ONLY,
84 MAP_READ_WRITE,
87 // Called to create a GraphicBuffer
88 typedef long AwCreateGraphicBufferFunction(int w, int h);
89 // Called to release a GraphicBuffer
90 typedef void AwReleaseGraphicBufferFunction(long buffer_id);
91 // Called to map a GraphicBuffer in |mode|.
92 typedef int AwMapFunction(long buffer_id, AwMapMode mode, void** vaddr);
93 // Called to unmap a GraphicBuffer
94 typedef int AwUnmapFunction(long buffer_id);
95 // Called to get a native buffer pointer
96 typedef void* AwGetNativeBufferFunction(long buffer_id);
97 // Called to get the stride of the buffer
98 typedef unsigned int AwGetStrideFunction(long buffer_id);
100 static const int kAwDrawGLFunctionTableVersion = 1;
102 // Set of functions used in rendering in hardware mode
103 struct AwDrawGLFunctionTable {
104 int version;
105 AwCreateGraphicBufferFunction* create_graphic_buffer;
106 AwReleaseGraphicBufferFunction* release_graphic_buffer;
107 AwMapFunction* map;
108 AwUnmapFunction* unmap;
109 AwGetNativeBufferFunction* get_native_buffer;
110 AwGetStrideFunction* get_stride;
113 #ifdef __cplusplus
114 } // extern "C"
115 #endif
117 #endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_GL_H_