diff options
author | bsalomon <bsalomon@google.com> | 2016-01-22 07:17:34 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-22 07:17:34 -0800 |
commit | 6c9cd55f00beeba3ded3f28bcbdd6ef030c4dac7 (patch) | |
tree | 4735ccb16f832288485ce10c65fb2620beece67e /src/gpu/GrSwizzle.h | |
parent | 0ac723b6f4502d96a0fb5c2ad6a69994afe0347c (diff) |
Make swizzling in read/write pixel copy code more generic
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1617433002
Review URL: https://codereview.chromium.org/1617433002
Diffstat (limited to 'src/gpu/GrSwizzle.h')
-rw-r--r-- | src/gpu/GrSwizzle.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gpu/GrSwizzle.h b/src/gpu/GrSwizzle.h index 48748803dd..c2288b2fe4 100644 --- a/src/gpu/GrSwizzle.h +++ b/src/gpu/GrSwizzle.h @@ -8,8 +8,8 @@ #ifndef GrSwizzle_DEFINED #define GrSwizzle_DEFINED -#include "GrTypes.h" #include "GrColor.h" +#include "SkRandom.h" /** Represents a rgba swizzle. It can be converted either into a string or a eight bit int. Currently there is no way to specify an arbitrary swizzle, just some static swizzles and an @@ -84,6 +84,22 @@ public: return gBGRA; } + static const GrSwizzle& CreateRandom(SkRandom* random) { + switch (random->nextU() % 4) { + case 0: + return RGBA(); + case 1: + return BGRA(); + case 2: + return RRRR(); + case 3: + return AAAA(); + default: + SkFAIL("Mod is broken?!?"); + return RGBA(); + } + } + private: char fSwiz[5]; uint8_t fKey; |