@@ -12,18 +12,6 @@ const ShaderManager = require('./ShaderManager');
12
12
* @property {Array<number> } [color4f] - The pen color as an array of [r,g,b,a], each component in the range [0,1].
13
13
*/
14
14
15
- /**
16
- * The pen attributes to use when unspecified.
17
- * @type {PenSkin#PenAttributes }
18
- * @memberof PenSkin
19
- * @private
20
- * @const
21
- */
22
- const DefaultPenAttributes = {
23
- color4f : [ 0 , 0 , 1 , 1 ] ,
24
- diameter : 1
25
- } ;
26
-
27
15
/**
28
16
* Reused memory location for storing a premultiplied pen color.
29
17
* @type {FloatArray }
@@ -161,7 +149,7 @@ class PenSkin extends Skin {
161
149
drawLine ( penAttributes , x0 , y0 , x1 , y1 ) {
162
150
// For compatibility with Scratch 2.0, offset pen lines of width 1 and 3 so they're pixel-aligned.
163
151
// See https://github.com/LLK/scratch-render/pull/314
164
- const diameter = penAttributes . diameter || DefaultPenAttributes . diameter ;
152
+ const diameter = penAttributes . diameter ;
165
153
const offset = ( diameter === 1 || diameter === 3 ) ? 0.5 : 0 ;
166
154
167
155
this . _drawLineOnBuffer (
@@ -222,15 +210,15 @@ class PenSkin extends Skin {
222
210
this . _renderer . enterDrawRegion ( this . _lineOnBufferDrawRegionId ) ;
223
211
224
212
// Premultiply pen color by pen transparency
225
- const penColor = penAttributes . color4f || DefaultPenAttributes . color4f ;
213
+ const penColor = penAttributes . color4f ;
226
214
__premultipliedColor [ 0 ] = penColor [ 0 ] * penColor [ 3 ] ;
227
215
__premultipliedColor [ 1 ] = penColor [ 1 ] * penColor [ 3 ] ;
228
216
__premultipliedColor [ 2 ] = penColor [ 2 ] * penColor [ 3 ] ;
229
217
__premultipliedColor [ 3 ] = penColor [ 3 ] ;
230
218
231
219
const uniforms = {
232
220
u_lineColor : __premultipliedColor ,
233
- u_lineThickness : penAttributes . diameter || DefaultPenAttributes . diameter ,
221
+ u_lineThickness : penAttributes . diameter ,
234
222
u_penPoints : [ x0 , - y0 , x1 , - y1 ]
235
223
} ;
236
224
0 commit comments