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

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: fixed unused field Created 4 years, 4 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
« no previous file with comments | « src/core/SkNormalFlatSource.cpp ('k') | src/core/SkNormalMapSource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(const SkShader::AsFPArgs&) co nst override;
21 #endif
22
23 SkNormalSource::Provider* asProvider(const SkShader::ContextRec& rec,
24 void* storage) const override;
25 size_t providerSize(const SkShader::ContextRec& rec) const override;
26
27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkNormalMapSourceImpl)
28
29 protected:
30 void flatten(SkWriteBuffer& buf) const override;
31
32 bool computeNormTotalInverse(const SkShader::ContextRec& rec, SkMatrix* norm TotalInverse) const;
33
34 private:
35 class Provider : public SkNormalSource::Provider {
36 public:
37 Provider(const SkNormalMapSourceImpl& source, SkShader::Context* mapCont ext,
38 SkPaint* overridePaint);
39
40 virtual ~Provider() override;
41
42 void fillScanLine(int x, int y, SkPoint3 output[], int count) const over ride;
43
44 private:
45 const SkNormalMapSourceImpl& fSource;
46 SkShader::Context* fMapContext;
47
48 SkPaint* fOverridePaint;
49
50 typedef SkNormalSource::Provider INHERITED;
51 };
52
53 sk_sp<SkShader> fMapShader;
54 SkMatrix fInvCTM; // Inverse of the canvas total matrix, used for rot ating normals.
55
56 friend class SkNormalSource;
57
58 typedef SkNormalSource INHERITED;
59 };
60
61 #endif
62
OLDNEW
« no previous file with comments | « src/core/SkNormalFlatSource.cpp ('k') | src/core/SkNormalMapSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698