rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #include "SkSweepGradient.h" |
| 10 | |
mtklein | cc695fe | 2014-12-10 10:29:19 -0800 | [diff] [blame] | 11 | static SkMatrix translate(SkScalar dx, SkScalar dy) { |
| 12 | SkMatrix matrix; |
| 13 | matrix.setTranslate(dx, dy); |
| 14 | return matrix; |
| 15 | } |
| 16 | |
reed | addf2ed | 2014-08-11 08:28:24 -0700 | [diff] [blame] | 17 | SkSweepGradient::SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor& desc) |
mtklein | cc695fe | 2014-12-10 10:29:19 -0800 | [diff] [blame] | 18 | : SkGradientShaderBase(desc, translate(-cx, -cy)) |
reed@google.com | 3d3a860 | 2013-05-24 14:58:44 +0000 | [diff] [blame] | 19 | , fCenter(SkPoint::Make(cx, cy)) |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 20 | { |
reed@google.com | 437d6eb | 2013-05-23 19:03:05 +0000 | [diff] [blame] | 21 | // overwrite the tilemode to a canonical value (since sweep ignores it) |
| 22 | fTileMode = SkShader::kClamp_TileMode; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 23 | } |
| 24 | |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 25 | SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { |
| 26 | if (info) { |
| 27 | commonAsAGradient(info); |
| 28 | info->fPoint[0] = fCenter; |
| 29 | } |
| 30 | return kSweep_GradientType; |
| 31 | } |
| 32 | |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 33 | SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) { |
| 34 | DescriptorScope desc; |
| 35 | if (!desc.unflatten(buffer)) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 36 | return nullptr; |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 37 | } |
| 38 | const SkPoint center = buffer.readPoint(); |
| 39 | return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, desc.fPos, |
| 40 | desc.fCount, desc.fGradFlags, desc.fLocalMatrix); |
| 41 | } |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 42 | |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 43 | void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 44 | this->INHERITED::flatten(buffer); |
| 45 | buffer.writePoint(fCenter); |
| 46 | } |
| 47 | |
reed | 773ceda | 2016-03-03 18:18:25 -0800 | [diff] [blame^] | 48 | size_t SkSweepGradient::onContextSize(const ContextRec&) const { |
| 49 | return SkAlign16(sizeof(SweepGradientContext)); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 50 | } |
| 51 | |
commit-bot@chromium.org | ce56d96 | 2014-05-05 18:39:18 +0000 | [diff] [blame] | 52 | SkShader::Context* SkSweepGradient::onCreateContext(const ContextRec& rec, void* storage) const { |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 53 | return new (storage) SweepGradientContext(*this, rec); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | SkSweepGradient::SweepGradientContext::SweepGradientContext( |
commit-bot@chromium.org | e901b6d | 2014-05-01 19:31:31 +0000 | [diff] [blame] | 57 | const SkSweepGradient& shader, const ContextRec& rec) |
| 58 | : INHERITED(shader, rec) {} |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 59 | |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 60 | // returns angle in a circle [0..2PI) -> [0..255] |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 61 | static unsigned SkATan2_255(float y, float x) { |
| 62 | // static const float g255Over2PI = 255 / (2 * SK_ScalarPI); |
| 63 | static const float g255Over2PI = 40.584510488433314f; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 64 | |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 65 | float result = sk_float_atan2(y, x); |
robertphillips | 1d265ca | 2015-12-07 09:54:02 -0800 | [diff] [blame] | 66 | if (!SkScalarIsFinite(result)) { |
| 67 | return 0; |
| 68 | } |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 69 | if (result < 0) { |
| 70 | result += 2 * SK_ScalarPI; |
| 71 | } |
| 72 | SkASSERT(result >= 0); |
| 73 | // since our value is always >= 0, we can cast to int, which is faster than |
| 74 | // calling floorf() |
| 75 | int ir = (int)(result * g255Over2PI); |
| 76 | SkASSERT(ir >= 0 && ir <= 255); |
| 77 | return ir; |
| 78 | } |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 79 | |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 80 | void SkSweepGradient::SweepGradientContext::shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, |
| 81 | int count) { |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 82 | SkMatrix::MapXYProc proc = fDstToIndexProc; |
| 83 | const SkMatrix& matrix = fDstToIndex; |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 84 | const SkPMColor* SK_RESTRICT cache = fCache->getCache32(); |
reed@google.com | 6004029 | 2013-02-04 18:21:23 +0000 | [diff] [blame] | 85 | int toggle = init_dither_toggle(x, y); |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 86 | SkPoint srcPt; |
| 87 | |
| 88 | if (fDstToIndexClass != kPerspective_MatrixClass) { |
| 89 | proc(matrix, SkIntToScalar(x) + SK_ScalarHalf, |
| 90 | SkIntToScalar(y) + SK_ScalarHalf, &srcPt); |
| 91 | SkScalar dx, fx = srcPt.fX; |
| 92 | SkScalar dy, fy = srcPt.fY; |
| 93 | |
| 94 | if (fDstToIndexClass == kFixedStepInX_MatrixClass) { |
benjaminwagner | 8e17556 | 2016-02-16 10:09:40 -0800 | [diff] [blame] | 95 | const auto step = matrix.fixedStepInX(SkIntToScalar(y) + SK_ScalarHalf); |
| 96 | dx = step.fX; |
| 97 | dy = step.fY; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 98 | } else { |
| 99 | SkASSERT(fDstToIndexClass == kLinear_MatrixClass); |
| 100 | dx = matrix.getScaleX(); |
| 101 | dy = matrix.getSkewY(); |
| 102 | } |
| 103 | |
| 104 | for (; count > 0; --count) { |
reed@google.com | 6004029 | 2013-02-04 18:21:23 +0000 | [diff] [blame] | 105 | *dstC++ = cache[toggle + SkATan2_255(fy, fx)]; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 106 | fx += dx; |
| 107 | fy += dy; |
reed@google.com | 6004029 | 2013-02-04 18:21:23 +0000 | [diff] [blame] | 108 | toggle = next_dither_toggle(toggle); |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 109 | } |
| 110 | } else { // perspective case |
| 111 | for (int stop = x + count; x < stop; x++) { |
| 112 | proc(matrix, SkIntToScalar(x) + SK_ScalarHalf, |
| 113 | SkIntToScalar(y) + SK_ScalarHalf, &srcPt); |
reed@google.com | 6004029 | 2013-02-04 18:21:23 +0000 | [diff] [blame] | 114 | *dstC++ = cache[toggle + SkATan2_255(srcPt.fY, srcPt.fX)]; |
reed@google.com | 6004029 | 2013-02-04 18:21:23 +0000 | [diff] [blame] | 115 | toggle = next_dither_toggle(toggle); |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 120 | ///////////////////////////////////////////////////////////////////// |
| 121 | |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 122 | #if SK_SUPPORT_GPU |
| 123 | |
dandov | 9de5b51 | 2014-06-10 14:38:28 -0700 | [diff] [blame] | 124 | #include "SkGr.h" |
egdaniel | f529439 | 2015-10-21 07:14:17 -0700 | [diff] [blame] | 125 | #include "gl/GrGLContext.h" |
egdaniel | 7ea439b | 2015-12-03 09:20:44 -0800 | [diff] [blame] | 126 | #include "glsl/GrGLSLCaps.h" |
| 127 | #include "glsl/GrGLSLFragmentShaderBuilder.h" |
bsalomon@google.com | 2eaaefd | 2012-10-29 19:51:22 +0000 | [diff] [blame] | 128 | |
bsalomon@google.com | 0707c29 | 2012-10-25 21:45:42 +0000 | [diff] [blame] | 129 | class GrGLSweepGradient : public GrGLGradientEffect { |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 130 | public: |
| 131 | |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame] | 132 | GrGLSweepGradient(const GrProcessor&) {} |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 133 | virtual ~GrGLSweepGradient() { } |
| 134 | |
wangyix | 7c157a9 | 2015-07-22 15:08:53 -0700 | [diff] [blame] | 135 | virtual void emitCode(EmitArgs&) override; |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 136 | |
jvanverth | cfc1886 | 2015-04-28 08:48:20 -0700 | [diff] [blame] | 137 | static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 138 | b->add32(GenBaseGradientKey(processor)); |
bsalomon@google.com | d8b5fac | 2012-11-01 17:02:46 +0000 | [diff] [blame] | 139 | } |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 140 | |
| 141 | private: |
| 142 | |
bsalomon@google.com | 0707c29 | 2012-10-25 21:45:42 +0000 | [diff] [blame] | 143 | typedef GrGLGradientEffect INHERITED; |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 144 | |
| 145 | }; |
| 146 | |
rileya@google.com | 98e8b6d | 2012-07-31 20:38:06 +0000 | [diff] [blame] | 147 | ///////////////////////////////////////////////////////////////////// |
| 148 | |
| 149 | class GrSweepGradient : public GrGradientEffect { |
| 150 | public: |
bsalomon | 4a33952 | 2015-10-06 08:40:50 -0700 | [diff] [blame] | 151 | static GrFragmentProcessor* Create(GrContext* ctx, const SkSweepGradient& shader, |
| 152 | const SkMatrix& m) { |
| 153 | return new GrSweepGradient(ctx, shader, m); |
bsalomon@google.com | 0ac6af4 | 2013-01-16 15:16:18 +0000 | [diff] [blame] | 154 | } |
rileya@google.com | 98e8b6d | 2012-07-31 20:38:06 +0000 | [diff] [blame] | 155 | virtual ~GrSweepGradient() { } |
| 156 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 157 | const char* name() const override { return "Sweep Gradient"; } |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame] | 158 | |
bsalomon@google.com | d472620 | 2012-08-03 14:34:46 +0000 | [diff] [blame] | 159 | private: |
bsalomon@google.com | 0ac6af4 | 2013-01-16 15:16:18 +0000 | [diff] [blame] | 160 | GrSweepGradient(GrContext* ctx, |
| 161 | const SkSweepGradient& shader, |
| 162 | const SkMatrix& matrix) |
bsalomon | 4a33952 | 2015-10-06 08:40:50 -0700 | [diff] [blame] | 163 | : INHERITED(ctx, shader, matrix, SkShader::kClamp_TileMode) { |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame] | 164 | this->initClassID<GrSweepGradient>(); |
| 165 | } |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 166 | |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 167 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 168 | return new GrGLSweepGradient(*this); |
wangyix | b1daa86 | 2015-08-18 11:29:31 -0700 | [diff] [blame] | 169 | } |
| 170 | |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 171 | virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
| 172 | GrProcessorKeyBuilder* b) const override { |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 173 | GrGLSweepGradient::GenKey(*this, caps, b); |
| 174 | } |
| 175 | |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 176 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
rileya@google.com | 98e8b6d | 2012-07-31 20:38:06 +0000 | [diff] [blame] | 177 | |
| 178 | typedef GrGradientEffect INHERITED; |
| 179 | }; |
| 180 | |
| 181 | ///////////////////////////////////////////////////////////////////// |
| 182 | |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 183 | GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSweepGradient); |
bsalomon@google.com | d472620 | 2012-08-03 14:34:46 +0000 | [diff] [blame] | 184 | |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 185 | const GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) { |
joshualitt | 0067ff5 | 2015-07-08 14:26:19 -0700 | [diff] [blame] | 186 | SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; |
bsalomon@google.com | d472620 | 2012-08-03 14:34:46 +0000 | [diff] [blame] | 187 | |
| 188 | SkColor colors[kMaxRandomGradientColors]; |
| 189 | SkScalar stopsArray[kMaxRandomGradientColors]; |
| 190 | SkScalar* stops = stopsArray; |
| 191 | SkShader::TileMode tmIgnored; |
joshualitt | 0067ff5 | 2015-07-08 14:26:19 -0700 | [diff] [blame] | 192 | int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tmIgnored); |
bsalomon@google.com | d472620 | 2012-08-03 14:34:46 +0000 | [diff] [blame] | 193 | SkAutoTUnref<SkShader> shader(SkGradientShader::CreateSweep(center.fX, center.fY, |
| 194 | colors, stops, colorCount)); |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 195 | const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, |
| 196 | GrTest::TestMatrix(d->fRandom), |
bsalomon | 4a33952 | 2015-10-06 08:40:50 -0700 | [diff] [blame] | 197 | NULL, kNone_SkFilterQuality); |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 198 | GrAlwaysAssert(fp); |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 199 | return fp; |
bsalomon@google.com | d472620 | 2012-08-03 14:34:46 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | ///////////////////////////////////////////////////////////////////// |
| 203 | |
wangyix | 7c157a9 | 2015-07-22 15:08:53 -0700 | [diff] [blame] | 204 | void GrGLSweepGradient::emitCode(EmitArgs& args) { |
| 205 | const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); |
egdaniel | 7ea439b | 2015-12-03 09:20:44 -0800 | [diff] [blame] | 206 | this->emitUniforms(args.fUniformHandler, ge); |
egdaniel | 4ca2e60 | 2015-11-18 08:01:26 -0800 | [diff] [blame] | 207 | SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 208 | SkString t; |
commit-bot@chromium.org | 54318d3 | 2014-02-14 17:27:04 +0000 | [diff] [blame] | 209 | // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] |
| 210 | // On Intel GPU there is an issue where it reads the second arguement to atan "- %s.x" as an int |
| 211 | // thus must us -1.0 * %s.x to work correctly |
egdaniel | a2e3e0f | 2015-11-19 07:23:45 -0800 | [diff] [blame] | 212 | if (args.fGLSLCaps->mustForceNegatedAtanParamToFloat()){ |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 213 | t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5", |
commit-bot@chromium.org | 54318d3 | 2014-02-14 17:27:04 +0000 | [diff] [blame] | 214 | coords2D.c_str(), coords2D.c_str()); |
| 215 | } else { |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 216 | t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", |
commit-bot@chromium.org | 54318d3 | 2014-02-14 17:27:04 +0000 | [diff] [blame] | 217 | coords2D.c_str(), coords2D.c_str()); |
| 218 | } |
egdaniel | 7ea439b | 2015-12-03 09:20:44 -0800 | [diff] [blame] | 219 | this->emitColor(args.fFragBuilder, |
| 220 | args.fUniformHandler, |
egdaniel | a2e3e0f | 2015-11-19 07:23:45 -0800 | [diff] [blame] | 221 | args.fGLSLCaps, |
egdaniel | 4ca2e60 | 2015-11-18 08:01:26 -0800 | [diff] [blame] | 222 | ge, t.c_str(), |
| 223 | args.fOutputColor, |
| 224 | args.fInputColor, |
wangyix | 7c157a9 | 2015-07-22 15:08:53 -0700 | [diff] [blame] | 225 | args.fSamplers); |
rileya@google.com | d7cc651 | 2012-07-27 14:00:39 +0000 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | ///////////////////////////////////////////////////////////////////// |
| 229 | |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 230 | const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( |
| 231 | GrContext* context, |
| 232 | const SkMatrix& viewM, |
| 233 | const SkMatrix* localMatrix, |
bsalomon | 4a33952 | 2015-10-06 08:40:50 -0700 | [diff] [blame] | 234 | SkFilterQuality) const { |
mtklein | 3f3b3d0 | 2014-12-01 11:47:08 -0800 | [diff] [blame] | 235 | |
bsalomon@google.com | dfdb7e5 | 2012-10-16 15:19:45 +0000 | [diff] [blame] | 236 | SkMatrix matrix; |
bsalomon@google.com | f94b3a4 | 2012-10-31 18:09:01 +0000 | [diff] [blame] | 237 | if (!this->getLocalMatrix().invert(&matrix)) { |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 238 | return nullptr; |
bsalomon@google.com | dfdb7e5 | 2012-10-16 15:19:45 +0000 | [diff] [blame] | 239 | } |
commit-bot@chromium.org | 96fb748 | 2014-05-09 20:28:11 +0000 | [diff] [blame] | 240 | if (localMatrix) { |
| 241 | SkMatrix inv; |
| 242 | if (!localMatrix->invert(&inv)) { |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 243 | return nullptr; |
commit-bot@chromium.org | 96fb748 | 2014-05-09 20:28:11 +0000 | [diff] [blame] | 244 | } |
| 245 | matrix.postConcat(inv); |
| 246 | } |
bsalomon@google.com | f94b3a4 | 2012-10-31 18:09:01 +0000 | [diff] [blame] | 247 | matrix.postConcat(fPtsToUnit); |
mtklein | 3f3b3d0 | 2014-12-01 11:47:08 -0800 | [diff] [blame] | 248 | |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 249 | SkAutoTUnref<const GrFragmentProcessor> inner( |
bsalomon | 4a33952 | 2015-10-06 08:40:50 -0700 | [diff] [blame] | 250 | GrSweepGradient::Create(context, *this, matrix)); |
bsalomon | f1b7a1d | 2015-09-28 06:26:28 -0700 | [diff] [blame] | 251 | return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | #endif |
robertphillips@google.com | 76f9e93 | 2013-01-15 20:17:47 +0000 | [diff] [blame] | 255 | |
commit-bot@chromium.org | 0f10f7b | 2014-03-13 18:02:17 +0000 | [diff] [blame] | 256 | #ifndef SK_IGNORE_TO_STRING |
robertphillips@google.com | 76f9e93 | 2013-01-15 20:17:47 +0000 | [diff] [blame] | 257 | void SkSweepGradient::toString(SkString* str) const { |
| 258 | str->append("SkSweepGradient: ("); |
| 259 | |
| 260 | str->append("center: ("); |
| 261 | str->appendScalar(fCenter.fX); |
| 262 | str->append(", "); |
| 263 | str->appendScalar(fCenter.fY); |
| 264 | str->append(") "); |
| 265 | |
| 266 | this->INHERITED::toString(str); |
| 267 | |
| 268 | str->append(")"); |
| 269 | } |
| 270 | #endif |