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

Side by Side Diff: src/effects/SkLayerRasterizer.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « src/effects/SkLayerDrawLooper.cpp ('k') | src/effects/SkLightingImageFilter.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 * 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) { 138 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) {
139 drawMatrix = translatedMatrix; 139 drawMatrix = translatedMatrix;
140 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY); 140 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY);
141 draw.drawPath(path, rec->fPaint); 141 draw.drawPath(path, rec->fPaint);
142 } 142 }
143 } 143 }
144 return true; 144 return true;
145 } 145 }
146 146
147 SkFlattenable* SkLayerRasterizer::CreateProc(SkReadBuffer& buffer) { 147 sk_sp<SkFlattenable> SkLayerRasterizer::CreateProc(SkReadBuffer& buffer) {
148 return new SkLayerRasterizer(ReadLayers(buffer)); 148 return sk_sp<SkFlattenable>(new SkLayerRasterizer(ReadLayers(buffer)));
149 } 149 }
150 150
151 SkDeque* SkLayerRasterizer::ReadLayers(SkReadBuffer& buffer) { 151 SkDeque* SkLayerRasterizer::ReadLayers(SkReadBuffer& buffer) {
152 int count = buffer.readInt(); 152 int count = buffer.readInt();
153 153
154 SkDeque* layers = new SkDeque(sizeof(SkLayerRasterizer_Rec)); 154 SkDeque* layers = new SkDeque(sizeof(SkLayerRasterizer_Rec));
155 for (int i = 0; i < count; i++) { 155 for (int i = 0; i < count; i++) {
156 SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)layers->push_back() ; 156 SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)layers->push_back() ;
157 157
158 new (&rec->fPaint) SkPaint; 158 new (&rec->fPaint) SkPaint;
(...skipping 59 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
« no previous file with comments | « src/effects/SkLayerDrawLooper.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698