| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 GrContext::AutoWideOpenIdentityDraw awoid(context, NULL); | 392 GrContext::AutoWideOpenIdentityDraw awoid(context, NULL); |
| 393 if (this->canFilterImageGPU()) { | 393 if (this->canFilterImageGPU()) { |
| 394 return this->filterImageGPU(proxy, src, ctx, result, offset); | 394 return this->filterImageGPU(proxy, src, ctx, result, offset); |
| 395 } else { | 395 } else { |
| 396 if (this->filterImage(proxy, src, ctx, result, offset)) { | 396 if (this->filterImage(proxy, src, ctx, result, offset)) { |
| 397 if (!result->getTexture()) { | 397 if (!result->getTexture()) { |
| 398 const SkImageInfo info = result->info(); | 398 const SkImageInfo info = result->info(); |
| 399 if (kUnknown_SkColorType == info.colorType()) { | 399 if (kUnknown_SkColorType == info.colorType()) { |
| 400 return false; | 400 return false; |
| 401 } | 401 } |
| 402 SkAutoTUnref<GrTexture> resultTex(GrRefCachedBitmapTexture(conte
xt, *result, NULL)); | 402 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context,
*result, NULL); |
| 403 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, resultTex)))
->unref(); | 403 result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref(); |
| 404 GrUnlockAndUnrefCachedBitmapTexture(resultTex); |
| 404 } | 405 } |
| 405 return true; | 406 return true; |
| 406 } else { | 407 } else { |
| 407 return false; | 408 return false; |
| 408 } | 409 } |
| 409 } | 410 } |
| 410 } | 411 } |
| 411 #endif | 412 #endif |
| 412 | 413 |
| 413 namespace { | 414 namespace { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } // namespace | 493 } // namespace |
| 493 | 494 |
| 494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { | 495 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { |
| 495 return SkNEW_ARGS(CacheImpl, (maxBytes)); | 496 return SkNEW_ARGS(CacheImpl, (maxBytes)); |
| 496 } | 497 } |
| 497 | 498 |
| 498 SkImageFilter::Cache* SkImageFilter::Cache::Get() { | 499 SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
| 499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); | 500 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
| 500 return cache.get(); | 501 return cache.get(); |
| 501 } | 502 } |
| OLD | NEW |