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

-[NSString drawAtPoint:withAttributes:] regression #1335

Closed
edvv opened this issue Nov 8, 2016 · 7 comments
Closed

-[NSString drawAtPoint:withAttributes:] regression #1335

edvv opened this issue Nov 8, 2016 · 7 comments

Comments

@edvv
Copy link

edvv commented Nov 8, 2016

Dear WinObjC Engineers,

From release 41 to 42 there is a regression in -[NSString drawAtPoint:withAttributes:]. The color attribute perhaps worked in 41, but in 42 the color attribute is all messed up. Here is a code frag that executes the bug:

stringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[UIFont systemFontOfSize:12.0], NSFontAttributeName, [UIColor redColor], NSForegroundColorAttributeName, nil];

[aString drawAtPoint:aPoint withAttributes:stringAttributes];

Sincerely,

Ed

@rajsesh
Copy link
Contributor

rajsesh commented Nov 8, 2016

@edvv thanks for reporting the issue. what exactly is messed up? Wrong color or color not set?

@edvv
Copy link
Author

edvv commented Nov 8, 2016

When the text color is suppose to be black, it looks mostly cyan. The blue channel seems to be at maximum all of the time and the other channels seem somewhat "inverted".

It is more complex than I thought because I can't repro it in a simple test app.

It seems like a font bitmap compositing bug such as attempting to composite a font raster cache into a buffer of different raster cache type.

It only happens with custom string drawing, the labels for buttons (UIButton) are the correct color (black).

I reverted to release 41 and that release draws the font colors as expected.

@rajsesh
Copy link
Contributor

rajsesh commented Nov 8, 2016

@eddv this is typically a symptom of wrong color space transformation. We noticed something similar with #1216 and also with #1295. Are you extracting the image from the uicontext and drawing it manually, or is this a simple case of drawing directly to the display device?

@edvv
Copy link
Author

edvv commented Nov 8, 2016

@rajsesh-msft I am currently using this:

-[NSString drawAtPoint:withAttributes:]

which is drawing to UIGraphicsGetCurrentContext() - nothing fancy. So, drawing directly to the display device. I think the issues you cited are very consistent with what I am seeing.

@rajsesh
Copy link
Contributor

rajsesh commented Nov 9, 2016

@edvv, we have this code in WOCCatalog (TextDisplayViewController), which works correctly. What are you performing the custom drawing into? Are you using a middleware like cocos2d? Thanks again for helping investigate it, unfortunately, I am unable to repro the issue.

@edvv
Copy link
Author

edvv commented Nov 9, 2016

@rajsesh-msft Attached is a small unit test demonstrating the error. On iOS the text is red color. On Windows (with WinObjC release 42) the text is cyan-ish in the white rectangle portion and green-ish in the black (alpha) portion. I constructed the test to duplicate a backstore promotion to demonstrate the error, i.e.: one of the drawing elements is promoting the backstore into something the glyph rendering does not like. It may be the layer promotion, scrollview, image with alpha channel or opaque or alpha method override. Sincerely, Ed

colorerror.zip

@rajsesh rajsesh self-assigned this Nov 9, 2016
@rajsesh
Copy link
Contributor

rajsesh commented Nov 9, 2016

@edvv thanks for taking time to provide the simple sample. Much appreciated.

rajsesh pushed a commit to rajsesh/WinObjC that referenced this issue Nov 15, 2016
rajsesh pushed a commit that referenced this issue Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants