-
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
Colorspace support for CGColor and improvements to the class. #2244
Colorspace support for CGColor and improvements to the class. #2244
Conversation
@@ -0,0 +1,850 @@ | |||
//****************************************************************************** |
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.
.TMP 😆 #Resolved
@@ -226,6 +226,8 @@ @implementation UIColor { | |||
UIImage* _image; | |||
id _pattern; | |||
__CGColorQuad _components; | |||
// Note: This should be part of the CGColor struct | |||
woc::StrongCF<CGColorSpaceRef> _colorSpace; |
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.
I really don't think this is the way to fix this. This change set should be included in the separation of CGColor from UIColor, rather than piling on additional short term fixes in UIColor which will add more things to remove. #ByDesign
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.
Talked to raj regarding this, ideally, the whole thing should be fixed!
but given the load this iteration and the re-write is coming up, this should be sufficient.
as much as I don't like doing this, until the re-write happens this would fix up some stuff for us. #ByDesign
Frameworks/CoreGraphics/CGColor.mm
Outdated
return nullptr; | ||
if (ret) { | ||
auto grayColorSpace = woc::MakeStrongCF<CGColorSpaceRef>(CGColorSpaceCreateDeviceGray()); | ||
[static_cast<UIColor*>(ret) setColorSpace:grayColorSpace]; |
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 is only the appropriate fix for black/white/clear! #Resolved
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.
the Caveat indicates it's limited. Should probably move it up so the 'future' is not clouded. #Resolved
|
||
RETURN_NULL_IF(!colorSpace); | ||
RETURN_NULL_IF(!components); | ||
CGColorRef ret = static_cast<CGColorRef>( |
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.
it might be safe to assert that the #components in the color space is 3-4. Just so that we don't index beyond the end of components. #ByDesign
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.
hmm i don't want to do this, as it's only supporting RGB, not even grayscale.
This is not the main purpose of the CR. The main purpose is to move it to Add CGColorGetColorSpace only.
In reply to: 106506478 [](ancestors = 106506478)
*/ | ||
size_t CGColorGetNumberOfComponents(CGColorRef color) { | ||
return 4; | ||
return CGColorSpaceGetNumberOfComponents(CGColorGetColorSpace(color)) + 1; |
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 +1 is somewhat worrying #ByDesign
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.
specifically: not all colours have alphas #ByDesign
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 is based off of the limited support. Again a while fix to the colorspace is needed.
In reply to: 106507058 [](ancestors = 106507058)
Frameworks/include/UIColorInternal.h
Outdated
- (const __CGColorQuad*)_getColors; | ||
- (BrushType)_type; | ||
@property CGColorSpaceRef colorSpace; |
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.
whoa boy, give this a lifetime and an atomicity specifier! #Resolved
#define EXPECT_EQ_COMPONENTS(a, b) \ | ||
EXPECT_EQ((a)[0], (b)[0]); \ | ||
EXPECT_EQ((a)[1], (b)[1]); \ | ||
EXPECT_EQ((a)[2], (b)[2]); \ | ||
EXPECT_EQ((a)[3], (b)[3]) | ||
|
||
DISABLED_TEST(CGColor, CGColorGetComponents) { | ||
TEST(CGColor, CGColorGetComponents) { |
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.
it doesn't look like this test fixture anchors the UIKit symbols. #Resolved
… the class. Note: Given CGColor is now implemented via UIColor, the var to hold the colorspace is added int UIColor (in the Extended Interface). This should move to the CGColor struct when CGColor is implemented via CPPBase. Implements: CGColorGetColorSpace The following Apis were improved: CGColorGetConstantColor - now supports colorspace for (black,white, and clear) CGColorCreate, CGColorCreateCopyWithAlpha & CGColorCreateWithPattern - create with an apporiate colorspace CGColorRelease CGColorEqualToColor CGColorGetAlpha
…f the colorspace that is associated with the CGColor. Our Color is limited in support, we only support RGB & Grayscale colors.
…onents. Enabling disabled tests + enhancing existing tests.
…to CGColor is an instance of UIColor (which is lazy loaded). Thus for CGColorTests to run we need the UIKit DLL to be loaded. Note: The CGColorTests are appended with [UIColor class] to support the UIKit dll to be part of the test run.
fae1f0a
to
0048efb
Compare
The CGColor is still a UIColor class [re-implementation is planned], but we have improved the functionality.
fixes #2041