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

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

Issue 37803002: Adding size parameter to read array functions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Cleanup Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkEmbossMaskFilter.h" 10 #include "SkEmbossMaskFilter.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // restore original alpha 126 // restore original alpha
127 memcpy(dst->fImage, src.fImage, src.computeImageSize()); 127 memcpy(dst->fImage, src.fImage, src.computeImageSize());
128 128
129 return true; 129 return true;
130 } 130 }
131 131
132 SkEmbossMaskFilter::SkEmbossMaskFilter(SkFlattenableReadBuffer& buffer) 132 SkEmbossMaskFilter::SkEmbossMaskFilter(SkFlattenableReadBuffer& buffer)
133 : SkMaskFilter(buffer) { 133 : SkMaskFilter(buffer) {
134 SkASSERT(buffer.getArrayCount() == sizeof(Light)); 134 SkASSERT(buffer.getArrayCount() == sizeof(Light));
135 buffer.readByteArray(&fLight); 135 buffer.readByteArray(&fLight, sizeof(Light));
Stephen White 2013/10/30 20:33:20 Shouldn't we be calling validate() on the result?
sugoi1 2013/10/31 14:16:24 Yeah, this is done internally. If false is returne
136 SkASSERT(fLight.fPad == 0); // for the font-cache lookup to be clean 136 SkASSERT(fLight.fPad == 0); // for the font-cache lookup to be clean
137 fBlurSigma = buffer.readScalar(); 137 fBlurSigma = buffer.readScalar();
138 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TO O 138 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TO O
139 // Fixing this must be done in two stages. When the skps are recaptured in V 13, 139 // Fixing this must be done in two stages. When the skps are recaptured in V 13,
140 // remove the ConvertRadiusToSigma but retain the absolute value. 140 // remove the ConvertRadiusToSigma but retain the absolute value.
141 // At the same time, switch the code in flatten to write a positive value. 141 // At the same time, switch the code in flatten to write a positive value.
142 // When the skps are captured in V14 the absolute value can be removed. 142 // When the skps are captured in V14 the absolute value can be removed.
143 if (fBlurSigma > 0) { 143 if (fBlurSigma > 0) {
144 fBlurSigma = SkBlurMask::ConvertRadiusToSigma(fBlurSigma); 144 fBlurSigma = SkBlurMask::ConvertRadiusToSigma(fBlurSigma);
145 } else { 145 } else {
(...skipping 24 matching lines...) Expand all
170 str->append(") "); 170 str->append(") ");
171 171
172 str->appendf("ambient: %d specular: %d ", 172 str->appendf("ambient: %d specular: %d ",
173 fLight.fAmbient, fLight.fSpecular); 173 fLight.fAmbient, fLight.fSpecular);
174 174
175 str->append("blurSigma: "); 175 str->append("blurSigma: ");
176 str->appendScalar(fBlurSigma); 176 str->appendScalar(fBlurSigma);
177 str->append(")"); 177 str->append(")");
178 } 178 }
179 #endif 179 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698