| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrStrokeInfo.h" | 8 #include "GrStrokeInfo.h" |
| 9 #include "GrResourceKey.h" | 9 #include "GrResourceKey.h" |
| 10 #include "SkDashPathPriv.h" | 10 #include "SkDashPathPriv.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 const int kSkScalarData32Cnt = sizeof(SkScalar) / sizeof(uint32_t); | 29 const int kSkScalarData32Cnt = sizeof(SkScalar) / sizeof(uint32_t); |
| 30 enum { | 30 enum { |
| 31 kStyleBits = 2, | 31 kStyleBits = 2, |
| 32 kJoinBits = 2, | 32 kJoinBits = 2, |
| 33 kCapBits = 32 - kStyleBits - kJoinBits, | 33 kCapBits = 32 - kStyleBits - kJoinBits, |
| 34 | 34 |
| 35 kJoinShift = kStyleBits, | 35 kJoinShift = kStyleBits, |
| 36 kCapShift = kJoinShift + kJoinBits, | 36 kCapShift = kJoinShift + kJoinBits, |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 SK_COMPILE_ASSERT(SkStrokeRec::kStyleCount <= (1 << kStyleBits), style_shift
_will_be_wrong); | 39 static_assert(SkStrokeRec::kStyleCount <= (1 << kStyleBits), "style_shift_wi
ll_be_wrong"); |
| 40 SK_COMPILE_ASSERT(SkPaint::kJoinCount <= (1 << kJoinBits), cap_shift_will_be
_wrong); | 40 static_assert(SkPaint::kJoinCount <= (1 << kJoinBits), "cap_shift_will_be_wr
ong"); |
| 41 SK_COMPILE_ASSERT(SkPaint::kCapCount <= (1 << kCapBits), cap_does_not_fit); | 41 static_assert(SkPaint::kCapCount <= (1 << kCapBits), "cap_does_not_fit"); |
| 42 uint32_t styleKey = this->getStyle(); | 42 uint32_t styleKey = this->getStyle(); |
| 43 if (this->needToApply()) { | 43 if (this->needToApply()) { |
| 44 styleKey |= this->getJoin() << kJoinShift; | 44 styleKey |= this->getJoin() << kJoinShift; |
| 45 styleKey |= this->getCap() << kCapShift; | 45 styleKey |= this->getCap() << kCapShift; |
| 46 } | 46 } |
| 47 int i = 0; | 47 int i = 0; |
| 48 data[i++] = styleKey; | 48 data[i++] = styleKey; |
| 49 | 49 |
| 50 // Memcpy the scalar fields. Does not "reinterpret_cast<SkScalar&>(data[i])
= ..." due to | 50 // Memcpy the scalar fields. Does not "reinterpret_cast<SkScalar&>(data[i])
= ..." due to |
| 51 // scalars having more strict alignment requirements than what data can guar
antee. The | 51 // scalars having more strict alignment requirements than what data can guar
antee. The |
| (...skipping 17 matching lines...) Expand all Loading... |
| 69 const SkScalar* intervals = this->getDashIntervals(); | 69 const SkScalar* intervals = this->getDashIntervals(); |
| 70 int intervalByteCnt = count * sizeof(SkScalar); | 70 int intervalByteCnt = count * sizeof(SkScalar); |
| 71 memcpy(&data[i], intervals, intervalByteCnt); | 71 memcpy(&data[i], intervals, intervalByteCnt); |
| 72 // Enable the line below if fields are added after dashing. | 72 // Enable the line below if fields are added after dashing. |
| 73 SkDEBUGCODE(i += kSkScalarData32Cnt * count); | 73 SkDEBUGCODE(i += kSkScalarData32Cnt * count); |
| 74 } | 74 } |
| 75 | 75 |
| 76 SkASSERT(this->computeUniqueKeyFragmentData32Cnt() == i); | 76 SkASSERT(this->computeUniqueKeyFragmentData32Cnt() == i); |
| 77 } | 77 } |
| 78 | 78 |
| OLD | NEW |