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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/core/SkRecordDraw.cpp ('k') | src/core/SkRecordPattern.h » ('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 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 "SkRecordOpts.h" 8 #include "SkRecordOpts.h"
9 9
10 #include "SkRecordPattern.h" 10 #include "SkRecordPattern.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 // For some SaveLayer-[drawing command]-Restore patterns, merge the SaveLayer's alpha into the 146 // For some SaveLayer-[drawing command]-Restore patterns, merge the SaveLayer's alpha into the
147 // draw, and no-op the SaveLayer and Restore. 147 // draw, and no-op the SaveLayer and Restore.
148 struct SaveLayerDrawRestoreNooper { 148 struct SaveLayerDrawRestoreNooper {
149 typedef Pattern3<Is<SaveLayer>, IsDraw, Is<Restore> > Pattern; 149 typedef Pattern3<Is<SaveLayer>, IsDraw, Is<Restore> > Pattern;
150 150
151 bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) { 151 bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
152 // A SaveLayer's bounds field is just a hint, so we should be free to ig nore it. 152 // A SaveLayer's bounds field is just a hint, so we should be free to ig nore it.
153 SkPaint* layerPaint = pattern->first<SaveLayer>()->paint; 153 SkPaint* layerPaint = pattern->first<SaveLayer>()->paint;
154 if (NULL == layerPaint) { 154 if (nullptr == layerPaint) {
155 // There wasn't really any point to this SaveLayer at all. 155 // There wasn't really any point to this SaveLayer at all.
156 return KillSaveLayerAndRestore(record, begin); 156 return KillSaveLayerAndRestore(record, begin);
157 } 157 }
158 158
159 SkPaint* drawPaint = pattern->second<SkPaint>(); 159 SkPaint* drawPaint = pattern->second<SkPaint>();
160 if (drawPaint == NULL) { 160 if (drawPaint == nullptr) {
161 // We can just give the draw the SaveLayer's paint. 161 // We can just give the draw the SaveLayer's paint.
162 // TODO(mtklein): figure out how to do this clearly 162 // TODO(mtklein): figure out how to do this clearly
163 return false; 163 return false;
164 } 164 }
165 165
166 if (!fold_opacity_layer_color_to_paint(*layerPaint, false /*isSaveLayer* /, drawPaint)) { 166 if (!fold_opacity_layer_color_to_paint(*layerPaint, false /*isSaveLayer* /, drawPaint)) {
167 return false; 167 return false;
168 } 168 }
169 169
170 return KillSaveLayerAndRestore(record, begin); 170 return KillSaveLayerAndRestore(record, begin);
(...skipping 19 matching lines...) Expand all
190 Restore 190 Restore
191 Restore 191 Restore
192 Restore 192 Restore
193 */ 193 */
194 struct SvgOpacityAndFilterLayerMergePass { 194 struct SvgOpacityAndFilterLayerMergePass {
195 typedef Pattern7<Is<SaveLayer>, Is<Save>, Is<ClipRect>, Is<SaveLayer>, 195 typedef Pattern7<Is<SaveLayer>, Is<Save>, Is<ClipRect>, Is<SaveLayer>,
196 Is<Restore>, Is<Restore>, Is<Restore> > Pattern; 196 Is<Restore>, Is<Restore>, Is<Restore> > Pattern;
197 197
198 bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) { 198 bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
199 SkPaint* opacityPaint = pattern->first<SaveLayer>()->paint; 199 SkPaint* opacityPaint = pattern->first<SaveLayer>()->paint;
200 if (NULL == opacityPaint) { 200 if (nullptr == opacityPaint) {
201 // There wasn't really any point to this SaveLayer at all. 201 // There wasn't really any point to this SaveLayer at all.
202 return KillSaveLayerAndRestore(record, begin); 202 return KillSaveLayerAndRestore(record, begin);
203 } 203 }
204 204
205 // This layer typically contains a filter, but this should work for laye rs with for other 205 // This layer typically contains a filter, but this should work for laye rs with for other
206 // purposes too. 206 // purposes too.
207 SkPaint* filterLayerPaint = pattern->fourth<SaveLayer>()->paint; 207 SkPaint* filterLayerPaint = pattern->fourth<SaveLayer>()->paint;
208 if (filterLayerPaint == NULL) { 208 if (filterLayerPaint == nullptr) {
209 // We can just give the inner SaveLayer the paint of the outer SaveL ayer. 209 // We can just give the inner SaveLayer the paint of the outer SaveL ayer.
210 // TODO(mtklein): figure out how to do this clearly 210 // TODO(mtklein): figure out how to do this clearly
211 return false; 211 return false;
212 } 212 }
213 213
214 if (!fold_opacity_layer_color_to_paint(*opacityPaint, true /*isSaveLayer */, 214 if (!fold_opacity_layer_color_to_paint(*opacityPaint, true /*isSaveLayer */,
215 filterLayerPaint)) { 215 filterLayerPaint)) {
216 return false; 216 return false;
217 } 217 }
218 218
219 return KillSaveLayerAndRestore(record, begin); 219 return KillSaveLayerAndRestore(record, begin);
220 } 220 }
221 221
222 static bool KillSaveLayerAndRestore(SkRecord* record, int saveLayerIndex) { 222 static bool KillSaveLayerAndRestore(SkRecord* record, int saveLayerIndex) {
223 record->replace<NoOp>(saveLayerIndex); // SaveLayer 223 record->replace<NoOp>(saveLayerIndex); // SaveLayer
224 record->replace<NoOp>(saveLayerIndex + 6); // Restore 224 record->replace<NoOp>(saveLayerIndex + 6); // Restore
225 return true; 225 return true;
226 } 226 }
227 }; 227 };
228 228
229 void SkRecordMergeSvgOpacityAndFilterLayers(SkRecord* record) { 229 void SkRecordMergeSvgOpacityAndFilterLayers(SkRecord* record) {
230 SvgOpacityAndFilterLayerMergePass pass; 230 SvgOpacityAndFilterLayerMergePass pass;
231 apply(&pass, record); 231 apply(&pass, record);
232 } 232 }
OLDNEW
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecordPattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698