Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: src/gpu/GrSwizzle.h

Issue 1617433002: Make swizzling in read/write pixel copy code more generic (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix loop in config conversion test create Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/effects/GrConfigConversionEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrSwizzle.h
diff --git a/src/gpu/GrSwizzle.h b/src/gpu/GrSwizzle.h
index 48748803ddb2d3daceea66233d7a0d238ff61b38..c2288b2fe41863053b38cba236d2792a3bf31bfb 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;
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/effects/GrConfigConversionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698