Index: src/codec/SkSwizzlerOpts.h |
diff --git a/src/codec/SkSwizzlerOpts.h b/src/codec/SkSwizzlerOpts.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2d91c1055eca623efd2f4fa0dc7a6d64e918cf8e |
--- /dev/null |
+++ b/src/codec/SkSwizzlerOpts.h |
@@ -0,0 +1,26 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+#include "SkOpts.h" |
+#include "SkSwizzler.h" |
+ |
+// Unpremultiplied RGBA -> Premultiplied N32 |
+// 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
|
+static SkSwizzler::ResultAlpha opt_swizzle_rgba_to_n32_premul( |
+ void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, |
+ 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
|
+ |
+ // If we are not sampling, deltaSrc should equal bpp. |
+ SkASSERT(deltaSrc == bpp); |
+ |
+#ifdef SK_PMCOLOR_IS_RGBA |
+ 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.
|
+#else |
+ SkOpts::premul_swaprb_xxxa((uint32_t*) dst, (uint32_t*) (src + offset), width); |
+#endif |
+ // 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.
|
+ return SkSwizzler::kTransparent_ResultAlpha; |
+} |
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 :)
|