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

Unified Diff: Source/core/platform/graphics/GraphicsContext.cpp

Issue 23102018: Refactoring DrawLooper so that it can apply shadow effects as skia image filters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Adding missing adoptRefs Created 7 years, 4 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/GraphicsContext.cpp
diff --git a/Source/core/platform/graphics/GraphicsContext.cpp b/Source/core/platform/graphics/GraphicsContext.cpp
index 60a7f88e0dcf4b7b44412e4932b1afca4495c65c..6b98d233b9d2485d71b3557974b0c57521524814 100644
--- a/Source/core/platform/graphics/GraphicsContext.cpp
+++ b/Source/core/platform/graphics/GraphicsContext.cpp
@@ -282,18 +282,18 @@ void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color
return;
}
- DrawLooper drawLooper;
- drawLooper.addShadow(offset, blur, color, shadowTransformMode, shadowAlphaMode);
- drawLooper.addUnmodifiedContent();
- setDrawLooper(drawLooper);
+ RefPtr<DrawLooper> drawLooper = adoptRef(new DrawLooper);
+ drawLooper->addShadow(offset, blur, color, shadowTransformMode, shadowAlphaMode);
+ drawLooper->addUnmodifiedContent();
+ setDrawLooper(drawLooper.release());
}
-void GraphicsContext::setDrawLooper(const DrawLooper& drawLooper)
+void GraphicsContext::setDrawLooper(PassRefPtr<DrawLooper> drawLooper)
{
if (paintingDisabled())
return;
- m_state->m_looper = drawLooper.skDrawLooper();
+ m_state->m_looper = drawLooper;
}
void GraphicsContext::clearDrawLooper()
@@ -638,8 +638,8 @@ void GraphicsContext::drawInnerShadow(const RoundedRect& rect, const Color& shad
clip(rect.rect());
}
- DrawLooper drawLooper;
- drawLooper.addShadow(shadowOffset, shadowBlur, shadowColor,
+ RefPtr<DrawLooper> drawLooper = adoptRef(new DrawLooper);
+ drawLooper->addShadow(shadowOffset, shadowBlur, shadowColor,
DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresAlpha);
setDrawLooper(drawLooper);
fillRectWithRoundedHole(outerRect, roundedHole, fillColor);
@@ -1718,7 +1718,7 @@ void GraphicsContext::setupPaintCommon(SkPaint* paint) const
paint->setAntiAlias(m_state->m_shouldAntialias);
paint->setXfermodeMode(m_state->m_xferMode);
- paint->setLooper(m_state->m_looper.get());
+ paint->setLooper(m_state->m_looper ? m_state->m_looper->skDrawLooper() : 0);
}
void GraphicsContext::drawOuterPath(const SkPath& path, SkPaint& paint, int width)
« no previous file with comments | « Source/core/platform/graphics/GraphicsContext.h ('k') | Source/core/platform/graphics/GraphicsContextState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698