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

Unified Diff: Source/core/svg/graphics/SVGImage.cpp

Issue 868743002: Use SkXfermode::Mode in code related to Image. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to ToT Created 5 years, 11 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
« no previous file with comments | « Source/core/svg/graphics/SVGImage.h ('k') | Source/core/svg/graphics/SVGImageForContainer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/graphics/SVGImage.cpp
diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp
index dd2aa6c91dbb437b74bbef60baa814127c346935..ff5b6279222c5758590ede2015b45306dc4a1b7f 100644
--- a/Source/core/svg/graphics/SVGImage.cpp
+++ b/Source/core/svg/graphics/SVGImage.cpp
@@ -185,7 +185,7 @@ IntSize SVGImage::containerSize() const
}
void SVGImage::drawForContainer(GraphicsContext* context, const FloatSize containerSize, float zoom, const FloatRect& dstRect,
- const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode)
+ const FloatRect& srcRect, SkXfermode::Mode compositeOp)
{
if (!m_page)
return;
@@ -204,7 +204,7 @@ void SVGImage::drawForContainer(GraphicsContext* context, const FloatSize contai
adjustedSrcSize.scale(roundedContainerSize.width() / containerSize.width(), roundedContainerSize.height() / containerSize.height());
scaledSrc.setSize(adjustedSrcSize);
- draw(context, dstRect, scaledSrc, compositeOp, blendMode, DoNotRespectImageOrientation);
+ draw(context, dstRect, scaledSrc, compositeOp, DoNotRespectImageOrientation);
}
PassRefPtr<NativeImageSkia> SVGImage::nativeImageForCurrentFrame()
@@ -216,14 +216,14 @@ PassRefPtr<NativeImageSkia> SVGImage::nativeImageForCurrentFrame()
if (!buffer)
return nullptr;
- drawForContainer(buffer->context(), size(), 1, rect(), rect(), CompositeSourceOver, blink::WebBlendModeNormal);
+ drawForContainer(buffer->context(), size(), 1, rect(), rect(), SkXfermode::kSrcOver_Mode);
return NativeImageSkia::create(buffer->bitmap());
}
void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize,
float zoom, const FloatRect& srcRect, const FloatSize& tileScale, const FloatPoint& phase,
- CompositeOperator compositeOp, const FloatRect& dstRect, blink::WebBlendMode blendMode,
+ SkXfermode::Mode compositeOp, const FloatRect& dstRect,
const IntSize& repeatSpacing)
{
// Tile adjusted for scaling/stretch.
@@ -248,7 +248,7 @@ void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
OwnPtr<FloatClipRecorder> clipRecorder;
if (tile != spacedTile)
clipRecorder = adoptPtr(new FloatClipRecorder(recordingContext, displayItemClient(), PaintPhaseForeground, tile));
- drawForContainer(&recordingContext, containerSize, zoom, tile, srcRect, CompositeSourceOver, blink::WebBlendModeNormal);
+ drawForContainer(&recordingContext, containerSize, zoom, tile, srcRect, SkXfermode::kSrcOver_Mode);
}
if (displayItemList)
@@ -264,12 +264,12 @@ void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
SkPaint paint;
paint.setShader(patternShader.get());
- paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode));
+ paint.setXfermodeMode(compositeOp);
paint.setColorFilter(context->colorFilter());
context->drawRect(dstRect, paint);
}
-void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode, RespectImageOrientationEnum)
+void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, SkXfermode::Mode compositeOp, RespectImageOrientationEnum)
{
if (!m_page)
return;
@@ -285,11 +285,11 @@ void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
{
ClipRecorder clipRecorder(displayItemClient(), &recordingContext, DisplayItem::ClipNodeImage, enclosingIntRect(dstRect));
- bool hasCompositing = compositeOp != CompositeSourceOver || blendMode != blink::WebBlendModeNormal;
+ bool hasCompositing = compositeOp != SkXfermode::kSrcOver_Mode;
OwnPtr<CompositingRecorder> compositingRecorder;
if (hasCompositing || opacity < 1) {
- CompositeOperator postCompositeOp = hasCompositing ? CompositeSourceOver : compositeOp;
- compositingRecorder = adoptPtr(new CompositingRecorder(&recordingContext, displayItemClient(), compositeOp, blendMode, opacity, postCompositeOp));
+ SkXfermode::Mode postCompositeOp = hasCompositing ? SkXfermode::kSrcOver_Mode : compositeOp;
+ compositingRecorder = adoptPtr(new CompositingRecorder(&recordingContext, displayItemClient(), compositeOperatorFromSkia(compositeOp), blendModeFromSkia(compositeOp), opacity, compositeOperatorFromSkia(postCompositeOp)));
}
// We can only draw the entire frame, clipped to the rect we want. So compute where the top left
« no previous file with comments | « Source/core/svg/graphics/SVGImage.h ('k') | Source/core/svg/graphics/SVGImageForContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698