Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1193)

Unified Diff: Source/core/platform/graphics/skia/NativeImageSkia.cpp

Issue 23947005: Implement CSS luminance masking using skia SkLumaMaskXfermode class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/graphics/skia/NativeImageSkia.cpp
diff --git a/Source/core/platform/graphics/skia/NativeImageSkia.cpp b/Source/core/platform/graphics/skia/NativeImageSkia.cpp
index f43c4833b9eaef96689084b5619bda1d67bd30f7..9f774f1ec916ac34131d01dd9217fcea9c0313e5 100644
--- a/Source/core/platform/graphics/skia/NativeImageSkia.cpp
+++ b/Source/core/platform/graphics/skia/NativeImageSkia.cpp
@@ -45,6 +45,7 @@
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkScalar.h"
#include "third_party/skia/include/core/SkShader.h"
+#include "third_party/skia/include/effects/SkLumaXfermode.h"
#include <limits>
#include <math.h>
@@ -324,7 +325,11 @@ void NativeImageSkia::draw(GraphicsContext* context, const SkRect& srcRect, cons
{
TRACE_EVENT0("skia", "NativeImageSkia::draw");
SkPaint paint;
- paint.setXfermode(compOp.get());
+ if (context->drawLuminanceMask()) {
eseidel 2013/09/19 15:10:37 I believe blink style says {} are avoided when the
+ paint.setXfermode(SkLumaMaskXfermode::Create(SkXfermode::kSrcOver_Mode));
+ } else {
+ paint.setXfermode(compOp.get());
+ }
paint.setAlpha(context->getNormalizedAlpha());
paint.setLooper(context->drawLooper());
// only antialias if we're rotated or skewed
@@ -461,7 +466,11 @@ void NativeImageSkia::drawPattern(
SkPaint paint;
paint.setShader(shader.get());
- paint.setXfermode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode).get());
+ if (context->drawLuminanceMask()) {
+ paint.setXfermode(SkLumaMaskXfermode::Create(SkXfermode::kSrcOver_Mode));
+ } else {
+ paint.setXfermode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode).get());
+ }
paint.setFilterBitmap(resampling == LinearResampling);
if (useBicubicFilter)
« no previous file with comments | « Source/core/platform/graphics/GraphicsContextState.h ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698