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

Side by Side Diff: src/core/SkPictureData.h

Issue 2379383002: Propagate validation errors (Closed)
Patch Set: fix spilling Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #ifndef SkPictureData_DEFINED 8 #ifndef SkPictureData_DEFINED
9 #define SkPictureData_DEFINED 9 #define SkPictureData_DEFINED
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 SkDrawable* getDrawable(SkReadBuffer* reader) const { 112 SkDrawable* getDrawable(SkReadBuffer* reader) const {
113 int index = reader->readInt(); 113 int index = reader->readInt();
114 SkASSERT(index > 0 && index <= fDrawableCount); 114 SkASSERT(index > 0 && index <= fDrawableCount);
115 return fDrawableRefs[index - 1]; 115 return fDrawableRefs[index - 1];
116 } 116 }
117 117
118 const SkPaint* getPaint(SkReadBuffer* reader) const { 118 const SkPaint* getPaint(SkReadBuffer* reader) const {
119 const int index = reader->readInt() - 1; 119 const int index = reader->readInt() - 1;
120 if (index == -1) { // recorder wrote a zero for no paint (likely drawim age)
121 return nullptr;
122 }
120 return reader->validateIndex(index, fPaints.count()) ? &fPaints[index] : nullptr; 123 return reader->validateIndex(index, fPaints.count()) ? &fPaints[index] : nullptr;
121 } 124 }
122 125
123 const SkTextBlob* getTextBlob(SkReadBuffer* reader) const { 126 const SkTextBlob* getTextBlob(SkReadBuffer* reader) const {
124 const int index = reader->readInt() - 1; 127 const int index = reader->readInt() - 1;
125 return reader->validateIndex(index, fTextBlobCount) ? fTextBlobRefs[inde x] : nullptr; 128 return reader->validateIndex(index, fTextBlobCount) ? fTextBlobRefs[inde x] : nullptr;
126 } 129 }
127 130
128 #if SK_SUPPORT_GPU 131 #if SK_SUPPORT_GPU
129 /** 132 /**
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 182
180 const SkPictInfo fInfo; 183 const SkPictInfo fInfo;
181 184
182 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); 185 static void WriteFactories(SkWStream* stream, const SkFactorySet& rec);
183 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); 186 static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec);
184 187
185 void initForPlayback() const; 188 void initForPlayback() const;
186 }; 189 };
187 190
188 #endif 191 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698