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