Revert 6914 to fix build issues.



git-svn-id: http://skia.googlecode.com/svn/trunk@6915 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrCacheID.cpp b/src/gpu/GrCacheID.cpp
index ce47af3..4c6dd49 100644
--- a/src/gpu/GrCacheID.cpp
+++ b/src/gpu/GrCacheID.cpp
@@ -5,21 +5,40 @@
  * found in the LICENSE file.
  */
 
-#include "GrTypes.h"
+#include "GrCacheID.h"
 #include "SkThread.h"       // for sk_atomic_inc
 
-static const GrCacheID::Key kAssertKey;
-GR_STATIC_ASSERT(sizeof(kAssertKey.fData8)  == sizeof(kAssertKey.fData32));
-GR_STATIC_ASSERT(sizeof(kAssertKey.fData8) == sizeof(kAssertKey.fData64));
-GR_STATIC_ASSERT(sizeof(kAssertKey.fData8) == sizeof(kAssertKey));
-
-GrCacheID::Domain GrCacheID::GenerateDomain() {
-    static int32_t gNextDomain = kInvalid_Domain + 1;
+uint8_t GrCacheID::GetNextDomain() {
+    // 0 reserved for kUnrestricted_ResourceDomain
+    static int32_t gNextDomain = 1;
 
     int32_t domain = sk_atomic_inc(&gNextDomain);
-    if (domain >= 1 << (8 * sizeof(Domain))) {
+    if (domain >= 256) {
         GrCrash("Too many Cache Domains");
     }
 
-    return static_cast<Domain>(domain);
+    return (uint8_t) domain;
+}
+
+uint8_t GrCacheID::GetNextResourceType() {
+    // 0 reserved for kInvalid_ResourceType
+    static int32_t gNextResourceType = 1;
+
+    int32_t type = sk_atomic_inc(&gNextResourceType);
+    if (type >= 256) {
+        GrCrash("Too many Cache Resource Types");
+    }
+
+    return (uint8_t) type;
+}
+
+void GrCacheID::toRaw(uint32_t v[4]) {
+    GrAssert(4*sizeof(uint32_t) == sizeof(GrCacheID));
+
+    v[0] = (uint32_t) (fPublicID & 0xffffffffUL);
+    v[1] = (uint32_t) ((fPublicID >> 32) & 0xffffffffUL);
+    v[2] = fResourceSpecific32;
+    v[3] = fDomain << 24 |
+           fResourceType << 16 |
+           fResourceSpecific16;
 }