aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-11 20:19:15 +0000
committerGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-11 20:19:15 +0000
commit8cef67aada2e8776a6741dce6211dc77fc9272df (patch)
treee5bd0e406d8e2f39c033a6e52cbdd0f071c8a866
parent3ab43d5c5b4d77f46dd0266618f92e5fefce2021 (diff)
Fixing SkDeferredCanvas to not consider paint as opaque when xfermode source coeff depends
on destination pixel value TEST=DeferredCanvas unit test BUG=http://code.google.com/p/chromium/issues/detail?id=154748 git-svn-id: http://skia.googlecode.com/svn/trunk@5907 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/utils/SkDeferredCanvas.cpp4
-rw-r--r--tests/DeferredCanvasTest.cpp8
2 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index c3de393290..13b8d282c6 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -93,6 +93,10 @@ bool isPaintOpaque(const SkPaint* paint,
SkXfermode::Coeff srcCoeff, dstCoeff;
if (SkXfermode::AsCoeff(paint->getXfermode(), &srcCoeff, &dstCoeff)){
+ if (SkXfermode::kDA_Coeff == srcCoeff || SkXfermode::kDC_Coeff == srcCoeff ||
+ SkXfermode::kIDA_Coeff == srcCoeff || SkXfermode::kIDC_Coeff == srcCoeff) {
+ return false;
+ }
switch (dstCoeff) {
case SkXfermode::kZero_Coeff:
return true;
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp
index f0b4ad2279..80747a47aa 100644
--- a/tests/DeferredCanvasTest.cpp
+++ b/tests/DeferredCanvasTest.cpp
@@ -101,6 +101,14 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
canvas.drawRect(fullRect, paint);
REPORTER_ASSERT(reporter, canvas.isFreshFrame());
}
+ {
+ SkPaint paint;
+ paint.setStyle( SkPaint::kFill_Style );
+ paint.setAlpha( 255 );
+ paint.setXfermodeMode(SkXfermode::kSrcIn_Mode);
+ canvas.drawRect(fullRect, paint);
+ REPORTER_ASSERT(reporter, !canvas.isFreshFrame());
+ }
{
SkPaint paint;
paint.setStyle( SkPaint::kFill_Style );