blob: 15c5b634aee65d1cf33419457becf160df54f8b6 [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
19 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, const SkMatrix&,
20 void* storage) const SK_OVERRIDE;
21 virtual size_t contextSize() const SK_OVERRIDE;
22
23 class SweepGradientContext : public SkGradientShaderBase::GradientShaderBaseContext {
24 public:
25 SweepGradientContext(const SkSweepGradient& shader, const SkBitmap& device,
26 const SkPaint& paint, const SkMatrix& matrix);
27 ~SweepGradientContext() {}
28
29 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
30 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
31
32 private:
33 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED;
34 };
rileya@google.com589708b2012-07-26 20:04:23 +000035
36 virtual BitmapType asABitmap(SkBitmap* bitmap,
37 SkMatrix* matrix,
38 TileMode* xy) const SK_OVERRIDE;
39
40 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
41
bsalomon@google.com0ac6af42013-01-16 15:16:18 +000042 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000043
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000044 SK_TO_STRING_OVERRIDE()
rileya@google.com589708b2012-07-26 20:04:23 +000045 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient)
46
47protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000048 SkSweepGradient(SkReadBuffer& buffer);
49 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000050
51private:
commit-bot@chromium.org6e5671d2014-04-23 16:16:55 +000052 const SkPoint fCenter;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000053
54 typedef SkGradientShaderBase INHERITED;
rileya@google.com589708b2012-07-26 20:04:23 +000055};
56
rileya@google.com589708b2012-07-26 20:04:23 +000057#endif