archagon / tasty-imitation-keyboard

A custom keyboard for iOS8 that serves as a tasty imitation of the default Apple keyboard. Built using Swift and the latest Apple technologies!
BSD 3-Clause "New" or "Revised" License
1.2k stars 290 forks source link

Typing is laggy in dark mode, especially in landscape. #15

Closed archagon closed 9 years ago

archagon commented 10 years ago

I have to use layer masks to make the keys and popups have the blur effect, but unfortunately this appears to significantly slow down rendering. Not sure how to fix without getting rid of blur effect — which is pretty important!

alariccole commented 10 years ago

What is the blur effect? I guess I've not noticed it. If you can point me to where this drawing occurs, I might have more ideas. But all I can think of is, the blur could be cached, so it's only calculated once, and moved/hidden as needed, instead of drawing on each touch. Alternative the blur could be sped up by more efficient snapshotting.

archagon commented 10 years ago

The blur appears a) on the special keys (shift, backspace, mode changes, return) in light mode, and b) on every key in dark mode (which you can see by doing a home screen search).

alariccole commented 10 years ago

You mean shadows? I'm not seeing any blur.

archagon commented 10 years ago

I'm talking about the default system keyboard. Open the system keyboard in dark mode in the hosting app. Look how the color subtly changes for each key depending on area of the background image that it covers. This is especially visible with the popups. (This only works on devices which support iOS7's new blur effects.)

alariccole commented 10 years ago

I didn't realize the keys were slightly transparent. So, you're using visual effect views, and masking them to a shape, to make them rounded rects? You could try setting shouldRasterize to true on some of the layers (with rasterizationScale set to the screen's scale), to reduce drawing.

archagon commented 10 years ago

That's right -- though I think this was the wrong approach as reading some slides from WWDC indicates that UIVisualEffectViews should not be using layer masks. I will have to try the static blur technique to see if it works the same.

I did try to fiddle with shouldRasterize and I don't think it did much.

archagon commented 9 years ago

Made a tradeoff: slightly less accurate graphics for performance. Dark mode looks correct, except for popups.