| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2012 Google Inc. | 2  * Copyright 2012 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #include "GrPath.h" | 8 #include "GrPath.h" | 
| 9 | 9 | 
| 10 SK_DEFINE_INST_COUNT(GrPath) | 10 SK_DEFINE_INST_COUNT(GrPath) | 
|  | 11 | 
|  | 12 GrResourceKey GrPath::ComputeKey(const SkPath& path, const SkStrokeRec& stroke) 
    { | 
|  | 13     static const GrResourceKey::ResourceType gPathResourceType = GrResourceKey::
    GenerateResourceType(); | 
|  | 14     static const GrCacheID::Domain gPathDomain = GrCacheID::GenerateDomain(); | 
|  | 15 | 
|  | 16     GrCacheID::Key key; | 
|  | 17     uint32_t* keyData = key.fData32; | 
|  | 18     keyData[0] = path.getGenerationID(); | 
|  | 19 | 
|  | 20     SK_COMPILE_ASSERT(SkPaint::kJoinCount <= 3, cap_shift_will_be_wrong); | 
|  | 21     keyData[1] = stroke.needToApply(); | 
|  | 22     if (0 != keyData[1]) { | 
|  | 23         keyData[1] |= stroke.getJoin() << 1; | 
|  | 24         keyData[1] |= stroke.getCap() << 3; | 
|  | 25         keyData[2] = static_cast<uint32_t>(stroke.getMiter()); | 
|  | 26         keyData[3] = static_cast<uint32_t>(stroke.getWidth()); | 
|  | 27     } else { | 
|  | 28         keyData[2] = 0; | 
|  | 29         keyData[3] = 0; | 
|  | 30     } | 
|  | 31 | 
|  | 32     return GrResourceKey(GrCacheID(gPathDomain, key), gPathResourceType, 0); | 
|  | 33 } | 
| OLD | NEW | 
|---|