| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 SkASSERT(inputTexture); | 408 SkASSERT(inputTexture); |
| 409 | 409 |
| 410 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, | 410 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, |
| 411 offsetBounds.width(
), | 411 offsetBounds.width(
), |
| 412 offsetBounds.height
(), | 412 offsetBounds.height
(), |
| 413 kRGBA_8888_GrPixelC
onfig)); | 413 kRGBA_8888_GrPixelC
onfig)); |
| 414 if (!drawContext) { | 414 if (!drawContext) { |
| 415 return nullptr; | 415 return nullptr; |
| 416 } | 416 } |
| 417 | 417 |
| 418 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(offsetBounds.width()), | 418 SkIRect dstIRect = SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height
()); |
| 419 SkIntToScalar(offsetBounds.height())); | 419 SkRect dstRect = SkRect::Make(dstIRect); |
| 420 | 420 |
| 421 // setup new clip | 421 // setup new clip |
| 422 GrClip clip(dstRect); | 422 GrFixedClip clip(dstIRect); |
| 423 | 423 |
| 424 const SkIRect inputBounds = SkIRect::MakeWH(input->width(), input->height())
; | 424 const SkIRect inputBounds = SkIRect::MakeWH(input->width(), input->height())
; |
| 425 SkRect topLeft = SkRect::MakeXYWH(0, 0, 1, 1); | 425 SkRect topLeft = SkRect::MakeXYWH(0, 0, 1, 1); |
| 426 SkRect top = SkRect::MakeXYWH(1, 0, dstRect.width() - 2, 1); | 426 SkRect top = SkRect::MakeXYWH(1, 0, dstRect.width() - 2, 1); |
| 427 SkRect topRight = SkRect::MakeXYWH(dstRect.width() - 1, 0, 1, 1); | 427 SkRect topRight = SkRect::MakeXYWH(dstRect.width() - 1, 0, 1, 1); |
| 428 SkRect left = SkRect::MakeXYWH(0, 1, 1, dstRect.height() - 2); | 428 SkRect left = SkRect::MakeXYWH(0, 1, 1, dstRect.height() - 2); |
| 429 SkRect interior = dstRect.makeInset(1, 1); | 429 SkRect interior = dstRect.makeInset(1, 1); |
| 430 SkRect right = SkRect::MakeXYWH(dstRect.width() - 1, 1, 1, dstRect.height()
- 2); | 430 SkRect right = SkRect::MakeXYWH(dstRect.width() - 1, 1, 1, dstRect.height()
- 2); |
| 431 SkRect bottomLeft = SkRect::MakeXYWH(0, dstRect.height() - 1, 1, 1); | 431 SkRect bottomLeft = SkRect::MakeXYWH(0, dstRect.height() - 1, 1, 1); |
| 432 SkRect bottom = SkRect::MakeXYWH(1, dstRect.height() - 1, dstRect.width() -
2, 1); | 432 SkRect bottom = SkRect::MakeXYWH(1, dstRect.height() - 1, dstRect.width() -
2, 1); |
| (...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 | 2163 |
| 2164 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2164 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 2165 } | 2165 } |
| 2166 | 2166 |
| 2167 #endif | 2167 #endif |
| 2168 | 2168 |
| 2169 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2169 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 2170 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2170 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 2171 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2171 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 2172 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2172 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |