Suggestion: subclass CgDeviceIndependentImage by depth

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggestion: subclass CgDeviceIndependentImage by depth

bgridley-2
CgDeviceIndependentImage has a series of methods (e.g.#putPixels:y:width:pixels:startIndex:) that run thru a bunch of if checks based on the depth variable.
It seems like when the object is created, an appropriate subclass should be instantiated based on depth.  I don't know offhand if performance would change significantly, but it would definitely be better code.  The new classes might be named  CgDeviceIndependentDepth1Image,CgDeviceIndependentDepth4Image and so on. Is there any reason (other than it has always been this way) not to make this change? 

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion: subclass CgDeviceIndependentImage by depth

John O'Keefe-3
This is an interesting idea. It can be appealing to replace inline testing with subclassing so that polymorphic message sends can be used in place of the tests. This results in cleaner code and can sometimes improve performance. However, before making such a change we need to evaluate the impact of the restructuring on existing product and customer code. I will add your suggestion to our list of possible future enhancements.
 
Thank you for your interest in improving the VA Smalltalk codebase.
 
John

On Wednesday, January 30, 2013 1:18:02 PM UTC-5, [hidden email] wrote:
CgDeviceIndependentImage has a series of methods (e.g.#putPixels:y:width:pixels:startIndex:) that run thru a bunch of if checks based on the depth variable.
It seems like when the object is created, an appropriate subclass should be instantiated based on depth.  I don't know offhand if performance would change significantly, but it would definitely be better code.  The new classes might be named  CgDeviceIndependentDepth1Image,CgDeviceIndependentDepth4Image and so on. Is there any reason (other than it has always been this way) not to make this change? 

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.