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

Side by Side Diff: android_webview/browser/browser_view_renderer.cc

Issue 12041009: [Android WebView] Migrate the rendering code to a separate set of classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated and rebased. Created 7 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "android_webview/browser/browser_view_renderer.h"
6
7 #include "android_webview/public/browser/draw_sw.h"
8 #include "base/logging.h"
9 #include "third_party/skia/include/core/SkGraphics.h"
10
11 namespace {
12
13 // Provides software rendering functions from the Android glue layer.
14 // Allows preventing extra copies of data when rendering.
15 AwDrawSWFunctionTable* g_sw_draw_functions = NULL;
16
17 // Tells if the Skia library versions in Android and Chromium are compatible.
18 // If they are then it's possible to pass Skia objects like SkPictures to the
19 // Android glue layer via the SW rendering functions.
20 // If they are not, then additional copies and rasterizations are required
21 // as a fallback mechanism, which will have an important performance impact.
22 bool g_is_skia_version_compatible = false;
23
24 }
25
26 namespace android_webview {
27
28 BrowserViewRenderer::BrowserViewRenderer(Client* client,
29 JavaHelper* java_helper)
30 : client_(client),
31 java_helper_(java_helper) {
32 }
33
34 BrowserViewRenderer::~BrowserViewRenderer() {
35 }
36
37 // static
38 void BrowserViewRenderer::SetAwDrawSWFunctionTable(
39 AwDrawSWFunctionTable* table) {
40 g_sw_draw_functions = table;
41 g_is_skia_version_compatible =
42 g_sw_draw_functions->is_skia_version_compatible(&SkGraphics::GetVersion);
43 LOG_IF(WARNING, !g_is_skia_version_compatible)
44 << "Skia versions are not compatible, rendering performance will suffer.";
45 }
46
47 // static
48 AwDrawSWFunctionTable* BrowserViewRenderer::SWDrawFunctions() {
49 return g_sw_draw_functions;
50 }
51
52 // static
53 bool BrowserViewRenderer::IsSkiaVersionCompatible() {
54 return g_is_skia_version_compatible;
55 }
56
57 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698