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

Side by Side Diff: include/core/SkColorTable.h

Issue 731973005: Add MultiPictureDraw to nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix threading issue in SkColorTable Created 6 years, 1 month 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 | « bench/nanobench.cpp ('k') | src/core/SkColorTable.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkColorTable_DEFINED 10 #ifndef SkColorTable_DEFINED
(...skipping 28 matching lines...) Expand all
39 SkPMColor operator[](int index) const { 39 SkPMColor operator[](int index) const {
40 SkASSERT(fColors != NULL && (unsigned)index < (unsigned)fCount); 40 SkASSERT(fColors != NULL && (unsigned)index < (unsigned)fCount);
41 return fColors[index]; 41 return fColors[index];
42 } 42 }
43 43
44 /** 44 /**
45 * Return the array of colors for reading. This must be balanced by a call 45 * Return the array of colors for reading. This must be balanced by a call
46 * to unlockColors(). 46 * to unlockColors().
47 */ 47 */
48 const SkPMColor* lockColors() { 48 const SkPMColor* lockColors() {
49 SkDEBUGCODE(sk_atomic_inc(&fColorLockCount);) 49 SkDEBUGCODE(sk_atomic_inc(&fColorLockCount);)
mtklein 2014/11/20 14:21:47 It's funny we inline lockColors() and unlock16BitC
50 return fColors; 50 return fColors;
51 } 51 }
52 52
53 /** 53 /**
54 * Balancing call to lockColors(). 54 * Balancing call to lockColors().
55 */ 55 */
56 void unlockColors(); 56 void unlockColors();
57 57
58 /** Similar to lockColors(), lock16BitCache() returns the array of 58 /** Similar to lockColors(), lock16BitCache() returns the array of
59 RGB16 colors that mirror the 32bit colors. However, this function 59 RGB16 colors that mirror the 32bit colors. However, this function
60 will return null if kColorsAreOpaque_Flag is not set. 60 will return null if kColorsAreOpaque_Flag is not set.
61 Also, unlike lockColors(), the returned array here cannot be modified. 61 Also, unlike lockColors(), the returned array here cannot be modified.
62 */ 62 */
63 const uint16_t* lock16BitCache(); 63 const uint16_t* lock16BitCache();
64 /** Balancing call to lock16BitCache(). 64 /** Balancing call to lock16BitCache().
65 */ 65 */
66 void unlock16BitCache() { 66 void unlock16BitCache() {
67 SkASSERT(f16BitCacheLockCount > 0); 67 SkASSERT(f16BitCacheLockCount > 0);
68 SkDEBUGCODE(f16BitCacheLockCount -= 1); 68 SkDEBUGCODE(sk_atomic_dec(&f16BitCacheLockCount);)
69 } 69 }
70 70
71 explicit SkColorTable(SkReadBuffer&); 71 explicit SkColorTable(SkReadBuffer&);
72 void writeToBuffer(SkWriteBuffer&) const; 72 void writeToBuffer(SkWriteBuffer&) const;
73 73
74 private: 74 private:
75 SkPMColor* fColors; 75 SkPMColor* fColors;
76 uint16_t* f16BitCache; 76 uint16_t* f16BitCache;
77 int fCount; 77 int fCount;
78 SkDEBUGCODE(int fColorLockCount;) 78 SkDEBUGCODE(int fColorLockCount;)
79 SkDEBUGCODE(int f16BitCacheLockCount;) 79 SkDEBUGCODE(int f16BitCacheLockCount;)
80 80
81 void init(const SkPMColor* colors, int count); 81 void init(const SkPMColor* colors, int count);
82 82
83 void inval16BitCache(); 83 void inval16BitCache();
84 84
85 typedef SkRefCnt INHERITED; 85 typedef SkRefCnt INHERITED;
86 }; 86 };
87 87
88 #endif 88 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | src/core/SkColorTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698