Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 #include "SkOpts.h" | |
| 8 #include "SkSwizzler.h" | |
| 9 | |
| 10 // Unpremultiplied RGBA -> Premultiplied N32 | |
| 11 // This is quite common for PNGs. | |
|
mtklein
2016/01/08 15:20:19
My preference would be to plop this function in Sk
msarett
2016/01/11 20:33:25
Sounds good. I was trying to avoid (more) clutter
| |
| 12 static SkSwizzler::ResultAlpha opt_swizzle_rgba_to_n32_premul( | |
| 13 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, | |
| 14 int offset, const SkPMColor ctable[]) { | |
|
mtklein
2016/01/08 15:20:20
Have you ever thought about ditching offset as a p
msarett
2016/01/11 20:33:25
We have some swizzler routines where bits per pixe
| |
| 15 | |
| 16 // If we are not sampling, deltaSrc should equal bpp. | |
| 17 SkASSERT(deltaSrc == bpp); | |
| 18 | |
| 19 #ifdef SK_PMCOLOR_IS_RGBA | |
| 20 SkOpts::premul_xxxa((uint32_t*) dst, (uint32_t*) (src + offset), width); | |
|
mtklein
2016/01/08 15:20:20
probably clearest to use (const uint32_t*)(src + o
msarett
2016/01/11 20:33:25
Done.
| |
| 21 #else | |
| 22 SkOpts::premul_swaprb_xxxa((uint32_t*) dst, (uint32_t*) (src + offset), widt h); | |
| 23 #endif | |
| 24 // FIXME: Should we continue to support reallyHasAlpha()? | |
|
scroggo
2016/01/08 16:02:57
I thought we had already decided not to.
mtklein
2016/01/08 16:23:01
If we haven't yet, let's decide now to drop it unl
msarett
2016/01/11 20:33:25
Done.
| |
| 25 return SkSwizzler::kTransparent_ResultAlpha; | |
| 26 } | |
|
mtklein
2016/01/08 15:20:19
We can also do UPM RGBA -> UPM N32 right?
#ifdef
msarett
2016/01/11 20:33:25
Yeah I'm starting with one at a time :)
| |
| OLD | NEW |