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

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

Issue 1351453004: use allocator (if present) when we allocate our cache bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fission out test change to separate CL Created 5 years, 3 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 | include/core/SkImageGenerator.h » ('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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 }; 60 };
61 // assumes ownership of colors (assumes it was allocated w/ malloc) 61 // assumes ownership of colors (assumes it was allocated w/ malloc)
62 SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc); 62 SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc);
63 63
64 SkPMColor* fColors; 64 SkPMColor* fColors;
65 SkOncePtr<uint16_t[]> f16BitCache; 65 SkOncePtr<uint16_t[]> f16BitCache;
66 int fCount; 66 int fCount;
67 67
68 void init(const SkPMColor* colors, int count); 68 void init(const SkPMColor* colors, int count);
69 69
70 friend class SkImageGenerator;
71 // Only call if no other thread or cache has seen this table.
72 void dangerous_overwriteColors(const SkPMColor newColors[], int count) {
73 if (count < 0 || count > fCount) {
74 sk_throw();
75 }
76 // assumes that f16BitCache nas NOT been initialized yet, so we don't tr y to update it
77 memcpy(fColors, newColors, count * sizeof(SkPMColor));
78 fCount = count; // update fCount, in case count is smaller
79 }
80
70 typedef SkRefCnt INHERITED; 81 typedef SkRefCnt INHERITED;
71 }; 82 };
72 83
73 #endif 84 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkImageGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698