blob: 5c460617445425fec6cc647bf07e86c1cf0e345f [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:
reedaddf2ed2014-08-11 08:28:24 -070016 SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000017
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000018 virtual size_t contextSize() const SK_OVERRIDE;
19
20 class SweepGradientContext : public SkGradientShaderBase::GradientShaderBaseContext {
21 public:
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +000022 SweepGradientContext(const SkSweepGradient& shader, const ContextRec&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000023
24 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
25 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
26
27 private:
28 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED;
29 };
rileya@google.com589708b2012-07-26 20:04:23 +000030
31 virtual BitmapType asABitmap(SkBitmap* bitmap,
32 SkMatrix* matrix,
33 TileMode* xy) const SK_OVERRIDE;
34
35 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
36
bsalomon97b9ab72014-07-08 06:52:35 -070037 virtual bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffect**)
dandov9de5b512014-06-10 14:38:28 -070038 const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000039
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000040 SK_TO_STRING_OVERRIDE()
rileya@google.com589708b2012-07-26 20:04:23 +000041 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient)
42
43protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000044 SkSweepGradient(SkReadBuffer& buffer);
45 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +000046 virtual Context* onCreateContext(const ContextRec&, void* storage) 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