-
Notifications
You must be signed in to change notification settings - Fork 806
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
UI Image fixes #636
UI Image fixes #636
Conversation
…ges with imageCaps: - drawNinePatchCallback renamed to drawPatches - Instead of creating a pattern and calling a CB function (drawNinePatchCallback) to subdivide image into patches and draw individually, the change was made to just call a function which subdivides the images into patches and draws (drawPatches) - Insets improperly scaled in many places - drawPatches optimized to subdivide the image into the smallest number of patches to reduce draw setup and state management overhead - make drawPatches and makeRect inline
makeRect((dst->origin.x + leftCap), | ||
(dst->origin.y + botCap), | ||
(dst->size.width - leftCap - rightCap), | ||
(dst->size.height - topCap - botCap))); | ||
} else { | ||
assert(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert(0); [](start = 11, length = 11)
although this is old code, it would be much better to Throw and exception with some information on why this is an issue.
It would provide much more information rather than just asserting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced assert with unimplemented_with_msg macro.
@Ramu-msft is added to the review. #Closed |
@davelamb is added to the review. #Closed |
(dst->size.height - topCap - botCap))); | ||
} | ||
} else { | ||
UNIMPLEMENTED_WITH_MSG("Patched draws only supported when sum of topCap and botCap is less than the height of the UI element."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be the case on the reference platform. It seems to draw the caps as a ratio between the cap sizes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true and this is a pre-existing issue which isn't resolved here. We should create another pull request in the future to address this and maybe even a functional test to make sure the output produced in this scenario matches that of the reference platform.
We've root caused the crashing issue to a missing call to EMMS (_mm_empty, clears MMX state) and the tiling issue to x/y step size being incorrect in the call to CGPatternCreate. I have a small fix that addresses both these issues that we'd like to push out that shouldn't collide (but for one line) with your change. |
…os, blendMode, alpha), drawAtPoint(pos), drawAtPoint(pos, blendMode, alpha) - When alpha and blendMode are not provided in drawRect and drawAtPoint functions, use values from the current graphics state instead of hardcoded values which force full opacity or transparency and a KCGBlendModeNormal and thus ignoring the app's intentions - In drawRect/drawAtPoint, set opacity (alpha) as part of draw setup - Use cairo_paint_with_alpha using the current alpha/opacity state instead of using just cairo_paint
I don't see why we can't delete the drawTopCap, drawLeftCap or drawLeftAndTopCap methods. They are unused but I originaly left them alone because I wasn't sure if it was envisioned to use them as part of a future change. |
I will also remove makeRect and substitute existing references to it with CGRectMake and make a few small changes to drawInRect(pos) and drawAtPoint(point) functions. |
…eRect, removed unused static functions, made changes to drawInRect(pos) and drawAtPoint(pos) so that blendMode and alpha default to normal and 1.0f as per the spec.
srcRect.origin.y = float(getImage(self)->Backing()->Height()); | ||
srcRect.size.width = float(getImage(self)->Backing()->Width()); | ||
srcRect.size.height = -((float)getImage(self)->Backing()->Height()); | ||
srcRect.origin.y = float(imgBacking->Height()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float( [](start = 23, length = 6)
nit: it's a bid odd that two of these are constructing a float rather than casting to a float
In CI build. |
This reverts commit a106d3d.
…ave the fixes for High-DPI issues ready to merge. This reverts commit a106d3d.
Fixes graphical corruption in UI elements (examples: UIDatePicker, UISegmentControl) resulting in a checkerboard pattern being drawn and optimized patched draw function. The corruption is what is seen in issue #622 and is visible in the Segments and DatePicker sections of WOCCATALOG. This also resolves issue #674 since it implements the use of blendMode and alpha for the various drawAtPoint and drawInRect functions.
Details: