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

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

Issue 2237963002: LightingShader and NormalSource comment and style fixes (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Addressed patch 1 comment 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/SkNormalMapSource.cpp ('k') | src/gpu/glsl/GrGLSLProgramBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkNormalSource_DEFINED 8 #ifndef SkNormalSource_DEFINED
9 #define SkNormalSource_DEFINED 9 #define SkNormalSource_DEFINED
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 is retrieved by: 61 is retrieved by:
62 N.x = R-127; 62 N.x = R-127;
63 N.y = G-127; 63 N.y = G-127;
64 N.z = B-127; 64 N.z = B-127;
65 N.normalize(); 65 N.normalize();
66 The +Z axis is thus encoded in RGB as (127, 127, 255) while the -Z axis is 66 The +Z axis is thus encoded in RGB as (127, 127, 255) while the -Z axis is
67 (127, 127, 0). 67 (127, 127, 0).
68 */ 68 */
69 static sk_sp<SkNormalSource> MakeFromNormalMap(sk_sp<SkShader> map, const Sk Matrix& ctm); 69 static sk_sp<SkNormalSource> MakeFromNormalMap(sk_sp<SkShader> map, const Sk Matrix& ctm);
70 70
71 /** Returns a normal source that provides straight-up normals only (0, 0, 1) . 71 /** Returns a normal source that provides straight-up normals only <0, 0, 1> .
72 */ 72 */
73 static sk_sp<SkNormalSource> MakeFlat(); 73 static sk_sp<SkNormalSource> MakeFlat();
74 74
75 /** This enum specifies the shape of the bevel. All bevels output <0, 0, 1> as the surface 75 /** This enum specifies the shape of the bevel. All bevels output <0, 0, 1> as the surface
76 * normal for any point more than 'width' away from any edge. 76 * normal for any point more than 'width' away from any edge.
77 * 77 *
78 * Mathematical details: 78 * Mathematical details:
79 * For the purpose of describing the shape of the bevel, we define 'w' to b e the given width of 79 * For the purpose of describing the shape of the bevel, we define 'w' to b e the given width of
80 * the bevel, and 'h' to be the given height. We will assume the shape is r otated such that the 80 * the bevel, and 'h' to be the given height. We will assume the shape is r otated such that the
81 * point being shaded as well as the closest point in the shape's edge to t hat point are in the 81 * point being shaded as well as the closest point in the shape's edge to t hat point are in the
(...skipping 19 matching lines...) Expand all
101 /* This bevel simulates a surface that sharply becomes perpendicular to the x-y plane when 101 /* This bevel simulates a surface that sharply becomes perpendicular to the x-y plane when
102 * at 'width' units from the nearest edge, and then rounds off towards t he shape's 102 * at 'width' units from the nearest edge, and then rounds off towards t he shape's
103 * edge, smoothly becoming parallel to the x-y plane. 103 * edge, smoothly becoming parallel to the x-y plane.
104 * 104 *
105 * Mathematical details: 105 * Mathematical details:
106 * This bevel follows the only quadratic bezier curve whose start point is at (w, 0, 0), 106 * This bevel follows the only quadratic bezier curve whose start point is at (w, 0, 0),
107 * control point is at (0, 0, 0), and end point is at (0, 0, h). 107 * control point is at (0, 0, 0), and end point is at (0, 0, h).
108 */ 108 */
109 kRoundedIn 109 kRoundedIn
110 }; 110 };
111 /** Returns a normal source that generates a bevel for the given shape. UNIM PLEMENTED: Will 111
112 return straight-up normals only. 112 /** Returns a normal source that generates a bevel for the shape being drawn . Currently this is
113 not implemented on CPU rendering. On GPU this currently only works for a nti-aliased circles
114 and rectangles.
113 115
114 @param type the type of bevel to add. 116 @param type the type of bevel to add.
115 @param width the width of the bevel, in source space. Must be positive . 117 @param width the width of the bevel, in source space. Must be positive .
116 @param height the height of the plateau, in source space. Can be positi ve, negative, 118 @param height the height of the plateau, in source space. Can be positi ve, negative,
117 or zero. A negative height means the simulated bevels slo pe downwards. 119 or zero. A negative height means the simulated bevels slo pe downwards.
118 */ 120 */
119 static sk_sp<SkNormalSource> MakeBevel(BevelType, SkScalar width, SkScalar h eight); 121 static sk_sp<SkNormalSource> MakeBevel(BevelType, SkScalar width, SkScalar h eight);
120 122
121 SK_DEFINE_FLATTENABLE_TYPE(SkNormalSource) 123 SK_DEFINE_FLATTENABLE_TYPE(SkNormalSource)
122 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 124 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
123 }; 125 };
124 126
125 #endif 127 #endif
OLDNEW
« no previous file with comments | « src/core/SkNormalMapSource.cpp ('k') | src/gpu/glsl/GrGLSLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698