Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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 <jni.h> | |
| 6 | |
| 7 #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
| |
| 8 | |
| 9 extern "C" { | |
| 10 | |
| 11 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | |
| 12 return JNI_VERSION_1_4; | |
| 13 } | |
| 14 | |
| 15 // This code goes into its own dynamic library, so we cannot depend on | |
| 16 // any other components like base. | |
| 17 JNIEXPORT void JNICALL | |
| 18 Java_org_chromium_android_1webview_shell_DrawGL_nativeDrawGL( | |
| 19 JNIEnv*, | |
| 20 jclass, | |
| 21 jlong draw_gl, | |
| 22 jlong view, | |
| 23 jint width, | |
| 24 jint height, | |
| 25 jint scroll_x, | |
| 26 jint scroll_y, | |
| 27 jint mode) { | |
| 28 void (*fp)(long, AwDrawGLInfo*, void*) = | |
| 29 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.
| |
| 30 AwDrawGLInfo draw_info; | |
| 31 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.
| |
| 32 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.
| |
| 33 draw_info.width = width; | |
| 34 draw_info.height = height; | |
| 35 draw_info.clip_left = 0; | |
| 36 draw_info.clip_top = 0; | |
| 37 draw_info.clip_bottom = height; | |
| 38 draw_info.clip_right = width; | |
| 39 draw_info.transform[0] = 1.0; | |
| 40 draw_info.transform[1] = 0.0; | |
| 41 draw_info.transform[2] = 0.0; | |
| 42 draw_info.transform[3] = 0.0; | |
| 43 | |
| 44 draw_info.transform[4] = 0.0; | |
| 45 draw_info.transform[5] = 1.0; | |
| 46 draw_info.transform[6] = 0.0; | |
| 47 draw_info.transform[7] = 0.0; | |
| 48 | |
| 49 draw_info.transform[8] = 0.0; | |
| 50 draw_info.transform[9] = 0.0; | |
| 51 draw_info.transform[10] = 1.0; | |
| 52 draw_info.transform[11] = 0.0; | |
| 53 | |
| 54 draw_info.transform[12] = -scroll_x; | |
| 55 draw_info.transform[13] = -scroll_y; | |
| 56 draw_info.transform[14] = 0.0; | |
| 57 draw_info.transform[15] = 1.0; | |
| 58 fp(view, &draw_info, 0); | |
| 59 } | |
| 60 | |
| 61 } | |
| OLD | NEW |