Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e57a981f authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Remove unused code"

parents 0bd30801 dafbf247
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ LOCAL_SRC_FILES:= \
	android_server_Watchdog.cpp \
	android_ddm_DdmHandleNativeHeap.cpp \
	com_android_internal_os_ZygoteInit.cpp \
	com_android_internal_graphics_NativeUtils.cpp \
	android_backup_BackupDataInput.cpp \
	android_backup_BackupDataOutput.cpp \
	android_backup_FileBackupHelperBase.cpp \
+0 −1
Original line number Diff line number Diff line
@@ -115,7 +115,6 @@ extern int register_android_graphics_Region(JNIEnv* env);
extern int register_android_graphics_SurfaceTexture(JNIEnv* env);
extern int register_android_graphics_Xfermode(JNIEnv* env);
extern int register_android_graphics_PixelFormat(JNIEnv* env);
extern int register_com_android_internal_graphics_NativeUtils(JNIEnv *env);
extern int register_android_view_Display(JNIEnv* env);
extern int register_android_view_GLES20Canvas(JNIEnv* env);
extern int register_android_view_Surface(JNIEnv* env);
+0 −60
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 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.
 */

#define LOG_TAG "AWT"

#include "jni.h"
#include "JNIHelp.h"
#include "GraphicsJNI.h"
#include <android_runtime/AndroidRuntime.h>

#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkPicture.h"
#include "SkTemplates.h"

namespace android
{

static jboolean scrollRect(JNIEnv* env, jobject graphics2D, jobject canvas, jobject rect, int dx, int dy) {
    if (canvas == NULL) {
        jniThrowNullPointerException(env, NULL);
        return false;
    }

    SkIRect src, *srcPtr = NULL;
    if (NULL != rect) {
        GraphicsJNI::jrect_to_irect(env, rect, &src);
        srcPtr = &src;
    }
    SkCanvas* c = GraphicsJNI::getNativeCanvas(env, canvas);
    const SkBitmap& bitmap = c->getDevice()->accessBitmap(true);
    return bitmap.scrollRect(srcPtr, dx, dy, NULL);
}

static JNINativeMethod method_table[] = {
    { "nativeScrollRect",
      "(Landroid/graphics/Canvas;Landroid/graphics/Rect;II)Z",
      (void*)scrollRect}
};

int register_com_android_internal_graphics_NativeUtils(JNIEnv *env) {
    return AndroidRuntime::registerNativeMethods(
        env, "com/android/internal/graphics/NativeUtils",
        method_table, NELEM(method_table));
}

}
+0 −40
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 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.
 */

package com.android.internal.graphics;

import android.graphics.Canvas;
import android.graphics.Rect;

public final class NativeUtils {
    /**
     * This class is uninstantiable.
     */
    private NativeUtils() {
        // This space intentionally left blank.
    }

    /**
     * Scroll a rectangular portion of a canvas.
     * 
     * @param canvas the canvas to manipulate
     * @param src the source rectangle
     * @param dx horizontal offset
     * @param dy vertical offset
     */
    public static native boolean nativeScrollRect(Canvas canvas, Rect src,
            int dx, int dy);
}