1 /* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkSweepGradient_DEFINED 9 #define SkSweepGradient_DEFINED 10 11 #include "SkGradientShaderPriv.h" 12 13 class SkSweepGradient : public SkGradientShaderBase { 14 public: 15 SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&); 16 17 class SweepGradientContext : public SkGradientShaderBase::GradientShaderBaseContext { 18 public: 19 SweepGradientContext(const SkSweepGradient& shader, const ContextRec&); 20 21 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; 22 23 private: 24 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; 25 }; 26 27 GradientType asAGradient(GradientInfo* info) const override; 28 29 #if SK_SUPPORT_GPU 30 sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const override; 31 #endif 32 33 SK_TO_STRING_OVERRIDE() 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient) 35 36 protected: 37 void flatten(SkWriteBuffer& buffer) const override; 38 Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const override; 39 40 private: 41 const SkPoint fCenter; 42 43 friend class SkGradientShader; 44 typedef SkGradientShaderBase INHERITED; 45 }; 46 47 #endif 48