-
mitsuma_jp
- 805
- 0
- 0
- 0
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Optimizing 2D Graphics and Animation Performance を見た。
2012-08-20 22:04:05![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
CALayer.shouldRasterize = YES でbitmap cache ができます。が、time vs memory の trade-off です。
2012-08-20 22:09:37![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
可能な限り、setNeedsDisplayInRectね。clipされたcontextが渡されるから描画コードは意識しなくていいんだ。って知らなくて全部描いてたなー。なのでdirtyRect == viewFrameとして使っちゃだめだよね。
2012-08-20 22:58:44![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Core Animation のinstulmentsでColor Brend Layersを試す。真っ赤だ!
2012-08-21 00:23:09![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
複数のLayerがブレンドされている箇所が赤くなり、赤色を減らしていけばパフォーマンスが劇的に改善されるぜとGuideに書いてある。OSのキーボードは下の角丸部分だけ赤い。
2012-08-21 00:27:15![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
profile中はOS全体がそのモードになるから、アプリをバックグラウンドにすれば他のアプリではどうなってるかも参考にできるな。
2012-08-21 00:47:52![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
CALayerのactionForKeyをオーバーライドして特定のevent時にnilを返せばデフォルトでanimatableのものを無効にできるのね。
2012-08-21 01:20:09![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
drawRect禁止令(大げさ)な雰囲気でしたが、viewをカスタムする=Layerレベルの話になってくると。CPUの仕事を少なくせよと。layerのプロパティでいいじゃんと。contents使えよ、drawやめろと。
2012-08-23 23:50:57![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
drawRect時のContextはLayerのbackingStoreのやつだから、drawRectやめればbackingStoreも無くなるよと。LayerTreeとかCoreAnimation勉強して目指せ60fps
2012-08-23 23:57:19