Thread with 4 posts
jump to expanded posttoday's progress on implementing UIKit and Core Animation in touchHLE: layer delegates/views can now draw stuff
https://github.com/hikari-no-yume/touchHLE/commit/f6775e74627578d0db5ab38de86c2bf55ca62073
but there's an inefficiency… an empty view that draws nothing will get a whole bitmap and corresponding CGBitmapContext allocated for it, because my UIView provides drawLayer:inContext: (which calls drawRect:). ideally I'd only do this if drawRect: isn't overridden, and I can only assume that's what Apple do. but how do they do that? there isn't a documented mechanism for this. does their CALayer have special knowledge of UIView? 🤔
@hikari Objective-C does let you check if a method is overridden: check if the IMP for the receiver is the same as the IMP used by the base class. Kind of clunky but certainly doable.
@jrose oh yeah I don't mean there isn't a mechanism for checking — and if there wasn't, I could add one anyway, it's my runtime ;) — but rather that I don't know how I could make UIView, like, conditionally opt in to bitmap drawing… though I mean, conditionally responding to drawLayer:inContext: would theoretically be possible… oh god