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

Unified Diff: android_webview/test/shell/src/draw_gl.cc

Issue 414503004: android: Use hw acceleration in android_webview_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/test/shell/src/draw_gl.cc
diff --git a/android_webview/test/shell/src/draw_gl.cc b/android_webview/test/shell/src/draw_gl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e920d479fbac5bd2904cfdee933d602e7569f07c
--- /dev/null
+++ b/android_webview/test/shell/src/draw_gl.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2014 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 <jni.h>
+
+#include "draw_gl.h"
boliu 2014/08/28 23:15:05 use full path instead of adding a custom include p
no sievers 2014/08/29 01:30:44 So using relative paths doesn't work well with DEP
+
+extern "C" {
+
+JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+ return JNI_VERSION_1_4;
+}
+
+// This code goes into its own dynamic library, so we cannot depend on
+// any other components like base.
+JNIEXPORT void JNICALL
+ Java_org_chromium_android_1webview_shell_DrawGL_nativeDrawGL(
+ JNIEnv*,
+ jclass,
+ jlong draw_gl,
+ jlong view,
+ jint width,
+ jint height,
+ jint scroll_x,
+ jint scroll_y,
+ jint mode) {
+ void (*fp)(long, AwDrawGLInfo*, void*) =
+ reinterpret_cast<void (*)(long, AwDrawGLInfo*, void*)>(draw_gl);
boliu 2014/08/28 23:15:05 AwDrawGLFunction (typedef in draw_gl.h), also can
no sievers 2014/08/29 01:30:44 Done.
+ AwDrawGLInfo draw_info;
+ draw_info.mode = static_cast<AwDrawGLInfo::Mode>(mode);
boliu 2014/08/28 23:15:05 draw_info.version = kAwDrawGLInfoVersion;
no sievers 2014/08/29 01:30:44 Done.
+ draw_info.is_layer = true;
boliu 2014/08/28 23:15:05 Not a big deal but most common case is is_layer =
no sievers 2014/08/29 01:30:44 Done.
+ draw_info.width = width;
+ draw_info.height = height;
+ draw_info.clip_left = 0;
+ draw_info.clip_top = 0;
+ draw_info.clip_bottom = height;
+ draw_info.clip_right = width;
+ draw_info.transform[0] = 1.0;
+ draw_info.transform[1] = 0.0;
+ draw_info.transform[2] = 0.0;
+ draw_info.transform[3] = 0.0;
+
+ draw_info.transform[4] = 0.0;
+ draw_info.transform[5] = 1.0;
+ draw_info.transform[6] = 0.0;
+ draw_info.transform[7] = 0.0;
+
+ draw_info.transform[8] = 0.0;
+ draw_info.transform[9] = 0.0;
+ draw_info.transform[10] = 1.0;
+ draw_info.transform[11] = 0.0;
+
+ draw_info.transform[12] = -scroll_x;
+ draw_info.transform[13] = -scroll_y;
+ draw_info.transform[14] = 0.0;
+ draw_info.transform[15] = 1.0;
+ fp(view, &draw_info, 0);
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698