Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the hash value for the label outline opacity is not being calculated correctly. #18143

Open
wants to merge 1 commit into
base: v2.4.13
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions cocos2d/core/renderer/utils/label/letter-font.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function LetterAtlas (width, height) {
texture.update();

this._fontDefDictionary = new FontAtlas(texture);

this._x = space;
this._y = space;
this._nexty = space;
Expand All @@ -145,7 +145,7 @@ function LetterAtlas (width, height) {
cc.js.mixin(LetterAtlas.prototype, {
insertLetterTexture (letterTexture) {
let texture = letterTexture._texture;
let width = texture.width, height = texture.height;
let width = texture.width, height = texture.height;

if ((this._x + width + space) > this._width) {
this._x = space;
Expand All @@ -163,7 +163,7 @@ cc.js.mixin(LetterAtlas.prototype, {
this._fontDefDictionary._texture.drawTextureAt(texture, this._x, this._y);

this._dirty = true;

let letter = new FontLetterDefinition();
letter.u = this._x + bleed/2;
letter.v = this._y + bleed/2;
Expand All @@ -177,7 +177,7 @@ cc.js.mixin(LetterAtlas.prototype, {
this._x += width + space;

this._fontDefDictionary.addLetterDefinitions(letterTexture._hash, letter);

return letter
},

Expand Down Expand Up @@ -220,7 +220,7 @@ cc.js.mixin(LetterAtlas.prototype, {
let texture = new RenderTexture();
texture.initWithSize(this._width, this._height);
texture.update();

this._fontDefDictionary._texture = texture;
},

Expand Down Expand Up @@ -248,12 +248,12 @@ cc.js.mixin(LetterAtlas.prototype, {

function computeHash (labelInfo) {
let hashData = '';
let color = labelInfo.color.toHEX();
let color = labelInfo.color.toHEX('#rrggbbaa');
let out = '';
if (labelInfo.isOutlined && labelInfo.margin > 0) {
out = out + labelInfo.margin + labelInfo.out.toHEX();
out = out + labelInfo.margin + labelInfo.out.toHEX('#rrggbbaa');
}

return hashData + labelInfo.fontSize + labelInfo.fontFamily + color + out;
}

Expand All @@ -269,7 +269,7 @@ export default class LetterFontAssembler extends WebglBmfontAssembler {
_shareAtlas = new LetterAtlas(_atlasWidth, _atlasHeight);
cc.Label._shareAtlas = _shareAtlas;
}

return _shareAtlas.getTexture();
}

Expand Down Expand Up @@ -310,4 +310,4 @@ export default class LetterFontAssembler extends WebglBmfontAssembler {
_determineRect (tempRect) {
return false;
}
}
}