DescriptionThis change implements image filter processing during SkCanvas::drawSprite(), similar to how it's done in SkCanvas::drawDevice().
On the GPU side, all of the image filtering code was moved from SkGpuDevice::drawSprite() (which no longer needs to do it, since it's handled at the SkCanvas level) to SkGpuDevice::filterImage(). By performing image filtering directly in filterImage(), we can save one texture allocation and draw by returning a texture-backed bitmap instead. By calling drawSprite() directly in the GM samples instead of using saveLayer()/restore(), we save another texture allocation and draw.
I also made SkGpuDevice::drawSprite() avoid locking pixels when called with a texture-backed bitmap, an idea I cribbed from SkGpuDevice::internalDrawBitmap(). This gave a 3X speedup on one sample (I'm guessing it's avoiding a readback in that case).
All told, these changes improve GPU performance on the morphology sample by 13X, and improve CPU performance by about 3%. On the imageblur sample, GPU performance is improved by 46X, and CPU performance by 2.2X (the latter is a bit of an apples-to-oranges comparsion, though, since some of the gain comes from cacheing the source bitmap and only doing the blur in onDraw()).
Finally, I fixed command line parsing of test names in SampleApp, and added a 'q' hotkey for exiting SampleApp (there didn't seem to be any way to exit it cleanly on Linux, needed for profiling). These could be moved to another patch if desired.
Patch Set 1 #Patch Set 2 : Mike's + option1 (filters supported on GPU side in drawSprite, drawDevice, filterImage) #Patch Set 3 : Mike's + option2 (filters supported on GPU side only in filterImage) #
MessagesTotal messages: 8
|