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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 SkIntToScalar(bounds.height())); | 376 SkIntToScalar(bounds.height())); |
377 GrTexture* srcTexture = input.getTexture(); | 377 GrTexture* srcTexture = input.getTexture(); |
378 GrContext* context = srcTexture->getContext(); | 378 GrContext* context = srcTexture->getContext(); |
379 | 379 |
380 GrSurfaceDesc desc; | 380 GrSurfaceDesc desc; |
381 desc.fFlags = kRenderTarget_GrSurfaceFlag, | 381 desc.fFlags = kRenderTarget_GrSurfaceFlag, |
382 desc.fWidth = bounds.width(); | 382 desc.fWidth = bounds.width(); |
383 desc.fHeight = bounds.height(); | 383 desc.fHeight = bounds.height(); |
384 desc.fConfig = kRGBA_8888_GrPixelConfig; | 384 desc.fConfig = kRGBA_8888_GrPixelConfig; |
385 | 385 |
386 auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint()); | 386 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); |
387 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc,
constraint)); | |
388 if (!dst) { | 387 if (!dst) { |
389 return false; | 388 return false; |
390 } | 389 } |
391 | 390 |
392 // setup new clip | 391 // setup new clip |
393 GrClip clip(dstRect); | 392 GrClip clip(dstRect); |
394 | 393 |
395 offset->fX = bounds.left(); | 394 offset->fX = bounds.left(); |
396 offset->fY = bounds.top(); | 395 offset->fY = bounds.top(); |
397 SkMatrix matrix(ctx.ctm()); | 396 SkMatrix matrix(ctx.ctm()); |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 | 2033 |
2035 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2034 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2036 } | 2035 } |
2037 | 2036 |
2038 #endif | 2037 #endif |
2039 | 2038 |
2040 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2039 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2041 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2040 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2042 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2041 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2043 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2042 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |