| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_BROWSER_BROWSER_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "skia/ext/refptr.h" |
| 9 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
| 10 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 11 #include "ui/gfx/vector2d_f.h" | 12 #include "ui/gfx/vector2d_f.h" |
| 12 | 13 |
| 14 class SkPicture; |
| 13 struct AwDrawGLInfo; | 15 struct AwDrawGLInfo; |
| 14 struct AwDrawSWFunctionTable; | 16 struct AwDrawSWFunctionTable; |
| 15 | 17 |
| 16 namespace content { | 18 namespace content { |
| 17 class ContentViewCore; | 19 class ContentViewCore; |
| 18 } | 20 } |
| 19 | 21 |
| 20 namespace android_webview { | 22 namespace android_webview { |
| 21 | 23 |
| 22 // Interface for all the WebView-specific content rendering operations. | 24 // Interface for all the WebView-specific content rendering operations. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 JNIEnv* env, | 79 JNIEnv* env, |
| 78 const base::android::JavaRef<jobject>& jbitmap) = 0; | 80 const base::android::JavaRef<jobject>& jbitmap) = 0; |
| 79 | 81 |
| 80 protected: | 82 protected: |
| 81 virtual ~JavaHelper() {} | 83 virtual ~JavaHelper() {} |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 // Global hookup methods. | 86 // Global hookup methods. |
| 85 static void SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table); | 87 static void SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table); |
| 86 static AwDrawSWFunctionTable* GetAwDrawSWFunctionTable(); | 88 static AwDrawSWFunctionTable* GetAwDrawSWFunctionTable(); |
| 87 static bool IsSkiaVersionCompatible(); | |
| 88 | 89 |
| 89 // Rendering methods. | 90 // Rendering methods. |
| 90 | 91 |
| 91 // Main handler for view drawing: performs a SW draw immediately, or sets up | 92 // Main handler for view drawing: performs a SW draw immediately, or sets up |
| 92 // a subsequent GL Draw (via Client::RequestDrawGL) and returns true. A false | 93 // a subsequent GL Draw (via Client::RequestDrawGL) and returns true. A false |
| 93 // return value indicates nothing was or will be drawn. | 94 // return value indicates nothing was or will be drawn. |
| 94 // |java_canvas| is the target of the draw. |is_hardware_canvas| indicates | 95 // |java_canvas| is the target of the draw. |is_hardware_canvas| indicates |
| 95 // a GL Draw maybe possible on this canvas. |scroll| if the view's current | 96 // a GL Draw maybe possible on this canvas. |scroll| if the view's current |
| 96 // scroll offset. |clip| is the canvas's clip bounds. |visible_rect| is the | 97 // scroll offset. |clip| is the canvas's clip bounds. |visible_rect| is the |
| 97 // intersection of the view size and the window in window coordinates. | 98 // intersection of the view size and the window in window coordinates. |
| 98 virtual bool OnDraw(jobject java_canvas, | 99 virtual bool OnDraw(jobject java_canvas, |
| 99 bool is_hardware_canvas, | 100 bool is_hardware_canvas, |
| 100 const gfx::Vector2d& scroll, | 101 const gfx::Vector2d& scroll, |
| 101 const gfx::Rect& clip) = 0; | 102 const gfx::Rect& clip) = 0; |
| 102 | 103 |
| 103 // Called in response to a prior Client::RequestDrawGL() call. See | 104 // Called in response to a prior Client::RequestDrawGL() call. See |
| 104 // AwDrawGLInfo documentation for more details of the contract. | 105 // AwDrawGLInfo documentation for more details of the contract. |
| 105 virtual void DrawGL(AwDrawGLInfo* draw_info) = 0; | 106 virtual void DrawGL(AwDrawGLInfo* draw_info) = 0; |
| 106 | 107 |
| 107 // The global visible rect changed and this is the new value. | 108 // The global visible rect changed and this is the new value. |
| 108 virtual void SetGlobalVisibleRect(const gfx::Rect& visible_rect) = 0; | 109 virtual void SetGlobalVisibleRect(const gfx::Rect& visible_rect) = 0; |
| 109 | 110 |
| 110 // CapturePicture API methods. | 111 // CapturePicture API methods. |
| 111 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture( | 112 virtual skia::RefPtr<SkPicture> CapturePicture(int width, int height) = 0; |
| 112 int width, | |
| 113 int height) = 0; | |
| 114 virtual void EnableOnNewPicture(bool enabled) = 0; | 113 virtual void EnableOnNewPicture(bool enabled) = 0; |
| 115 | 114 |
| 116 // View update notifications. | 115 // View update notifications. |
| 117 virtual void OnVisibilityChanged(bool visible) = 0; | 116 virtual void OnVisibilityChanged(bool visible) = 0; |
| 118 virtual void OnSizeChanged(int width, int height) = 0; | 117 virtual void OnSizeChanged(int width, int height) = 0; |
| 119 virtual void OnAttachedToWindow(int width, int height) = 0; | 118 virtual void OnAttachedToWindow(int width, int height) = 0; |
| 120 virtual void OnDetachedFromWindow() = 0; | 119 virtual void OnDetachedFromWindow() = 0; |
| 121 | 120 |
| 122 // Sets the scale for logical<->physical pixel conversions. | 121 // Sets the scale for logical<->physical pixel conversions. |
| 123 virtual void SetDipScale(float dip_scale) = 0; | 122 virtual void SetDipScale(float dip_scale) = 0; |
| 124 virtual void SetPageScaleFactor(float page_scale_factor) = 0; | 123 virtual void SetPageScaleFactor(float page_scale_factor) = 0; |
| 125 | 124 |
| 126 // Set the root layer scroll offset to |new_value|. | 125 // Set the root layer scroll offset to |new_value|. |
| 127 virtual void ScrollTo(gfx::Vector2d new_value) = 0; | 126 virtual void ScrollTo(gfx::Vector2d new_value) = 0; |
| 128 | 127 |
| 129 // Android views hierarchy gluing. | 128 // Android views hierarchy gluing. |
| 130 virtual bool IsAttachedToWindow() = 0; | 129 virtual bool IsAttachedToWindow() = 0; |
| 131 virtual bool IsViewVisible() = 0; | 130 virtual bool IsViewVisible() = 0; |
| 132 virtual gfx::Rect GetScreenRect() = 0; | 131 virtual gfx::Rect GetScreenRect() = 0; |
| 133 | 132 |
| 134 virtual ~BrowserViewRenderer() {} | 133 virtual ~BrowserViewRenderer() {} |
| 135 }; | 134 }; |
| 136 | 135 |
| 137 } // namespace android_webview | 136 } // namespace android_webview |
| 138 | 137 |
| 139 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 138 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |