Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: src/core/SkXfermodeU64.cpp

Issue 1880953003: f16 and pm4f are always the same swizzle, so remove adaptor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermodeU64.cpp
diff --git a/src/core/SkXfermodeU64.cpp b/src/core/SkXfermodeU64.cpp
index 630a9d068351f103f22a8d9ccb3770bd18a125eb..2cf3e1b97ed370372ea3c3015f5bb6fd19101abb 100644
--- a/src/core/SkXfermodeU64.cpp
+++ b/src/core/SkXfermodeU64.cpp
@@ -50,15 +50,6 @@ template <DstType D> uint64_t store_to_dst(const Sk4f& x4) {
return (D == kU16_Dst) ? store_to_u16(x4) : SkFloatToHalf_01(x4);
}
-static inline Sk4f pm_to_rgba_order(const Sk4f& x) {
- if (SkPM4f::R == 0) {
- return x; // we're already RGBA
- } else {
- // we're BGRA, so swap R and B
- return SkNx_shuffle<2, 1, 0, 3>(x);
- }
-}
-
///////////////////////////////////////////////////////////////////////////////////////////////////
template <DstType D> void xfer_u64_1(const SkXfermode* xfer, uint64_t dst[],
@@ -135,7 +126,7 @@ const SkXfermode::D64Proc gProcs_Clear[] = {
template <DstType D> void src_1(const SkXfermode*, uint64_t dst[],
const SkPM4f* src, int count, const SkAlpha aa[]) {
- const Sk4f s4 = pm_to_rgba_order(unit_to_bias<D>(Sk4f::Load(src->fVec)));
+ const Sk4f s4 = unit_to_bias<D>(Sk4f::Load(src->fVec));
if (aa) {
for (int i = 0; i < count; ++i) {
const Sk4f d4 = load_from_dst<D>(dst[i]);
@@ -150,13 +141,13 @@ template <DstType D> void src_n(const SkXfermode*, uint64_t dst[],
const SkPM4f src[], int count, const SkAlpha aa[]) {
if (aa) {
for (int i = 0; i < count; ++i) {
- const Sk4f s4 = pm_to_rgba_order(unit_to_bias<D>(Sk4f::Load(src[i].fVec)));
+ const Sk4f s4 = unit_to_bias<D>(Sk4f::Load(src[i].fVec));
const Sk4f d4 = load_from_dst<D>(dst[i]);
dst[i] = store_to_dst<D>(lerp_by_coverage(s4, d4, aa[i]));
}
} else {
for (int i = 0; i < count; ++i) {
- const Sk4f s4 = pm_to_rgba_order(unit_to_bias<D>(Sk4f::Load(src[i].fVec)));
+ const Sk4f s4 = unit_to_bias<D>(Sk4f::Load(src[i].fVec));
dst[i] = store_to_dst<D>(s4);
}
}
@@ -181,7 +172,7 @@ const SkXfermode::D64Proc gProcs_Dst[] = {
template <DstType D> void srcover_1(const SkXfermode*, uint64_t dst[],
const SkPM4f* src, int count, const SkAlpha aa[]) {
- const Sk4f s4 = pm_to_rgba_order(Sk4f::Load(src->fVec));
+ const Sk4f s4 = Sk4f::Load(src->fVec);
const Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
const Sk4f s4bias = unit_to_bias<D>(s4);
for (int i = 0; i < count; ++i) {
@@ -198,7 +189,7 @@ template <DstType D> void srcover_1(const SkXfermode*, uint64_t dst[],
template <DstType D> void srcover_n(const SkXfermode*, uint64_t dst[],
const SkPM4f src[], int count, const SkAlpha aa[]) {
for (int i = 0; i < count; ++i) {
- const Sk4f s4 = pm_to_rgba_order(Sk4f::Load(src[i].fVec));
+ const Sk4f s4 = Sk4f::Load(src[i].fVec);
const Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
const Sk4f s4bias = unit_to_bias<D>(s4);
const Sk4f d4bias = load_from_dst<D>(dst[i]);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698