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 SkRadialGradient_DEFINED 9 #define SkRadialGradient_DEFINED 10 11 #include "src/shaders/gradients/SkGradientShaderPriv.h" 12 13 class SkRadialGradient final : public SkGradientShaderBase { 14 public: 15 SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&); 16 17 GradientType asAGradient(GradientInfo* info) const override; 18 #if SK_SUPPORT_GPU 19 std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override; 20 #endif 21 22 protected: 23 SkRadialGradient(SkReadBuffer& buffer); 24 void flatten(SkWriteBuffer& buffer) const override; 25 26 void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline, 27 SkRasterPipeline* postPipeline) const override; 28 29 private: 30 SK_FLATTENABLE_HOOKS(SkRadialGradient) 31 32 const SkPoint fCenter; 33 const SkScalar fRadius; 34 35 friend class SkGradientShader; 36 typedef SkGradientShaderBase INHERITED; 37 }; 38 39 #endif 40