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

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

Merge "Fix possible rendering issue when drawing a path."

parents b52907f6 1041aded
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class GradientDrawable extends Drawable {
    private boolean mRectIsDirty;   // internal state
    private boolean mMutated;
    private Path mRingPath;
    private boolean mPathIsDirty;
    private boolean mPathIsDirty = true;

    /**
     * Controls how the gradient is oriented relative to the drawable's bounds
@@ -179,6 +179,7 @@ public class GradientDrawable extends Drawable {
     */
    public void setCornerRadii(float[] radii) {
        mGradientState.setCornerRadii(radii);
        mPathIsDirty = true;
    }
    
    /**
@@ -187,6 +188,7 @@ public class GradientDrawable extends Drawable {
     */
    public void setCornerRadius(float radius) {
        mGradientState.setCornerRadius(radius);
        mPathIsDirty = true;
    }
    
    /**
@@ -216,10 +218,12 @@ public class GradientDrawable extends Drawable {
    
    public void setSize(int width, int height) {
        mGradientState.setSize(width, height);
        mPathIsDirty = true;
    }
    
    public void setShape(int shape) {
        mRingPath = null;
        mPathIsDirty = true;
        mGradientState.setShape(shape);
    }

@@ -312,8 +316,11 @@ public class GradientDrawable extends Drawable {
        switch (st.mShape) {
            case RECTANGLE:
                if (st.mRadiusArray != null) {
                    if (mPathIsDirty || mRectIsDirty) {
                        mPath.reset();
                        mPath.addRoundRect(mRect, st.mRadiusArray, Path.Direction.CW);
                        mPathIsDirty = mRectIsDirty = false;
                    }
                    canvas.drawPath(mPath, mFillPaint);
                    if (haveStroke) {
                        canvas.drawPath(mPath, mStrokePaint);
+7 −1
Original line number Diff line number Diff line
@@ -173,9 +173,15 @@ PathTexture* PathCache::addTexture(const PathCacheEntry& entry,
    bitmap.allocPixels();
    bitmap.eraseColor(0);

    SkPaint pathPaint(*paint);
    if (!pathPaint.getXfermode()) {
        SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrc_Mode);
        pathPaint.setXfermode(mode)->safeUnref();
    }

    SkCanvas canvas(bitmap);
    canvas.translate(-bounds.fLeft + offset, -bounds.fTop + offset);
    canvas.drawPath(*path, *paint);
    canvas.drawPath(*path, pathPaint);

    generateTexture(bitmap, texture);