| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 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 #include "GrCircleBlurFragmentProcessor.h" | 9 #include "GrCircleBlurFragmentProcessor.h" |
| 10 | 10 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // disk. Quantizing to 16.16 should be close enough though. | 240 // disk. Quantizing to 16.16 should be close enough though. |
| 241 builder[0] = SkScalarToFixed(sigma); | 241 builder[0] = SkScalarToFixed(sigma); |
| 242 builder[1] = SkScalarToFixed(halfWH); | 242 builder[1] = SkScalarToFixed(halfWH); |
| 243 builder.finish(); | 243 builder.finish(); |
| 244 | 244 |
| 245 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); | 245 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); |
| 246 | 246 |
| 247 if (!blurProfile) { | 247 if (!blurProfile) { |
| 248 SkAutoTDeleteArray<uint8_t> profile(create_profile(halfWH, sigma)); | 248 SkAutoTDeleteArray<uint8_t> profile(create_profile(halfWH, sigma)); |
| 249 | 249 |
| 250 blurProfile = textureProvider->createTexture(texDesc, SkBudgeted::kYes,
profile.get(), 0); | 250 blurProfile = textureProvider->createTexture(texDesc, true, profile.get(
), 0); |
| 251 if (blurProfile) { | 251 if (blurProfile) { |
| 252 textureProvider->assignUniqueKeyToTexture(key, blurProfile); | 252 textureProvider->assignUniqueKeyToTexture(key, blurProfile); |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 return blurProfile; | 256 return blurProfile; |
| 257 } | 257 } |
| 258 | 258 |
| 259 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); | 259 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); |
| 260 | 260 |
| 261 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { | 261 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { |
| 262 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); | 262 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); |
| 263 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); | 263 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); |
| 264 SkRect circle = SkRect::MakeWH(wh, wh); | 264 SkRect circle = SkRect::MakeWH(wh, wh); |
| 265 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); | 265 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); |
| 266 } | 266 } |
| 267 | 267 |
| 268 #endif | 268 #endif |
| OLD | NEW |