blob: 1d1983c66aa0710230a2a1b87504b8b468180394 [file] [log] [blame]
dvonbeckbba4cfe2016-07-28 08:58:19 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkNormalBevelSource_DEFINED
9#define SkNormalBevelSource_DEFINED
10
11#include "SkNormalSource.h"
12
13class SK_API SkNormalBevelSourceImpl : public SkNormalSource {
14public:
15 SkNormalBevelSourceImpl(BevelType type, SkScalar width, SkScalar height)
16 : fType(type)
17 , fWidth(width)
18 , fHeight(height) {}
19
20#if SK_SUPPORT_GPU
21 sk_sp<GrFragmentProcessor> asFragmentProcessor(const SkShader::AsFPArgs&) const override;
22#endif
23
24 SkNormalSource::Provider* asProvider(const SkShader::ContextRec& rec,
Herb Derby83e939b2017-02-07 14:25:11 -050025 SkArenaAlloc*) const override;
dvonbeckbba4cfe2016-07-28 08:58:19 -070026
27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkNormalBevelSourceImpl)
28
29protected:
30 void flatten(SkWriteBuffer& buf) const override;
31
32private:
33 class Provider : public SkNormalSource::Provider {
34 public:
35 Provider();
36
37 virtual ~Provider();
38
39 void fillScanLine(int x, int y, SkPoint3 output[], int count) const override;
40
41 private:
42 typedef SkNormalSource::Provider INHERITED;
43
44 };
45
46 SkNormalSource::BevelType fType;
47 SkScalar fWidth;
48 SkScalar fHeight;
49
50 friend class SkNormalSource;
51
52 typedef SkNormalSource INHERITED;
53};
54
55
56#endif