OLD | NEW |
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 #include "SkGradientShaderPriv.h" | 8 #include "SkGradientShaderPriv.h" |
9 #include "SkLinearGradient.h" | 9 #include "SkLinearGradient.h" |
10 #include "SkRadialGradient.h" | 10 #include "SkRadialGradient.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 buffer.writeUInt(recs[i].fScale); | 217 buffer.writeUInt(recs[i].fScale); |
218 } | 218 } |
219 } | 219 } |
220 buffer.writeMatrix(fPtsToUnit); | 220 buffer.writeMatrix(fPtsToUnit); |
221 } | 221 } |
222 | 222 |
223 bool SkGradientShaderBase::isOpaque() const { | 223 bool SkGradientShaderBase::isOpaque() const { |
224 return fColorsAreOpaque; | 224 return fColorsAreOpaque; |
225 } | 225 } |
226 | 226 |
| 227 #if 0 |
227 bool SkGradientShaderBase::setContext(const SkBitmap& device, | 228 bool SkGradientShaderBase::setContext(const SkBitmap& device, |
228 const SkPaint& paint, | 229 const SkPaint& paint, |
229 const SkMatrix& matrix) { | 230 const SkMatrix& matrix) { |
230 if (!this->INHERITED::setContext(device, paint, matrix)) { | 231 if (!this->INHERITED::setContext(device, paint, matrix)) { |
231 return false; | 232 return false; |
232 } | 233 } |
233 | 234 |
234 const SkMatrix& inverse = this->getTotalInverse(); | 235 const SkMatrix& inverse = this->getTotalInverse(); |
235 | 236 |
236 if (!fDstToIndex.setConcat(fPtsToUnit, inverse)) { | 237 if (!fDstToIndex.setConcat(fPtsToUnit, inverse)) { |
(...skipping 14 matching lines...) Expand all Loading... |
251 } | 252 } |
252 // we can do span16 as long as our individual colors are opaque, | 253 // we can do span16 as long as our individual colors are opaque, |
253 // regardless of the paint's alpha | 254 // regardless of the paint's alpha |
254 if (fColorsAreOpaque) { | 255 if (fColorsAreOpaque) { |
255 fFlags |= kHasSpan16_Flag; | 256 fFlags |= kHasSpan16_Flag; |
256 } | 257 } |
257 | 258 |
258 this->setCacheAlpha(paintAlpha); | 259 this->setCacheAlpha(paintAlpha); |
259 return true; | 260 return true; |
260 } | 261 } |
| 262 #endif |
261 | 263 |
262 void SkGradientShaderBase::setCacheAlpha(U8CPU alpha) const { | 264 void SkGradientShaderBase::setCacheAlpha(U8CPU alpha) const { |
263 // if the new alpha differs from the previous time we were called, inval our
cache | 265 // if the new alpha differs from the previous time we were called, inval our
cache |
264 // this will trigger the cache to be rebuilt. | 266 // this will trigger the cache to be rebuilt. |
265 // we don't care about the first time, since the cache ptrs will already be
NULL | 267 // we don't care about the first time, since the cache ptrs will already be
NULL |
266 if (fCacheAlpha != alpha) { | 268 if (fCacheAlpha != alpha) { |
267 fCache16 = NULL; // inval the cache | 269 fCache16 = NULL; // inval the cache |
268 fCache32 = NULL; // inval the cache | 270 fCache32 = NULL; // inval the cache |
269 fCacheAlpha = alpha; // record the new alpha | 271 fCacheAlpha = alpha; // record the new alpha |
270 // inform our subclasses | 272 // inform our subclasses |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 (*stops)[i] = stop; | 1140 (*stops)[i] = stop; |
1139 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1141 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
1140 } | 1142 } |
1141 } | 1143 } |
1142 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1144 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
1143 | 1145 |
1144 return outColors; | 1146 return outColors; |
1145 } | 1147 } |
1146 | 1148 |
1147 #endif | 1149 #endif |
OLD | NEW |