Skip to content

Commit 06367eb

Browse files
Mee-guminggo
authored andcommitted
fix drawnode line width issue (#20442)
1 parent c98f105 commit 06367eb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cocos/2d/CCDrawNode.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static inline Tex2F v2ToTex2F(const Vec2 &v)
4747

4848
DrawNode::DrawNode(float lineWidth)
4949
: _lineWidth(lineWidth)
50+
, _defaultLineWidth(lineWidth)
5051
{
5152
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
5253
#if CC_ENABLE_CACHE_TEXTURE_DATA
@@ -732,7 +733,7 @@ void DrawNode::clear()
732733
_dirtyGLLine = true;
733734
_bufferCountGLPoint = 0;
734735
_dirtyGLPoint = true;
735-
_lineWidth = 0;
736+
_lineWidth = _defaultLineWidth;
736737
}
737738

738739
const BlendFunc& DrawNode::getBlendFunc() const

cocos/2d/CCDrawNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class CC_DLL DrawNode : public Node
349349
bool _dirtyGLLine = false;
350350
bool _isolated = false;
351351
float _lineWidth = 0.0f;
352-
352+
float _defaultLineWidth = 0.0f;
353353
private:
354354
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
355355
};

0 commit comments

Comments
 (0)