make SkPM4f private
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1713653002
Review URL: https://codereview.chromium.org/1713653002
diff --git a/src/core/SkBlitter_PM4f.cpp b/src/core/SkBlitter_PM4f.cpp
index cec2361..3c13baa 100644
--- a/src/core/SkBlitter_PM4f.cpp
+++ b/src/core/SkBlitter_PM4f.cpp
@@ -12,6 +12,7 @@
#include "SkXfermode.h"
#include "SkBlitMask.h"
#include "SkTemplates.h"
+#include "SkPM4f.h"
template <typename State> class SkState_Blitter : public SkRasterBlitter {
typedef SkRasterBlitter INHERITED;
diff --git a/src/core/SkColor.cpp b/src/core/SkColor.cpp
index c0a3895..d88950b 100644
--- a/src/core/SkColor.cpp
+++ b/src/core/SkColor.cpp
@@ -102,6 +102,7 @@
}
///////////////////////////////////////////////////////////////////////////////////////////////////
+#include "SkPM4f.h"
#include "SkNx.h"
#include "SkHalf.h"
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index 72f5470..7d11163 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -12,6 +12,7 @@
#include "SkTDArray.h"
#include "SkUnPreMultiply.h"
#include "SkWriteBuffer.h"
+#include "SkPM4f.h"
#if SK_SUPPORT_GPU
#include "GrFragmentProcessor.h"
diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp
index 3b79d7f..de87913 100644
--- a/src/core/SkColorMatrixFilterRowMajor255.cpp
+++ b/src/core/SkColorMatrixFilterRowMajor255.cpp
@@ -12,6 +12,7 @@
#include "SkWriteBuffer.h"
#include "SkUnPreMultiply.h"
#include "SkString.h"
+#include "SkPM4f.h"
#define SK_PMORDER_INDEX_A (SK_A32_SHIFT / 8)
#define SK_PMORDER_INDEX_R (SK_R32_SHIFT / 8)
diff --git a/src/core/SkColorShader.h b/src/core/SkColorShader.h
index 1c07a3c..eb55a07 100644
--- a/src/core/SkColorShader.h
+++ b/src/core/SkColorShader.h
@@ -9,6 +9,7 @@
#define SkColorShader_DEFINED
#include "SkShader.h"
+#include "SkPM4f.h"
/** \class SkColorShader
A Shader that represents a single color. In general, this effect can be
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index bbb03c6..6651abb 100644
--- a/src/core/SkColorSpace.cpp
+++ b/src/core/SkColorSpace.cpp
@@ -174,6 +174,7 @@
#include "SkColor.h"
#include "SkNx.h"
+#include "SkPM4f.h"
void SkApply3x3ToPM4f(const SkFloat3x3& m, const SkPM4f src[], SkPM4f dst[], int count) {
SkASSERT(1 == SkPM4f::G);
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp
index d25335b..edb0e88 100644
--- a/src/core/SkLinearBitmapPipeline.cpp
+++ b/src/core/SkLinearBitmapPipeline.cpp
@@ -6,6 +6,7 @@
*/
#include "SkLinearBitmapPipeline.h"
+#include "SkPM4f.h"
struct X {
explicit X(SkScalar val) : fVal{val} { }
diff --git a/src/core/SkModeColorFilter.cpp b/src/core/SkModeColorFilter.cpp
index 14e3fb7..574c1ce 100644
--- a/src/core/SkModeColorFilter.cpp
+++ b/src/core/SkModeColorFilter.cpp
@@ -14,6 +14,7 @@
#include "SkUtils.h"
#include "SkString.h"
#include "SkValidationUtils.h"
+#include "SkPM4f.h"
//////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkPM4f.h b/src/core/SkPM4f.h
new file mode 100644
index 0000000..fb22783
--- /dev/null
+++ b/src/core/SkPM4f.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPM4f_DEFINED
+#define SkPM4f_DEFINED
+
+#include "SkColorPriv.h"
+
+/*
+ * The float values are 0...1 premultiplied
+ */
+struct SkPM4f {
+ enum {
+ A = SK_A32_SHIFT/8,
+ R = SK_R32_SHIFT/8,
+ G = SK_G32_SHIFT/8,
+ B = SK_B32_SHIFT/8,
+ };
+ float fVec[4];
+
+ float a() const { return fVec[A]; }
+
+ SkColor4f unpremul() const;
+
+ static SkPM4f FromPMColor(SkPMColor);
+
+ // half-float routines
+ void toF16(uint16_t[4]) const;
+ uint64_t toF16() const; // 4 float16 values packed into uint64_t
+ static SkPM4f FromF16(const uint16_t[4]);
+
+#ifdef SK_DEBUG
+ void assertIsUnit() const;
+#else
+ void assertIsUnit() const {}
+#endif
+};
+
+typedef SkPM4f (*SkXfermodeProc4f)(const SkPM4f& src, const SkPM4f& dst);
+
+
+#endif
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 81aff70..24d0736 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkPM4f.h"
#include "SkColorPriv.h"
#include "SkNx.h"
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp
index f285668..57bb194 100644
--- a/src/core/SkPixmap.cpp
+++ b/src/core/SkPixmap.cpp
@@ -11,6 +11,7 @@
#include "SkMask.h"
#include "SkPixmap.h"
#include "SkUtils.h"
+#include "SkPM4f.h"
void SkAutoPixmapUnlock::reset(const SkPixmap& pm, void (*unlock)(void*), void* ctx) {
SkASSERT(pm.addr() != nullptr);
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 8b28f1b..07c4e16 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -14,6 +14,7 @@
#include "SkReadBuffer.h"
#include "SkString.h"
#include "SkWriteBuffer.h"
+#include "SkPM4f.h"
#define SkAlphaMulAlpha(a, b) SkMulDiv255Round(a, b)