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

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

Merge "Purge Skia objects from GL caches as needed."

parents e3aa6aa7 a2341a9f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -254,7 +254,9 @@ static jobject Bitmap_copy(JNIEnv* env, jobject, const SkBitmap* src,

static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) {
#ifdef USE_OPENGL_RENDERER
    if (android::uirenderer::Caches::hasInstance()) {
        android::uirenderer::Caches::getInstance().textureCache.remove(bitmap);
    }
#endif
    delete bitmap;
}
+7 −0
Original line number Diff line number Diff line
@@ -26,12 +26,19 @@

#include "SkPath.h"

#include <Caches.h>

namespace android {

class SkPathGlue {
public:

    static void finalizer(JNIEnv* env, jobject clazz, SkPath* obj) {
#ifdef USE_OPENGL_RENDERER
        if (android::uirenderer::Caches::hasInstance()) {
            android::uirenderer::Caches::getInstance().pathCache.remove(obj);
        }
#endif
        delete obj;
    }

+6 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include "SkXfermode.h"

#include <SkiaShader.h>
#include <Caches.h>

using namespace android::uirenderer;

@@ -52,6 +53,11 @@ static int Color_HSVToColor(JNIEnv* env, jobject, int alpha, jfloatArray hsvArra

static void Shader_destructor(JNIEnv* env, jobject o, SkShader* shader, SkiaShader* skiaShader)
{
#ifdef USE_OPENGL_RENDERER
    if (android::uirenderer::Caches::hasInstance()) {
        android::uirenderer::Caches::getInstance().gradientCache.remove(shader);
    }
#endif
    delete skiaShader;
    shader->safeUnref();
}
+5 −0
Original line number Diff line number Diff line
@@ -38,6 +38,11 @@ public:
        return *instance;
    }

    static bool hasInstance() {
        Mutex::Autolock _l(sLock);
        return sInstance != 0;
    }
    
protected:
    ~Singleton() { };
    Singleton() { };
+3 −1
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
#ifndef ANDROID_UI_CACHES_H
#define ANDROID_UI_CACHES_H

#ifndef LOG_TAG
    #define LOG_TAG "OpenGLRenderer"
#endif

#include <utils/Singleton.h>

Loading