Merge "Fix issue with drawColor(color, Mode.Clear)"
This commit is contained in:
@@ -990,12 +990,26 @@ void OpenGLRenderer::setupDrawColorFilter() {
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLRenderer::accountForClear(SkXfermode::Mode mode) {
|
||||
if (mColorSet && mode == SkXfermode::kClear_Mode) {
|
||||
mColorA = 1.0f;
|
||||
mColorR = mColorG = mColorB = 0.0f;
|
||||
mSetShaderColor = mDescription.setAlpha8Color(mColorR, mColorG, mColorB, mColorA);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLRenderer::setupDrawBlending(SkXfermode::Mode mode, bool swapSrcDst) {
|
||||
// When the blending mode is kClear_Mode, we need to use a modulate color
|
||||
// argb=1,0,0,0
|
||||
accountForClear(mode);
|
||||
chooseBlending((mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()), mode,
|
||||
mDescription, swapSrcDst);
|
||||
}
|
||||
|
||||
void OpenGLRenderer::setupDrawBlending(bool blend, SkXfermode::Mode mode, bool swapSrcDst) {
|
||||
// When the blending mode is kClear_Mode, we need to use a modulate color
|
||||
// argb=1,0,0,0
|
||||
accountForClear(mode);
|
||||
chooseBlending(blend || (mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()), mode,
|
||||
mDescription, swapSrcDst);
|
||||
}
|
||||
|
||||
@@ -478,6 +478,7 @@ private:
|
||||
void setupDrawAALine(GLvoid* vertices, GLvoid* distanceCoords, GLvoid* lengthCoords,
|
||||
float strokeWidth);
|
||||
void finishDrawTexture();
|
||||
void accountForClear(SkXfermode::Mode mode);
|
||||
|
||||
void drawRegionRects(const Region& region);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ClearActivity extends Activity {
|
||||
mClearPaint = new Paint();
|
||||
mClearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||
mClearPaint.setAntiAlias(true);
|
||||
mClearPaint.setColor(0xff00ff00);
|
||||
mClearPaint.setColor(0x0000ff00);
|
||||
mClearPaint.setStrokeWidth(15.0f);
|
||||
mClearPaint.setStyle(Paint.Style.FILL);
|
||||
mClearPaint.setTextSize(32.0f);
|
||||
|
||||
Reference in New Issue
Block a user