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

Unified Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 340613005: Add scale param to SkAlphaThresholdFilter. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Change |scale| to |transform| Created 6 years, 5 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 | « include/effects/SkAlphaThresholdFilter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkAlphaThresholdFilter.cpp
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index 6fcd2b4351e238b51ffc5588f58ad79a5c38c163..af3887359a4e6173e1dc69d4a556fc8599ba0eaa 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -13,7 +13,8 @@
class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
public:
- SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold);
+ SkAlphaThresholdFilterImpl(const SkRegion& region, const SkMatrix& transform,
+ SkScalar innerThreshold, SkScalar outerThreshold);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl)
@@ -30,6 +31,7 @@ protected:
private:
SkRegion fRegion;
+ SkMatrix fTransform;
SkScalar fInnerThreshold;
SkScalar fOuterThreshold;
typedef SkImageFilter INHERITED;
@@ -38,7 +40,16 @@ private:
SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
SkScalar innerThreshold,
SkScalar outerThreshold) {
- return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outerThreshold));
+ SkMatrix transform;
+ transform.reset();
+ return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, transform, innerThreshold, outerThreshold));
+}
+
+SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
+ const SkMatrix& transform,
Stephen White 2014/07/11 20:15:24 Is there a reason this needs to be a separate matr
+ SkScalar innerThreshold,
+ SkScalar outerThreshold) {
+ return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, transform, innerThreshold, outerThreshold));
}
#if SK_SUPPORT_GPU
@@ -233,16 +244,19 @@ void AlphaThresholdEffect::getConstantColorComponents(GrColor* color, uint32_t*
SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer)
: INHERITED(1, buffer) {
+ buffer.readMatrix(&fTransform);
fInnerThreshold = buffer.readScalar();
fOuterThreshold = buffer.readScalar();
buffer.readRegion(&fRegion);
}
SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
+ const SkMatrix& transform,
SkScalar innerThreshold,
SkScalar outerThreshold)
: INHERITED(0)
, fRegion(region)
+ , fTransform(transform)
, fInnerThreshold(innerThreshold)
, fOuterThreshold(outerThreshold) {
}
@@ -278,6 +292,7 @@ bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffectRef** effect, GrTexture* te
SkMatrix old_matrix = context->getMatrix();
context->setMatrix(in_matrix);
+ context->concatMatrix(fTransform);
while (!iter.done()) {
SkRect rect = SkRect::Make(iter.rect());
@@ -298,6 +313,7 @@ bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffectRef** effect, GrTexture* te
void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
+ buffer.writeMatrix(fTransform);
buffer.writeScalar(fInnerThreshold);
buffer.writeScalar(fOuterThreshold);
buffer.writeRegion(fRegion);
« no previous file with comments | « include/effects/SkAlphaThresholdFilter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698