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

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

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites Created 4 years, 8 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 2014 Google Inc. 2 * Copyright 2014 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 "SkTextBlobRunIterator.h" 8 #include "SkTextBlobRunIterator.h"
9 9
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 const RunRecord* nextRun = RunRecord::Next(run); 214 const RunRecord* nextRun = RunRecord::Next(run);
215 SkDEBUGCODE(run->validate((uint8_t*)this + fStorageSize);) 215 SkDEBUGCODE(run->validate((uint8_t*)this + fStorageSize);)
216 run->~RunRecord(); 216 run->~RunRecord();
217 run = nextRun; 217 run = nextRun;
218 } 218 }
219 } 219 }
220 220
221 void SkTextBlob::flatten(SkWriteBuffer& buffer) const { 221 void SkTextBlob::flatten(SkWriteBuffer& buffer) const {
222 int runCount = fRunCount; 222 int runCount = fRunCount;
223 223
224 buffer.write32(runCount); 224 buffer.write32("runCount", runCount);
225 buffer.writeRect(fBounds); 225 buffer.writeRect("fBounds", fBounds);
226 226
227 SkPaint runPaint; 227 SkPaint runPaint;
228 SkTextBlobRunIterator it(this); 228 SkTextBlobRunIterator it(this);
229 while (!it.done()) { 229 while (!it.done()) {
230 SkASSERT(it.glyphCount() > 0); 230 SkASSERT(it.glyphCount() > 0);
231 231
232 buffer.write32(it.glyphCount()); 232 buffer.write32("glyphCount", it.glyphCount());
233 buffer.write32(it.positioning()); 233 buffer.write32("positioning", it.positioning());
234 buffer.writePoint(it.offset()); 234 buffer.writePoint("offset", it.offset());
235 // This should go away when switching to SkFont 235 // This should go away when switching to SkFont
236 it.applyFontToPaint(&runPaint); 236 it.applyFontToPaint(&runPaint);
237 buffer.writePaint(runPaint); 237 buffer.writePaint("runPaint", runPaint);
238 238
239 buffer.writeByteArray(it.glyphs(), it.glyphCount() * sizeof(uint16_t)); 239 buffer.writeByteArray("glyphs", it.glyphs(), it.glyphCount() * sizeof(ui nt16_t));
240 buffer.writeByteArray(it.pos(), 240 buffer.writeByteArray("positions", it.pos(),
241 it.glyphCount() * sizeof(SkScalar) * ScalarsPerGlyph(it.positioning( ))); 241 it.glyphCount() * sizeof(SkScalar) * ScalarsPerGlyph(it.positioning( )));
242 242
243 it.next(); 243 it.next();
244 SkDEBUGCODE(runCount--); 244 SkDEBUGCODE(runCount--);
245 } 245 }
246 SkASSERT(0 == runCount); 246 SkASSERT(0 == runCount);
247 } 247 }
248 248
249 const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) { 249 const SkTextBlob* SkTextBlob::CreateFromBuffer(SkReadBuffer& reader) {
250 int runCount = reader.read32(); 250 int runCount = reader.read32();
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 ) 639 )
640 640
641 fStorageUsed = 0; 641 fStorageUsed = 0;
642 fStorageSize = 0; 642 fStorageSize = 0;
643 fRunCount = 0; 643 fRunCount = 0;
644 fLastRun = 0; 644 fLastRun = 0;
645 fBounds.setEmpty(); 645 fBounds.setEmpty();
646 646
647 return blob; 647 return blob;
648 } 648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698