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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/filters/FEMorphology.cpp

Issue 1387573003: Pass SkiaImageFilterBuilder& to FilterEffect::createImageFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * Copyright (C) 2013 Google Inc. All rights reserved. 7 * Copyright (C) 2013 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 FloatRect FEMorphology::mapRect(const FloatRect& rect, bool) 89 FloatRect FEMorphology::mapRect(const FloatRect& rect, bool)
90 { 90 {
91 FloatRect result = rect; 91 FloatRect result = rect;
92 result.inflateX(filter()->applyHorizontalScale(m_radiusX)); 92 result.inflateX(filter()->applyHorizontalScale(m_radiusX));
93 result.inflateY(filter()->applyVerticalScale(m_radiusY)); 93 result.inflateY(filter()->applyVerticalScale(m_radiusY));
94 return result; 94 return result;
95 } 95 }
96 96
97 PassRefPtr<SkImageFilter> FEMorphology::createImageFilter(SkiaImageFilterBuilder * builder) 97 PassRefPtr<SkImageFilter> FEMorphology::createImageFilter(SkiaImageFilterBuilder & builder)
98 { 98 {
99 RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpa ce())); 99 RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpac e()));
100 SkScalar radiusX = SkFloatToScalar(filter()->applyHorizontalScale(m_radiusX) ); 100 SkScalar radiusX = SkFloatToScalar(filter()->applyHorizontalScale(m_radiusX) );
101 SkScalar radiusY = SkFloatToScalar(filter()->applyVerticalScale(m_radiusY)); 101 SkScalar radiusY = SkFloatToScalar(filter()->applyVerticalScale(m_radiusY));
102 SkImageFilter::CropRect rect = getCropRect(builder->cropOffset()); 102 SkImageFilter::CropRect rect = getCropRect(builder.cropOffset());
103 if (m_type == FEMORPHOLOGY_OPERATOR_DILATE) 103 if (m_type == FEMORPHOLOGY_OPERATOR_DILATE)
104 return adoptRef(SkDilateImageFilter::Create(radiusX, radiusY, input.get( ), &rect)); 104 return adoptRef(SkDilateImageFilter::Create(radiusX, radiusY, input.get( ), &rect));
105 return adoptRef(SkErodeImageFilter::Create(radiusX, radiusY, input.get(), &r ect)); 105 return adoptRef(SkErodeImageFilter::Create(radiusX, radiusY, input.get(), &r ect));
106 } 106 }
107 107
108 static TextStream& operator<<(TextStream& ts, const MorphologyOperatorType& type ) 108 static TextStream& operator<<(TextStream& ts, const MorphologyOperatorType& type )
109 { 109 {
110 switch (type) { 110 switch (type) {
111 case FEMORPHOLOGY_OPERATOR_UNKNOWN: 111 case FEMORPHOLOGY_OPERATOR_UNKNOWN:
112 ts << "UNKNOWN"; 112 ts << "UNKNOWN";
(...skipping 13 matching lines...) Expand all
126 writeIndent(ts, indent); 126 writeIndent(ts, indent);
127 ts << "[feMorphology"; 127 ts << "[feMorphology";
128 FilterEffect::externalRepresentation(ts); 128 FilterEffect::externalRepresentation(ts);
129 ts << " operator=\"" << morphologyOperator() << "\" " 129 ts << " operator=\"" << morphologyOperator() << "\" "
130 << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n"; 130 << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n";
131 inputEffect(0)->externalRepresentation(ts, indent + 1); 131 inputEffect(0)->externalRepresentation(ts, indent + 1);
132 return ts; 132 return ts;
133 } 133 }
134 134
135 } // namespace blink 135 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698