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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 | 233 |
234 // A null 'xferFP' here means kSrc_Mode was used in which case we can ju st proceed | 234 // A null 'xferFP' here means kSrc_Mode was used in which case we can ju st proceed |
235 if (xferFP) { | 235 if (xferFP) { |
236 paint.addColorFragmentProcessor(std::move(xferFP)); | 236 paint.addColorFragmentProcessor(std::move(xferFP)); |
237 } | 237 } |
238 } else { | 238 } else { |
239 paint.addColorFragmentProcessor(std::move(bgFP)); | 239 paint.addColorFragmentProcessor(std::move(bgFP)); |
240 } | 240 } |
241 | 241 |
242 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 242 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
243 | 243 |
robertphillips
2016/07/21 19:22:41
What if foreground & background have different col
Brian Osman
2016/07/21 19:51:44
Yes. Output should be in color space of source. I'
| |
244 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr ox, | 244 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr ox, |
245 bounds.width(), bou nds.height(), | 245 bounds.width(), bou nds.height(), |
246 kSkia8888_GrPixelCo nfig)); | 246 kSkia8888_GrPixelCo nfig, |
247 sk_ref_sp(source->g etColorSpace()))); | |
247 if (!drawContext) { | 248 if (!drawContext) { |
248 return nullptr; | 249 return nullptr; |
249 } | 250 } |
250 | 251 |
251 SkMatrix matrix; | 252 SkMatrix matrix; |
252 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); | 253 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); |
253 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds)); | 254 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds)); |
254 | 255 |
255 // TODO: Get the colorSpace from the drawContext (once it has one) | |
256 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he ight()), | 256 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he ight()), |
257 kNeedNewImageUniqueID_SpecialImage, | 257 kNeedNewImageUniqueID_SpecialImage, |
258 drawContext->asTexture(), | 258 drawContext->asTexture(), |
259 sk_ref_sp(source->getColorSpace())); | 259 sk_ref_sp(drawContext->getColorSpace())); |
260 } | 260 } |
261 | 261 |
262 #endif | 262 #endif |
OLD | NEW |