16c432337818ff15e553c957d466a67e54684f97brileya@google.com
26c432337818ff15e553c957d466a67e54684f97brileya@google.com/*
36c432337818ff15e553c957d466a67e54684f97brileya@google.com * Copyright 2012 Google Inc.
46c432337818ff15e553c957d466a67e54684f97brileya@google.com *
56c432337818ff15e553c957d466a67e54684f97brileya@google.com * Use of this source code is governed by a BSD-style license that can be
66c432337818ff15e553c957d466a67e54684f97brileya@google.com * found in the LICENSE file.
76c432337818ff15e553c957d466a67e54684f97brileya@google.com */
86c432337818ff15e553c957d466a67e54684f97brileya@google.com
96c432337818ff15e553c957d466a67e54684f97brileya@google.com#ifndef SkLinearGradient_DEFINED
106c432337818ff15e553c957d466a67e54684f97brileya@google.com#define SkLinearGradient_DEFINED
116c432337818ff15e553c957d466a67e54684f97brileya@google.com
126c432337818ff15e553c957d466a67e54684f97brileya@google.com#include "SkGradientShaderPriv.h"
136c432337818ff15e553c957d466a67e54684f97brileya@google.com
146c432337818ff15e553c957d466a67e54684f97brileya@google.comclass SkLinearGradient : public SkGradientShaderBase {
156c432337818ff15e553c957d466a67e54684f97brileya@google.compublic:
1652d6fb7020e41328b86785a5ea12d42f44f36b8creed@google.com    SkLinearGradient(const SkPoint pts[2], const Descriptor&);
176c432337818ff15e553c957d466a67e54684f97brileya@google.com
186c432337818ff15e553c957d466a67e54684f97brileya@google.com    virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK_OVERRIDE;
196c432337818ff15e553c957d466a67e54684f97brileya@google.com    virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
206c432337818ff15e553c957d466a67e54684f97brileya@google.com    virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
216c432337818ff15e553c957d466a67e54684f97brileya@google.com    virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERRIDE;
226c432337818ff15e553c957d466a67e54684f97brileya@google.com    virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
2338b58f31a3070ea9254d55894a59528270ac67ddbsalomon@google.com    virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE;
246c432337818ff15e553c957d466a67e54684f97brileya@google.com
25bc0c7b3fc892adc21eeac2d56b02a525ee811fdbrobertphillips@google.com    SK_DEVELOPER_TO_STRING()
266c432337818ff15e553c957d466a67e54684f97brileya@google.com    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient)
276c432337818ff15e553c957d466a67e54684f97brileya@google.com
286c432337818ff15e553c957d466a67e54684f97brileya@google.comprotected:
296c432337818ff15e553c957d466a67e54684f97brileya@google.com    SkLinearGradient(SkFlattenableReadBuffer& buffer);
306c432337818ff15e553c957d466a67e54684f97brileya@google.com    virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE;
316c432337818ff15e553c957d466a67e54684f97brileya@google.com
326c432337818ff15e553c957d466a67e54684f97brileya@google.comprivate:
336c432337818ff15e553c957d466a67e54684f97brileya@google.com    typedef SkGradientShaderBase INHERITED;
346c432337818ff15e553c957d466a67e54684f97brileya@google.com    const SkPoint fStart;
356c432337818ff15e553c957d466a67e54684f97brileya@google.com    const SkPoint fEnd;
366c432337818ff15e553c957d466a67e54684f97brileya@google.com};
376c432337818ff15e553c957d466a67e54684f97brileya@google.com
386c432337818ff15e553c957d466a67e54684f97brileya@google.com#endif
39