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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 SkIntToScalar(bounds.height())); | 375 SkIntToScalar(bounds.height())); |
376 GrTexture* srcTexture = input.getTexture(); | 376 GrTexture* srcTexture = input.getTexture(); |
377 GrContext* context = srcTexture->getContext(); | 377 GrContext* context = srcTexture->getContext(); |
378 | 378 |
379 GrSurfaceDesc desc; | 379 GrSurfaceDesc desc; |
380 desc.fFlags = kRenderTarget_GrSurfaceFlag, | 380 desc.fFlags = kRenderTarget_GrSurfaceFlag, |
381 desc.fWidth = bounds.width(); | 381 desc.fWidth = bounds.width(); |
382 desc.fHeight = bounds.height(); | 382 desc.fHeight = bounds.height(); |
383 desc.fConfig = kRGBA_8888_GrPixelConfig; | 383 desc.fConfig = kRGBA_8888_GrPixelConfig; |
384 | 384 |
385 SkAutoTUnref<GrTexture> dst(context->textureProvider()->refScratchTexture(de
sc, | 385 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); |
386 GrTextureProvider::kApprox_ScratchTexMatch)); | |
387 if (!dst) { | 386 if (!dst) { |
388 return false; | 387 return false; |
389 } | 388 } |
390 | 389 |
391 // setup new clip | 390 // setup new clip |
392 GrClip clip(dstRect); | 391 GrClip clip(dstRect); |
393 | 392 |
394 offset->fX = bounds.left(); | 393 offset->fX = bounds.left(); |
395 offset->fY = bounds.top(); | 394 offset->fY = bounds.top(); |
396 SkMatrix matrix(ctx.ctm()); | 395 SkMatrix matrix(ctx.ctm()); |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 | 2013 |
2015 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2014 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2016 } | 2015 } |
2017 | 2016 |
2018 #endif | 2017 #endif |
2019 | 2018 |
2020 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2019 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2021 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2020 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2022 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2021 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2023 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2022 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |