Further unify logic in readSurfacePixels and writeSurfacePixels
authorBrian Osman <brianosman@google.com>
Thu, 13 Apr 2017 18:03:57 +0000 (14:03 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 13 Apr 2017 18:43:16 +0000 (18:43 +0000)
commitd2ca59a1cd39f81d4fb05be253bc3803daa23210
tree6a9ea3ed9bc451b8fb65e096ba0f93ea94069331
parent9428a37255586da6d34b86c6ed0d56729dbfd731
Further unify logic in readSurfacePixels and writeSurfacePixels

Hoist simple failure checks to the beginning, apply logic in the same
sequence in both functions. Factor out some common logic. Remove redundant
checking inside other helper functions (that are only used from here).

I'm inching towards better sRGB and color-conversion support in these
functions, but I don't want that intertwined with the legacy premul
software fallback. Next step is probably to diverge at the top-level,
and keep the current code as "legacy" versions, with new versions that
don't have the fallback logic, only used for configs and color space
scenarios where it doesn't matter.

Bug: skia:5853
Change-Id: I327be5f0186a16ceda9440670fb0646acaef7766
Reviewed-on: https://skia-review.googlesource.com/13337
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
src/gpu/GrContext.cpp
src/gpu/GrGpu.cpp