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

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

Issue 1982753002: Ensure that SkColorTable->fCount is set properly after decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « dm/DMSrcSink.cpp ('k') | src/android/SkBitmapRegionCodec.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc); 62 SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc);
63 63
64 SkPMColor* fColors; 64 SkPMColor* fColors;
65 mutable uint16_t* f16BitCache = nullptr; 65 mutable uint16_t* f16BitCache = nullptr;
66 mutable SkOnce f16BitCacheOnce; 66 mutable SkOnce f16BitCacheOnce;
67 int fCount; 67 int fCount;
68 68
69 void init(const SkPMColor* colors, int count); 69 void init(const SkPMColor* colors, int count);
70 70
71 friend class SkImageGenerator; 71 friend class SkImageGenerator;
72 friend class SkBitmapRegionCodec;
72 // Only call if no other thread or cache has seen this table. 73 // Only call if no other thread or cache has seen this table.
73 void dangerous_overwriteColors(const SkPMColor newColors[], int count) { 74 void dangerous_overwriteColors(const SkPMColor newColors[], int count) {
74 if (count < 0 || count > fCount) { 75 if (count < 0 || count > fCount) {
75 sk_throw(); 76 sk_throw();
76 } 77 }
77 // assumes that f16BitCache nas NOT been initialized yet, so we don't tr y to update it 78 // assumes that f16BitCache nas NOT been initialized yet, so we don't tr y to update it
78 memcpy(fColors, newColors, count * sizeof(SkPMColor)); 79 memcpy(fColors, newColors, count * sizeof(SkPMColor));
79 fCount = count; // update fCount, in case count is smaller 80 fCount = count; // update fCount, in case count is smaller
80 } 81 }
81 82
82 typedef SkRefCnt INHERITED; 83 typedef SkRefCnt INHERITED;
83 }; 84 };
84 85
85 #endif 86 #endif
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/android/SkBitmapRegionCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698