Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: src/core/SkLiteDL.cpp

Issue 2228203002: constexpr infinity (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698