aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSwizzle.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-01-22 07:17:34 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-22 07:17:34 -0800
commit6c9cd55f00beeba3ded3f28bcbdd6ef030c4dac7 (patch)
tree4735ccb16f832288485ce10c65fb2620beece67e /src/gpu/GrSwizzle.h
parent0ac723b6f4502d96a0fb5c2ad6a69994afe0347c (diff)
Make swizzling in read/write pixel copy code more generic
Diffstat (limited to 'src/gpu/GrSwizzle.h')
-rw-r--r--src/gpu/GrSwizzle.h18
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;