blob: 7d879266b1dd7ce21d7bf2059f4cfaa219928482 [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 SkLinearGradient_DEFINED
10#define SkLinearGradient_DEFINED
11
12#include "SkGradientShaderPriv.h"
13
14class SkLinearGradient : public SkGradientShaderBase {
15public:
16 SkLinearGradient(const SkPoint pts[2],
17 const SkColor colors[], const SkScalar pos[], int colorCount,
18 SkShader::TileMode mode, SkUnitMapper* mapper);
19
20 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK_OVERRIDE;
21 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
22 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
23 virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERRIDE;
24 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
bsalomon@google.com08283af2012-10-26 13:01:20 +000025 virtual bool asNewEffect(GrContext* context, GrEffectStage* stage) const SK_OVERRIDE;
rileya@google.com589708b2012-07-26 20:04:23 +000026
27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient)
28
29protected:
30 SkLinearGradient(SkFlattenableReadBuffer& buffer);
31 virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE;
32
33private:
34 typedef SkGradientShaderBase INHERITED;
35 const SkPoint fStart;
36 const SkPoint fEnd;
37};
38
rileya@google.com589708b2012-07-26 20:04:23 +000039#endif
40