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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); | 249 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); |
250 GrContext* context = srcTexture->getContext(); | 250 GrContext* context = srcTexture->getContext(); |
251 | 251 |
252 GrTextureDesc desc; | 252 GrTextureDesc desc; |
253 desc.fFlags = kRenderTarget_GrTextureFlagBit, | 253 desc.fFlags = kRenderTarget_GrTextureFlagBit, |
254 desc.fWidth = bounds.width(); | 254 desc.fWidth = bounds.width(); |
255 desc.fHeight = bounds.height(); | 255 desc.fHeight = bounds.height(); |
256 desc.fConfig = kRGBA_8888_GrPixelConfig; | 256 desc.fConfig = kRGBA_8888_GrPixelConfig; |
257 | 257 |
258 GrAutoScratchTexture dst(context, desc); | 258 GrAutoScratchTexture dst(context, desc); |
| 259 if (NULL == dst.texture()) { |
| 260 return false; |
| 261 } |
259 GrContext::AutoMatrix am; | 262 GrContext::AutoMatrix am; |
260 am.setIdentity(context); | 263 am.setIdentity(context); |
261 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget()); | 264 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget()); |
262 GrContext::AutoClip acs(context, dstRect); | 265 GrContext::AutoClip acs(context, dstRect); |
263 GrEffect* effect; | 266 GrEffect* effect; |
264 offset->fX = bounds.left(); | 267 offset->fX = bounds.left(); |
265 offset->fY = bounds.top(); | 268 offset->fY = bounds.top(); |
266 bounds.offset(-srcOffset); | 269 bounds.offset(-srcOffset); |
267 SkMatrix matrix(ctx.ctm()); | 270 SkMatrix matrix(ctx.ctm()); |
268 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to
p())); | 271 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to
p())); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 } // namespace | 492 } // namespace |
490 | 493 |
491 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { | 494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { |
492 return SkNEW_ARGS(CacheImpl, (maxBytes)); | 495 return SkNEW_ARGS(CacheImpl, (maxBytes)); |
493 } | 496 } |
494 | 497 |
495 SkImageFilter::Cache* SkImageFilter::Cache::Get() { | 498 SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
496 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); | 499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
497 return cache.get(); | 500 return cache.get(); |
498 } | 501 } |
OLD | NEW |