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

Unified Diff: src/core/SkColorMatrixFilterRowMajor255.cpp

Issue 1774523002: make pm4f be RGBA always, not pmcolor order (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update colormatrixfilter to know about RGBA Created 4 years, 9 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 | « src/core/SkColor.cpp ('k') | src/core/SkPM4f.h » ('j') | src/core/SkPM4f.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorMatrixFilterRowMajor255.cpp
diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp
index e2545c2af6f7f340a0d4c240bf70495ba2f5fceb..ef234bfdd6a0b01b8eda92b7f83b6d342093d498 100644
--- a/src/core/SkColorMatrixFilterRowMajor255.cpp
+++ b/src/core/SkColorMatrixFilterRowMajor255.cpp
@@ -12,7 +12,7 @@
#include "SkWriteBuffer.h"
#include "SkUnPreMultiply.h"
#include "SkString.h"
-#include "SkPM4f.h"
+#include "SkPM4fPriv.h"
#define SK_PMORDER_INDEX_A (SK_A32_SHIFT / 8)
#define SK_PMORDER_INDEX_R (SK_R32_SHIFT / 8)
@@ -108,10 +108,10 @@ void filter_span(const float array[], const T src[], int count, T dst[]) {
srcf = unpremul(srcf);
}
- Sk4f r4 = srcf[SK_R32_SHIFT/8];
- Sk4f g4 = srcf[SK_G32_SHIFT/8];
- Sk4f b4 = srcf[SK_B32_SHIFT/8];
- Sk4f a4 = srcf[SK_A32_SHIFT/8];
+ Sk4f r4 = srcf[SkPM4f::R];
+ Sk4f g4 = srcf[SkPM4f::G];
+ Sk4f b4 = srcf[SkPM4f::B];
+ Sk4f a4 = srcf[SkPM4f::A];
// apply matrix
Sk4f dst4 = c0 * r4 + c1 * g4 + c2 * b4 + c3 * a4 + c4;
@@ -122,10 +122,10 @@ void filter_span(const float array[], const T src[], int count, T dst[]) {
struct SkPMColorAdaptor {
static SkPMColor From4f(const Sk4f& c4) {
- return round(c4);
+ return round(swizzle_rgba_to_pmorder(c4));
}
static Sk4f To4f(SkPMColor c) {
- return SkNx_cast<float>(Sk4b::Load(&c)) * Sk4f(1.0f/255);
+ return swizzle_rgba_to_pmorder(to_4f(c)) * Sk4f(1.0f/255);
mtklein 2016/03/07 18:01:14 Let's not forget to go to one call, e.g. swizzle_i
reed1 2016/03/07 18:47:38 Fixed in newer version.
}
};
void SkColorMatrixFilterRowMajor255::filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const {
@@ -134,12 +134,10 @@ void SkColorMatrixFilterRowMajor255::filterSpan(const SkPMColor src[], int count
struct SkPM4fAdaptor {
static SkPM4f From4f(const Sk4f& c4) {
- SkPM4f c;
- c4.store(&c);
- return c;
+ return SkPM4f::From4f(c4);
}
static Sk4f To4f(const SkPM4f& c) {
- return Sk4f::Load(&c);
+ return c.to4f();
}
};
void SkColorMatrixFilterRowMajor255::filterSpan4f(const SkPM4f src[], int count, SkPM4f dst[]) const {
« no previous file with comments | « src/core/SkColor.cpp ('k') | src/core/SkPM4f.h » ('j') | src/core/SkPM4f.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698