1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/gpu/GrKey.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +/* 1.5 + * Copyright 2010 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef GrKey_DEFINED 1.12 +#define GrKey_DEFINED 1.13 + 1.14 +class GrKey : public SkRefCnt { 1.15 +public: 1.16 + SK_DECLARE_INST_COUNT(GrKey) 1.17 + 1.18 + typedef intptr_t Hash; 1.19 + 1.20 + explicit GrKey(Hash hash) : fHash(hash) {} 1.21 + 1.22 + intptr_t getHash() const { return fHash; } 1.23 + 1.24 + bool operator<(const GrKey& rh) const { 1.25 + return fHash < rh.fHash || (fHash == rh.fHash && this->lt(rh)); 1.26 + } 1.27 + bool operator==(const GrKey& rh) const { 1.28 + return fHash == rh.fHash && this->eq(rh); 1.29 + } 1.30 + 1.31 +protected: 1.32 + virtual bool lt(const GrKey& rh) const = 0; 1.33 + virtual bool eq(const GrKey& rh) const = 0; 1.34 + 1.35 +private: 1.36 + const Hash fHash; 1.37 + 1.38 + typedef SkRefCnt INHERITED; 1.39 +}; 1.40 + 1.41 +#endif