diff options
author | Jonathan Dixon <joth@google.com> | 2012-12-26 11:55:54 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-12-26 11:55:54 -0800 |
commit | d72ea1e90563e7d3056eef86c3c7dd0c526b718f (patch) | |
tree | a248c720fe07ed9b6a7bf53bd1fec235e6e48591 /chromium/plat_support | |
parent | 8a8a1f9b5ea238437196790b89f4dbec78fda4e9 (diff) | |
download | webview-d72ea1e90563e7d3056eef86c3c7dd0c526b718f.tar.gz |
Revert "Connect up DrawSW interface"
This reverts commit 8a8a1f9b5ea238437196790b89f4dbec78fda4e9
The dependent patch hadn't yet rolled into Android tree - will re-land this one when it does.
Change-Id: If4241162a9c26997cdd6636b17cbd4182ac85096
Diffstat (limited to 'chromium/plat_support')
-rw-r--r-- | chromium/plat_support/draw_gl_functor.cpp | 6 | ||||
-rw-r--r-- | chromium/plat_support/graphics_utils.cpp | 111 | ||||
-rw-r--r-- | chromium/plat_support/jni_entry_point.cpp | 2 |
3 files changed, 3 insertions, 116 deletions
diff --git a/chromium/plat_support/draw_gl_functor.cpp b/chromium/plat_support/draw_gl_functor.cpp index c07e2db..e9474bd 100644 --- a/chromium/plat_support/draw_gl_functor.cpp +++ b/chromium/plat_support/draw_gl_functor.cpp @@ -112,11 +112,11 @@ void SetChromiumAwDrawGLFunction(JNIEnv*, jclass, jint draw_function) { const char kClassName[] = "com/android/webview/chromium/DrawGLFunctor"; const JNINativeMethod kJniMethods[] = { { "nativeCreateGLFunctor", "(I)I", - reinterpret_cast<void*>(CreateGLFunctor) }, + reinterpret_cast<void*>(CreateGLFunctor), }, { "nativeDestroyGLFunctor", "(I)V", - reinterpret_cast<void*>(DestroyGLFunctor) }, + reinterpret_cast<void*>(DestroyGLFunctor), }, { "nativeSetChromiumAwDrawGLFunction", "(I)V", - reinterpret_cast<void*>(SetChromiumAwDrawGLFunction) }, + reinterpret_cast<void*>(SetChromiumAwDrawGLFunction), }, }; } // namespace diff --git a/chromium/plat_support/graphics_utils.cpp b/chromium/plat_support/graphics_utils.cpp deleted file mode 100644 index c9e519b..0000000 --- a/chromium/plat_support/graphics_utils.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Provides a webviewchromium glue layer adapter from the internal Android -// graphics types into the types the chromium stack expects, and back. - -#define LOG_TAG "webviewchromium_plat_support" - -#include "android_webview/public/browser/draw_sw.h" - -#include <cstdlib> -#include <jni.h> -#include <utils/Log.h> -#include "GraphicsJNI.h" - -#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) - -namespace android { -namespace { - -struct PixelInfo : public AwPixelInfo { - PixelInfo(const SkBitmap* bitmap) - : bitmap_(bitmap) { - this->bitmap_->lockPixels(); - } - ~PixelInfo() { - this->bitmap_->unlockPixels(); - free(clip_region); - }; - const SkBitmap* bitmap_; -}; - -AwPixelInfo* GetPixels(JNIEnv* env, jobject java_canvas) { - SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, java_canvas); - if (!canvas) return NULL; - SkDevice* device = canvas->getDevice(); - if (!device) return NULL; - const SkBitmap* bitmap = &device->accessBitmap(true); - if (!bitmap->lockPixelsAreWritable()) return NULL; - - PixelInfo* pixels = new PixelInfo(bitmap); - pixels->config = bitmap->config(); - pixels->width = bitmap->width(); - pixels->height = bitmap->height(); - pixels->row_bytes = bitmap->rowBytes(); - pixels->pixels = bitmap->getPixels(); - const SkMatrix& matrix = canvas->getTotalMatrix(); - for (int i = 0; i < 9; i++) { - pixels->matrix[i] = matrix.get(i); - } - // TODO: getTotalClip() is now marked as deprecated, but the replacement, - // getClipDeviceBounds, does not return the exact region, just the bounds. - // Work out what we should use instead. - const SkRegion& region = canvas->getTotalClip(); - pixels->clip_region = NULL; - pixels->clip_region_size = region.writeToMemory(NULL); - if (pixels->clip_region_size) { - pixels->clip_region = malloc(pixels->clip_region_size); - size_t written = region.writeToMemory(pixels->clip_region); - ALOG_ASSERT(written == pixels->clip_region_size); - } - // WebViewClassic used the DrawFilter for its own purposes (e.g. disabling - // dithering when zooming/scrolling) so for now at least, just ignore any - // client supplied DrawFilter. - ALOGW_IF(canvas->getDrawFilter(), - "DrawFilter not supported in webviewchromium, will be ignored"); - return pixels; -} - -void ReleasePixels(AwPixelInfo* pixels) { - delete static_cast<PixelInfo*>(pixels); -} - -jint GetDrawSWFunctionTable(JNIEnv* env, jclass) { - static const AwDrawSWFunctionTable function_table = { - &GetPixels, - &ReleasePixels, - }; - return reinterpret_cast<jint>(&function_table); -} - -const char kClassName[] = "com/android/webview/chromium/GraphicsUtils"; -const JNINativeMethod kJniMethods[] = { - { "nativeGetDrawSWFunctionTable", "()I", - reinterpret_cast<void*>(GetDrawSWFunctionTable) }, -}; - -} // namespace - -void RegisterGraphicsUtils(JNIEnv* env) { - jclass clazz = env->FindClass(kClassName); - LOG_ALWAYS_FATAL_IF(!clazz, "Unable to find class '%s'", kClassName); - - int res = env->RegisterNatives(clazz, kJniMethods, NELEM(kJniMethods)); - LOG_ALWAYS_FATAL_IF(res < 0, "register native methods failed: res=%d", res); -} - -} // namespace android diff --git a/chromium/plat_support/jni_entry_point.cpp b/chromium/plat_support/jni_entry_point.cpp index 4771be1..6293fa5 100644 --- a/chromium/plat_support/jni_entry_point.cpp +++ b/chromium/plat_support/jni_entry_point.cpp @@ -22,7 +22,6 @@ namespace android { void RegisterDrawGLFunctor(JNIEnv* env); -void RegisterGraphicsUtils(JNIEnv* env); } // namespace android @@ -31,7 +30,6 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { jint ret = vm->AttachCurrentThread(&env, NULL); LOG_ALWAYS_FATAL_IF(ret != JNI_OK, "AttachCurrentThread failed"); android::RegisterDrawGLFunctor(env); - android::RegisterGraphicsUtils(env); return JNI_VERSION_1_4; } |