blob: 9ddd1e25d52e530a8b474627cce06d8e38b5766f [file] [log] [blame]
rileya@google.com589708b2012-07-26 20:04:23 +00001
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#ifndef SkSweepGradient_DEFINED
10#define SkSweepGradient_DEFINED
11
12#include "SkGradientShaderPriv.h"
13
14class SkSweepGradient : public SkGradientShaderBase {
15public:
commit-bot@chromium.org9c9005a2014-04-28 14:55:39 +000016 SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&,
17 const SkMatrix* localMatrix);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000018
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +000019 virtual SkShader::Context* createContext(const ContextRec&, void* storage) const SK_OVERRIDE;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000020 virtual size_t contextSize() const SK_OVERRIDE;
21
22 class SweepGradientContext : public SkGradientShaderBase::GradientShaderBaseContext {
23 public:
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +000024 SweepGradientContext(const SkSweepGradient& shader, const ContextRec&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000025
26 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
27 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
28
29 private:
30 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED;
31 };
rileya@google.com589708b2012-07-26 20:04:23 +000032
33 virtual BitmapType asABitmap(SkBitmap* bitmap,
34 SkMatrix* matrix,
35 TileMode* xy) const SK_OVERRIDE;
36
37 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
38
bsalomon@google.com0ac6af42013-01-16 15:16:18 +000039 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000040
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000041 SK_TO_STRING_OVERRIDE()
rileya@google.com589708b2012-07-26 20:04:23 +000042 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient)
43
44protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000045 SkSweepGradient(SkReadBuffer& buffer);
46 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000047
48private:
commit-bot@chromium.org6e5671d2014-04-23 16:16:55 +000049 const SkPoint fCenter;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000050
51 typedef SkGradientShaderBase INHERITED;
rileya@google.com589708b2012-07-26 20:04:23 +000052};
53
rileya@google.com589708b2012-07-26 20:04:23 +000054#endif