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

GRAPHICS: MACGUI: fix the scroll bar of mactextwindow, fix the incorrectly behaviour when appendText of mactextwindow #2903

Merged
merged 12 commits into from Apr 1, 2021

Conversation

@ysj1173886760
Copy link
Contributor

@ysj1173886760 ysj1173886760 commented Mar 31, 2021

No description provided.

@deepcode-ci-bot
Copy link

@deepcode-ci-bot deepcode-ci-bot bot commented Mar 31, 2021

Congratulations 🎉. DeepCode analyzed your code in 5.421 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

👉 View analysis in DeepCode’s Dashboard | Configure the bot

Copy link
Member

@sev- sev- left a comment

Good code. There sneaked in a few unnecessary whitespace changes which could be better reverted (in a separate commit is fine, but if you feel adventurous, you could change the relevant commits).

@@ -485,12 +494,12 @@ void MacText::splitString(const Common::U32String &str, int curLine) {

for (int i = 1; i < (int)word.size(); i++) {
word_width += word[i].getFont()->getStringWidth(word[i].text);
D(9, "** word \"%s\" textslant [%d]", Common::toPrintable(word[i].text.encode()).c_str(), word[i].textSlant);

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

Please revert this, I had more debug info than you do.

@@ -733,6 +747,11 @@ int MacText::getLineCharWidth(int line, bool enforce) {
return width;
}

int MacText::getLastLineWidth() {
if (_textLines.size() == 0) return 0;

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

Please make it two lines.

@@ -838,8 +857,7 @@ void MacText::resize(int w, int h) {
}

void MacText::appendText(const Common::U32String &str, int fontId, int fontSize, int fontSlant, bool skipAdd) {
appendTextDefault(str, skipAdd);

// appendTextDefault(str, skipAdd);

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

If it is not needed, perhaps you could clean it up and just remove, and remove the skipAdd parameter?

@@ -850,12 +868,10 @@ void MacText::appendText(const Common::U32String &str, int fontId, int fontSize,
_str += fontRun.toString();
_str += str;
}

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

Why?

splitString(str);
recalcDims();

render(oldLen - 1, _textLines.size());

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

Also, why removing this?

@@ -881,7 +897,6 @@ void MacText::appendTextDefault(const Common::U32String &str, bool skipAdd) {
_str += _defaultFormatting.toString();
_str += str;
}

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

And this

@@ -921,16 +936,16 @@ void MacText::removeLastLine() {
void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {
if (_textLines.empty())
return;

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

And this was removed for no reason

}

// draw highlight scroll bar
if (_highlightedPart == kBorderScrollUp || _highlightedPart == kBorderScrollDown) {

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

Is it possible to move this to macwindowborder.cpp?

graphics/macgui/macwindow.cpp Show resolved Hide resolved
@@ -443,21 +446,53 @@ void macDrawPixel(int x, int y, int color, void *data) {
uint xu = (uint)x; // for letting compiler optimize it
uint yu = (uint)y;
*((T)p->surface->getBasePtr(xu, yu)) = p->invert ? ~(*((T)p->surface->getBasePtr(xu, yu))) :
(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ? color : p->bgColor;
(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ? color : p->bgColor;

This comment has been minimized.

@sev-

sev- Mar 31, 2021
Member

please revert this, this is just indentation change with no reason

@ysj1173886760 ysj1173886760 force-pushed the ysj1173886760:wage-fix2 branch 3 times, most recently from 93b660d to 3e05322 Apr 1, 2021
@ysj1173886760 ysj1173886760 force-pushed the ysj1173886760:wage-fix2 branch from b492bc5 to 1b9e22c Apr 1, 2021
@sev-
Copy link
Member

@sev- sev- commented Apr 1, 2021

Thank you!

@sev- sev- merged commit 2ab965e into scummvm:master Apr 1, 2021
3 checks passed
3 checks passed
Codacy Static Code Analysis Codacy Static Code Analysis
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deepcode-ci-bot Well done, no issues found!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants