使用 CIContext 渲染时上下文无效
我有一个 NSView,它在 drawRect: 方法中渲染一些 CoreImage 的东西。当我在硬件加速上下文中渲染时,一切工作正常,但如果我切换到软件模式,每次渲染的控制台中都会出现错误消息:
<Error>: CGBitmapContextGetBitsPerComponent: invalid context 0x1084740 This isn't a bitmap context. Forcing destination format to ARGB_8 for CGContext.
<Error>: CGBitmapContextGetBitsPerComponent: invalid context 0x1084740
当我将 Quartz 组合渲染到 NSView 的 CIContext 时,会发生类似的问题。我从 QCRenderer 获取 CIImage 并在 drawRect: 方法中绘制它,但是,每次 [CIContext drawImage:] 调用时都会出现错误:
<Error>: unknown error code: invalid context
尽管存在此错误,但实际渲染还是成功的,并且一切看起来都很好(视觉上)。当我在屏幕上渲染时,似乎会发生此问题,渲染到屏幕外位图上下文不会导致此类问题。
谁能说一下在屏幕上绘图时如何避免这个问题(除了使用屏幕外内存缓冲区进行绘图 - 它太慢了)?
I have a NSView that renders some CoreImage stuff in drawRect: method. Everything works fine while I'm rendering on hw-accelerated context, but if I switch to software mode, I have error messages in console for each render:
<Error>: CGBitmapContextGetBitsPerComponent: invalid context 0x1084740 This isn't a bitmap context. Forcing destination format to ARGB_8 for CGContext.
<Error>: CGBitmapContextGetBitsPerComponent: invalid context 0x1084740
Similar issue happens when I render Quartz composition to the CIContext of my NSView. I get a CIImage from QCRenderer and draw it in drawRect: method, however, I have an error each [CIContext drawImage:] call:
<Error>: unknown error code: invalid context
Despite of this error the actual rendering is successful and everything looks fine (visually). It looks like this issues happen when I'm rendering on screen, rendering to an offscreen bitmap context doesn't cause such issue.
Can anyone say how to avoid this issues while drawing on screen (except of using offscreen memory buffer to draw - it's to slow)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论