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 final : public SkGradientShaderBase { 14 public: 15 SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&); 16 17 GradientType asAGradient(GradientInfo* info) const override; 18 19 #if SK_SUPPORT_GPU 20 sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const override; 21 #endif 22 23 SK_TO_STRING_OVERRIDE() 24 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient) 25 26 protected: 27 void flatten(SkWriteBuffer& buffer) const override; 28 sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override; 29 30 bool adjustMatrixAndAppendStages(SkArenaAlloc* alloc, 31 SkMatrix* matrix, 32 SkRasterPipeline* tPipeline, 33 SkRasterPipeline* postPipeline) const override; 34 onIsRasterPipelineOnly()35 bool onIsRasterPipelineOnly() const override { return true; } 36 37 private: 38 const SkPoint fCenter; 39 40 friend class SkGradientShader; 41 typedef SkGradientShaderBase INHERITED; 42 }; 43 44 #endif 45