diff options
author | 2017-04-17 11:48:28 -0400 | |
---|---|---|
committer | 2017-04-17 16:19:37 +0000 | |
commit | 409e74fb2ca2d50f48e3d3e25016059ce57af7ee (patch) | |
tree | 382764737fb6ac1c9e5e025cdf7455e4460ecb81 /include | |
parent | de1cad99b353bad080a04ccfde955a8f3c0af295 (diff) |
Further refactor read/writeSurfacePixels
Detect the situation where we're going to want to do PM/UPM, and want to
use GrConfigConverionEffect, but be unable (due to the lack of a
round-trip pair). This lets us hoist the SW premul work (in
writeSurfacePixels), and avoid all the cascading failure logic in both
functions. (We never try to create the PM/UPM effects unless we know
that they're going to work).
Bug: skia:5853
Change-Id: I0077447cd4be93bba273f8d2826b1ec0f4915c6c
Reviewed-on: https://skia-review.googlesource.com/13592
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrContext.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index f2ba24d4db..08198beb59 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -346,18 +346,20 @@ private: void initCommon(const GrContextOptions&); /** - * These functions create premul <-> unpremul effects if it is possible to generate a pair - * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. Otherwise, they - * return NULL. They also can perform a swizzle as part of the draw. + * These functions create premul <-> unpremul effects. If the second argument is 'true', they + * use the specialized round-trip effects from GrConfigConversionEffect, otherwise they + * create effects that do naive multiply or divide. */ - sk_sp<GrFragmentProcessor> createPMToUPMEffect(sk_sp<GrFragmentProcessor>, GrPixelConfig); - sk_sp<GrFragmentProcessor> createUPMToPMEffect(sk_sp<GrFragmentProcessor>, GrPixelConfig); - /** Called before either of the above two functions to determine the appropriate fragment - processors for conversions. */ - void testPMConversionsIfNecessary(uint32_t flags); - /** Returns true if we've determined that createPMtoUPMEffect and createUPMToPMEffect will - succeed for the passed in config. Otherwise we fall back to SW conversion. */ - bool validPMUPMConversionExists(GrPixelConfig) const; + sk_sp<GrFragmentProcessor> createPMToUPMEffect(sk_sp<GrFragmentProcessor>, + bool useConfigConversionEffect); + sk_sp<GrFragmentProcessor> createUPMToPMEffect(sk_sp<GrFragmentProcessor>, + bool useConfigConversionEffect); + + /** + * Returns true if createPMtoUPMEffect and createUPMToPMEffect will succeed for non-sRGB 8888 + * configs. In other words, did we find a pair of round-trip preserving conversion effects? + */ + bool validPMUPMConversionExists(); /** * A callback similar to the above for use by the TextBlobCache |