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 #include "android_webview/native/java_browser_view_renderer_helper.h" | 5 #include "android_webview/native/java_browser_view_renderer_helper.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "android_webview/public/browser/draw_sw.h" | 9 #include "android_webview/public/browser/draw_sw.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } // namespace | 145 } // namespace |
146 | 146 |
147 void RasterHelperSetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table) { | 147 void RasterHelperSetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table) { |
148 g_sw_draw_functions = table; | 148 g_sw_draw_functions = table; |
149 } | 149 } |
150 | 150 |
151 // static | 151 // static |
152 scoped_ptr<SoftwareCanvasHolder> SoftwareCanvasHolder::Create( | 152 scoped_ptr<SoftwareCanvasHolder> SoftwareCanvasHolder::Create( |
153 jobject java_canvas, | 153 jobject java_canvas, |
154 const gfx::Vector2d& scroll_correction, | 154 const gfx::Vector2d& scroll_correction, |
155 const gfx::Size& auxiliary_bitmap_size) { | 155 const gfx::Size& auxiliary_bitmap_size, |
| 156 bool force_auxiliary_bitmap) { |
156 JNIEnv* env = base::android::AttachCurrentThread(); | 157 JNIEnv* env = base::android::AttachCurrentThread(); |
157 scoped_ptr<SoftwareCanvasHolder> holder( | 158 scoped_ptr<SoftwareCanvasHolder> holder; |
158 new JavaCanvasHolder(env, java_canvas, scroll_correction)); | 159 if (!force_auxiliary_bitmap) { |
159 if (!holder->GetCanvas()) { | 160 scoped_ptr<SoftwareCanvasHolder> holder( |
| 161 new JavaCanvasHolder(env, java_canvas, scroll_correction)); |
| 162 } |
| 163 if (!holder.get() || !holder->GetCanvas()) { |
160 holder.reset(); | 164 holder.reset(); |
161 holder.reset(new AuxiliaryCanvasHolder(env, java_canvas, scroll_correction, | 165 holder.reset(new AuxiliaryCanvasHolder(env, java_canvas, scroll_correction, |
162 auxiliary_bitmap_size)); | 166 auxiliary_bitmap_size)); |
163 } | 167 } |
164 if (!holder->GetCanvas()) { | 168 if (!holder->GetCanvas()) { |
165 holder.reset(); | 169 holder.reset(); |
166 } | 170 } |
167 return holder; | 171 return holder; |
168 } | 172 } |
169 | 173 |
170 bool RegisterJavaBrowserViewRendererHelper(JNIEnv* env) { | 174 bool RegisterJavaBrowserViewRendererHelper(JNIEnv* env) { |
171 return RegisterNativesImpl(env); | 175 return RegisterNativesImpl(env); |
172 } | 176 } |
173 | 177 |
174 } // namespace android_webview | 178 } // namespace android_webview |
OLD | NEW |