| 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 "SkLightingImageFilter.h" | 8 #include "SkLightingImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 desc.fFlags = kRenderTarget_GrSurfaceFlag, | 411 desc.fFlags = kRenderTarget_GrSurfaceFlag, |
| 412 desc.fWidth = offsetBounds.width(); | 412 desc.fWidth = offsetBounds.width(); |
| 413 desc.fHeight = offsetBounds.height(); | 413 desc.fHeight = offsetBounds.height(); |
| 414 desc.fConfig = kRGBA_8888_GrPixelConfig; | 414 desc.fConfig = kRGBA_8888_GrPixelConfig; |
| 415 | 415 |
| 416 sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc)); | 416 sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc)); |
| 417 if (!dst) { | 417 if (!dst) { |
| 418 return nullptr; | 418 return nullptr; |
| 419 } | 419 } |
| 420 | 420 |
| 421 sk_sp<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget())
); | 421 sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRende
rTarget()))); |
| 422 if (!drawContext) { | 422 if (!drawContext) { |
| 423 return nullptr; | 423 return nullptr; |
| 424 } | 424 } |
| 425 | 425 |
| 426 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(offsetBounds.width()), | 426 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(offsetBounds.width()), |
| 427 SkIntToScalar(offsetBounds.height())); | 427 SkIntToScalar(offsetBounds.height())); |
| 428 | 428 |
| 429 // setup new clip | 429 // setup new clip |
| 430 GrClip clip(dstRect); | 430 GrClip clip(dstRect); |
| 431 | 431 |
| (...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 | 2171 |
| 2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 2173 } | 2173 } |
| 2174 | 2174 |
| 2175 #endif | 2175 #endif |
| 2176 | 2176 |
| 2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |