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

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

Merge "Add rounded rects and circles support to OpenGLRenderer." into honeycomb

parents 818a7bbf 01d58e43
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -635,9 +635,13 @@ class GLES20Canvas extends HardwareCanvas {

    @Override
    public void drawCircle(float cx, float cy, float radius, Paint paint) {
        throw new UnsupportedOperationException();
        boolean hasModifier = setupModifiers(paint);
        nDrawCircle(mRenderer, cx, cy, radius, paint.mNativePaint);
        if (hasModifier) nResetModifiers(mRenderer);        
    }

    private native void nDrawCircle(int renderer, float cx, float cy, float radius, int paint);

    @Override
    public void drawColor(int color) {
        drawColor(color, PorterDuff.Mode.SRC_OVER);
@@ -773,9 +777,15 @@ class GLES20Canvas extends HardwareCanvas {

    @Override
    public void drawRoundRect(RectF rect, float rx, float ry, Paint paint) {
        // TODO: Implement
        boolean hasModifier = setupModifiers(paint);
        nDrawRoundRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom,
                rx, ry, paint.mNativePaint);
        if (hasModifier) nResetModifiers(mRenderer);        
    }

    private native void nDrawRoundRect(int renderer, float left, float top,
            float right, float bottom, float rx, float y, int paint);

    @Override
    public void drawText(char[] text, int index, int count, float x, float y, Paint paint) {
        if ((index | count | (index + count) | (text.length - index - count)) < 0) {
+13 −0
Original line number Diff line number Diff line
@@ -299,6 +299,17 @@ static void android_view_GLES20Canvas_drawRect(JNIEnv* env, jobject canvas,
    renderer->drawRect(left, top, right, bottom, paint);
}

static void android_view_GLES20Canvas_drawRoundRect(JNIEnv* env, jobject canvas,
        OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom,
        jfloat rx, jfloat ry, SkPaint* paint) {
    renderer->drawRoundRect(left, top, right, bottom, rx, ry, paint);
}

static void android_view_GLES20Canvas_drawCircle(JNIEnv* env, jobject canvas,
        OpenGLRenderer* renderer, jfloat x, jfloat y, jfloat radius, SkPaint* paint) {
    renderer->drawCircle(x, y, radius, paint);
}

static void android_view_GLES20Canvas_drawRects(JNIEnv* env, jobject canvas,
        OpenGLRenderer* renderer, SkRegion* region, SkPaint* paint) {
    SkRegion::Iterator it(*region);
@@ -570,6 +581,8 @@ static JNINativeMethod gMethods[] = {
    { "nDrawColor",         "(III)V",          (void*) android_view_GLES20Canvas_drawColor },
    { "nDrawRect",          "(IFFFFI)V",       (void*) android_view_GLES20Canvas_drawRect },
    { "nDrawRects",         "(III)V",          (void*) android_view_GLES20Canvas_drawRects },
    { "nDrawRoundRect",     "(IFFFFFFI)V",     (void*) android_view_GLES20Canvas_drawRoundRect },
    { "nDrawCircle",        "(IFFFI)V",        (void*) android_view_GLES20Canvas_drawCircle },
    { "nDrawPath",          "(III)V",          (void*) android_view_GLES20Canvas_drawPath },
    { "nDrawLines",         "(I[FIII)V",       (void*) android_view_GLES20Canvas_drawLines },

+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ ifeq ($(USE_OPENGL_RENDERER),true)
		Program.cpp \
		ProgramCache.cpp \
		ResourceCache.cpp \
		ShapeCache.cpp \
		SkiaColorFilter.cpp \
		SkiaShader.cpp \
		TextureCache.cpp \
+4 −0
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@ void Caches::dumpMemoryUsage() {
    LOGD("  LayerCache           %8d / %8d", layerCache.getSize(), layerCache.getMaxSize());
    LOGD("  GradientCache        %8d / %8d", gradientCache.getSize(), gradientCache.getMaxSize());
    LOGD("  PathCache            %8d / %8d", pathCache.getSize(), pathCache.getMaxSize());
    LOGD("  CircleShapeCache     %8d / %8d",
            circleShapeCache.getSize(), circleShapeCache.getMaxSize());
    LOGD("  RoundRectShapeCache  %8d / %8d",
            roundRectShapeCache.getSize(), roundRectShapeCache.getMaxSize());
    LOGD("  TextDropShadowCache  %8d / %8d", dropShadowCache.getSize(),
            dropShadowCache.getMaxSize());
    for (uint32_t i = 0; i < fontRenderer.getFontRendererCount(); i++) {
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include "PatchCache.h"
#include "ProgramCache.h"
#include "PathCache.h"
#include "ShapeCache.h"
#include "TextDropShadowCache.h"
#include "FboCache.h"
#include "ResourceCache.h"
@@ -159,6 +160,8 @@ public:
    GradientCache gradientCache;
    ProgramCache programCache;
    PathCache pathCache;
    RoundRectShapeCache roundRectShapeCache;
    CircleShapeCache circleShapeCache;
    PatchCache patchCache;
    TextDropShadowCache dropShadowCache;
    FboCache fboCache;
Loading