Index: android_webview/browser/view_renderer.cc |
diff --git a/android_webview/browser/view_renderer.cc b/android_webview/browser/view_renderer.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f89462aab949cc27488c6dc99c814d820089e5b5 |
--- /dev/null |
+++ b/android_webview/browser/view_renderer.cc |
@@ -0,0 +1,45 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "android_webview/browser/view_renderer.h" |
+ |
+#include "android_webview/public/browser/draw_sw.h" |
+#include "base/logging.h" |
+#include "third_party/skia/include/core/SkGraphics.h" |
+ |
+namespace { |
+AwDrawSWFunctionTable* g_sw_draw_functions = NULL; |
+bool g_is_skia_version_compatible = false; |
benm (inactive)
2013/01/21 20:34:49
nit: maybe a comment to explain about skia compati
Leandro Graciá Gil
2013/01/22 08:18:46
Done.
|
+} |
+ |
+namespace android_webview { |
+ |
+ViewRenderer::ViewRenderer(Client* client, JavaHelper* java_helper) |
+ : client_(client), |
+ java_helper_(java_helper) { |
+} |
+ |
+ViewRenderer::~ViewRenderer() { |
+} |
+ |
+// static |
+void ViewRenderer::SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table) { |
+ g_sw_draw_functions = table; |
+ g_is_skia_version_compatible = |
+ g_sw_draw_functions->is_skia_version_compatible(&SkGraphics::GetVersion); |
+ if (!g_is_skia_version_compatible) |
+ LOG(WARNING) << "Skia native versions are not compatible."; |
mkosiba (inactive)
2013/01/22 02:13:34
nit: maybe explain the impact ("..are not compatib
Leandro Graciá Gil
2013/01/22 08:18:46
Done.
|
+} |
+ |
+// static |
+AwDrawSWFunctionTable* ViewRenderer::SWDrawFunctions() { |
+ return g_sw_draw_functions; |
+} |
+ |
+// static |
+bool ViewRenderer::IsSkiaVersionCompatible() { |
mkosiba (inactive)
2013/01/22 02:13:34
DCHECK(g_sw_draw_functions != NULL) ?
Leandro Graciá Gil
2013/01/22 08:18:46
Nope. It will be null for tests.
|
+ return g_is_skia_version_compatible; |
+} |
+ |
+} // namespace android_webview |