OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkImageFilter.h" | 10 #include "SkImageFilter.h" |
11 #include "SkLiteDL.h" | 11 #include "SkLiteDL.h" |
12 #include "SkPicture.h" | 12 #include "SkPicture.h" |
13 #include "SkMutex.h" | 13 #include "SkMutex.h" |
14 #include "SkRSXform.h" | 14 #include "SkRSXform.h" |
15 #include "SkSpinlock.h" | 15 #include "SkSpinlock.h" |
16 #include "SkTextBlob.h" | 16 #include "SkTextBlob.h" |
17 #include <math.h> | |
18 | 17 |
19 // A stand-in for an optional SkRect which was not set, e.g. bounds for a saveLa
yer(). | 18 // A stand-in for an optional SkRect which was not set, e.g. bounds for a saveLa
yer(). |
20 static const SkRect kUnset = {(SkScalar)INFINITY, 0,0,0}; | 19 static const SkRect kUnset = { SK_ScalarInfinity, 0,0,0}; |
21 static const SkRect* maybe_unset(const SkRect& r) { | 20 static const SkRect* maybe_unset(const SkRect& r) { |
22 return r.left() == (SkScalar)INFINITY ? nullptr : &r; | 21 return r.left() == SK_ScalarInfinity ? nullptr : &r; |
23 } | 22 } |
24 | 23 |
25 // copy_v(dst, src,n, src,n, ...) copies an arbitrary number of typed srcs into
dst. | 24 // copy_v(dst, src,n, src,n, ...) copies an arbitrary number of typed srcs into
dst. |
26 static void copy_v(void* dst) {} | 25 static void copy_v(void* dst) {} |
27 | 26 |
28 template <typename S, typename... Rest> | 27 template <typename S, typename... Rest> |
29 static void copy_v(void* dst, const S* src, int n, Rest&&... rest) { | 28 static void copy_v(void* dst, const S* src, int n, Rest&&... rest) { |
30 SkASSERTF(((uintptr_t)dst & (alignof(S)-1)) == 0, | 29 SkASSERTF(((uintptr_t)dst & (alignof(S)-1)) == 0, |
31 "Expected %p to be aligned for at least %zu bytes.", dst, alignof(
S)); | 30 "Expected %p to be aligned for at least %zu bytes.", dst, alignof(
S)); |
32 sk_careful_memcpy(dst, src, n*sizeof(S)); | 31 sk_careful_memcpy(dst, src, n*sizeof(S)); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 } | 720 } |
722 | 721 |
723 void SkLiteDL::PurgeFreelist() { | 722 void SkLiteDL::PurgeFreelist() { |
724 SkAutoMutexAcquire lock(gFreeStackLock); | 723 SkAutoMutexAcquire lock(gFreeStackLock); |
725 while (gFreeStack) { | 724 while (gFreeStack) { |
726 SkLiteDL* top = gFreeStack; | 725 SkLiteDL* top = gFreeStack; |
727 gFreeStack = gFreeStack->fNext; | 726 gFreeStack = gFreeStack->fNext; |
728 delete top; // Calling unref() here would just put it back on the list
! | 727 delete top; // Calling unref() here would just put it back on the list
! |
729 } | 728 } |
730 } | 729 } |
OLD | NEW |