blob: 873024730d4678bb7d3ff1d3894d8f2bb8444a1f [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 SkRadialGradient_DEFINED
10#define SkRadialGradient_DEFINED
11
12#include "SkGradientShaderPriv.h"
13
14class SkRadialGradient : public SkGradientShaderBase {
15public:
commit-bot@chromium.org9c9005a2014-04-28 14:55:39 +000016 SkRadialGradient(const SkPoint& center, SkScalar radius, 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 RadialGradientContext : public SkGradientShaderBase::GradientShaderBaseContext {
23 public:
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +000024 RadialGradientContext(const SkRadialGradient&, 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 };
32
rileya@google.com589708b2012-07-26 20:04:23 +000033 virtual BitmapType asABitmap(SkBitmap* bitmap,
34 SkMatrix* matrix,
35 TileMode* xy) const SK_OVERRIDE;
36 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
bsalomon@google.com0ac6af42013-01-16 15:16:18 +000037 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000038
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000039 SK_TO_STRING_OVERRIDE()
rileya@google.com589708b2012-07-26 20:04:23 +000040 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRadialGradient)
41
42protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000043 SkRadialGradient(SkReadBuffer& buffer);
44 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000045
46private:
47 typedef SkGradientShaderBase INHERITED;
48 const SkPoint fCenter;
49 const SkScalar fRadius;
50};
51
rileya@google.com589708b2012-07-26 20:04:23 +000052#endif