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

Side by Side Diff: src/effects/SkLayerRasterizer.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 8
9 #include "SkLayerRasterizer.h" 9 #include "SkLayerRasterizer.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 buffer.readPaint(&rec->fPaint); 159 buffer.readPaint(&rec->fPaint);
160 buffer.readPoint(&rec->fOffset); 160 buffer.readPoint(&rec->fOffset);
161 } 161 }
162 return layers; 162 return layers;
163 } 163 }
164 164
165 void SkLayerRasterizer::flatten(SkWriteBuffer& buffer) const { 165 void SkLayerRasterizer::flatten(SkWriteBuffer& buffer) const {
166 this->INHERITED::flatten(buffer); 166 this->INHERITED::flatten(buffer);
167 167
168 SkASSERT(fLayers); 168 SkASSERT(fLayers);
169 buffer.writeInt(fLayers->count()); 169 buffer.writeInt("layerCount", fLayers->count());
170 170
171 SkDeque::F2BIter iter(*fLayers); 171 SkDeque::F2BIter iter(*fLayers);
172 const SkLayerRasterizer_Rec* rec; 172 const SkLayerRasterizer_Rec* rec;
173 173
174 while ((rec = (const SkLayerRasterizer_Rec*)iter.next()) != nullptr) { 174 while ((rec = (const SkLayerRasterizer_Rec*)iter.next()) != nullptr) {
175 buffer.writePaint(rec->fPaint); 175 buffer.writePaint("fPaint", rec->fPaint);
176 buffer.writePoint(rec->fOffset); 176 buffer.writePoint("fOffset", rec->fOffset);
177 } 177 }
178 } 178 }
179 179
180 SkLayerRasterizer::Builder::Builder() : fLayers(new SkDeque(sizeof(SkLayerRaster izer_Rec))) {} 180 SkLayerRasterizer::Builder::Builder() : fLayers(new SkDeque(sizeof(SkLayerRaster izer_Rec))) {}
181 181
182 SkLayerRasterizer::Builder::~Builder() 182 SkLayerRasterizer::Builder::~Builder()
183 { 183 {
184 if (fLayers != nullptr) { 184 if (fLayers != nullptr) {
185 clean_up_layers(fLayers); 185 clean_up_layers(fLayers);
186 } 186 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != nullp tr) { 218 while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != nullp tr) {
219 SkDEBUGCODE(count++); 219 SkDEBUGCODE(count++);
220 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay ers->push_back()); 220 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay ers->push_back());
221 new (&recCopy->fPaint) SkPaint(recOrig->fPaint); 221 new (&recCopy->fPaint) SkPaint(recOrig->fPaint);
222 recCopy->fOffset = recOrig->fOffset; 222 recCopy->fOffset = recOrig->fOffset;
223 } 223 }
224 SkASSERT(fLayers->count() == count); 224 SkASSERT(fLayers->count() == count);
225 SkASSERT(layers->count() == count); 225 SkASSERT(layers->count() == count);
226 return sk_sp<SkLayerRasterizer>(new SkLayerRasterizer(layers)); 226 return sk_sp<SkLayerRasterizer>(new SkLayerRasterizer(layers));
227 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698