| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 "SkXfermodeImageFilter.h" | 8 #include "SkXfermodeImageFilter.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // A null 'xferFP' here means kSrc_Mode was used in which case we can ju
st proceed | 231 // A null 'xferFP' here means kSrc_Mode was used in which case we can ju
st proceed |
| 232 if (xferFP) { | 232 if (xferFP) { |
| 233 paint.addColorFragmentProcessor(xferFP.get()); | 233 paint.addColorFragmentProcessor(xferFP.get()); |
| 234 } | 234 } |
| 235 } else { | 235 } else { |
| 236 paint.addColorFragmentProcessor(bgFP); | 236 paint.addColorFragmentProcessor(bgFP); |
| 237 } | 237 } |
| 238 | 238 |
| 239 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 239 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 240 | 240 |
| 241 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, | 241 sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_B
ackingFit, |
| 242 bounds.width(), bou
nds.height(), | 242 bounds.width(), bou
nds.height(), |
| 243 kSkia8888_GrPixelCo
nfig)); | 243 kSkia8888_GrPixelCo
nfig)); |
| 244 if (!drawContext) { | 244 if (!drawContext) { |
| 245 return nullptr; | 245 return nullptr; |
| 246 } | 246 } |
| 247 | 247 |
| 248 SkMatrix matrix; | 248 SkMatrix matrix; |
| 249 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); | 249 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); |
| 250 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); | 250 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); |
| 251 | 251 |
| 252 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), | 252 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), |
| 253 kNeedNewImageUniqueID_SpecialImage, | 253 kNeedNewImageUniqueID_SpecialImage, |
| 254 drawContext->asTexture()); | 254 drawContext->asTexture()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 #endif | 257 #endif |
| OLD | NEW |