Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: src/core/SkNormalMapSource.h

Issue 2080993002: Added API for Bevel NormalSource. (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-diffuse-api-change
Patch Set: Addressed patch 7 comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
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 SkNormalMapSource_DEFINED
9 #define SkNormalMapSource_DEFINED
10
11 #include "SkNormalSource.h"
12
13 class SkNormalMapSourceImpl : public SkNormalSource {
14 public:
15 SkNormalMapSourceImpl(sk_sp<SkShader> mapShader, const SkMatrix& invCTM)
16 : fMapShader(std::move(mapShader))
17 , fInvCTM(invCTM) {}
18
19 #if SK_SUPPORT_GPU
20 sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*,
21 const SkMatrix& viewM,
22 const SkMatrix* localMatrix,
23 SkFilterQuality,
24 SkSourceGammaTreatment) const override;
25 #endif
26
27 SkNormalSource::Provider* asProvider(const SkShader::ContextRec& rec,
28 void* storage) const override;
29 size_t providerSize(const SkShader::ContextRec& rec) const override;
30
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkNormalMapSourceImpl)
32
33 protected:
34 void flatten(SkWriteBuffer& buf) const override;
35
36 bool computeNormTotalInverse(const SkShader::ContextRec& rec, SkMatrix* norm TotalInverse) const;
37
38 private:
39 class Provider : public SkNormalSource::Provider {
40 public:
41 Provider(const SkNormalMapSourceImpl& source, SkShader::Context* mapCont ext,
42 SkPaint* overridePaint);
43
44 virtual ~Provider() override;
45
46 void fillScanLine(int x, int y, SkPoint3 output[], int count) const over ride;
47
48 private:
49 const SkNormalMapSourceImpl& fSource;
50 SkShader::Context* fMapContext;
51
52 SkPaint* fOverridePaint;
53
54 typedef SkNormalSource::Provider INHERITED;
55 };
56
57 sk_sp<SkShader> fMapShader;
58 SkMatrix fInvCTM; // Inverse of the canvas total matrix, used for rot ating normals.
59
60 friend class SkNormalSource;
61
62 typedef SkNormalSource INHERITED;
63 };
64
65 #endif
66
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698