blob: 9998ed16a77559cb4ae6bea32ba39afffb340972 [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:
reed@google.com437d6eb2013-05-23 19:03:05 +000016 SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&);
commit-bot@chromium.orgbc2f1dc2014-04-23 09:11:58 +000017
18 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, const SkMatrix&,
19 void* storage) const SK_OVERRIDE;
20 virtual size_t contextSize() const SK_OVERRIDE;
21
22 class SweepGradientContext : public SkGradientShaderBase::GradientShaderBaseContext {
23 public:
24 SweepGradientContext(const SkSweepGradient& shader, const SkBitmap& device,
25 const SkPaint& paint, const SkMatrix& matrix);
26 ~SweepGradientContext() {}
27
28 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
29 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
30
31 private:
32 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED;
33 };
rileya@google.com589708b2012-07-26 20:04:23 +000034
35 virtual BitmapType asABitmap(SkBitmap* bitmap,
36 SkMatrix* matrix,
37 TileMode* xy) const SK_OVERRIDE;
38
39 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
40
bsalomon@google.com0ac6af42013-01-16 15:16:18 +000041 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000042
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000043 SK_TO_STRING_OVERRIDE()
rileya@google.com589708b2012-07-26 20:04:23 +000044 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient)
45
46protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000047 SkSweepGradient(SkReadBuffer& buffer);
48 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000049
50private:
commit-bot@chromium.org53783b02014-04-17 21:09:49 +000051 const SkPoint fCenter;
commit-bot@chromium.orgbc2f1dc2014-04-23 09:11:58 +000052
53 typedef SkGradientShaderBase INHERITED;
rileya@google.com589708b2012-07-26 20:04:23 +000054};
55
rileya@google.com589708b2012-07-26 20:04:23 +000056#endif