remove legacy 255-biased colormatrix
Bug: skia:4872
Bug: skia:9012
Change-Id: I7c1ac4e94405404fcb13079b5b578a5a26aad02e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210628
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index dca388d..eb48068 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -37,7 +37,6 @@
bool asColorMode(SkColor* color, SkBlendMode* mode) const {
return this->onAsAColorMode(color, mode);
}
- bool asColorMatrix(float rowMajor255[20]) const;
/** If the filter can be represented by a source color plus Mode, this
* returns true, and sets (if not NULL) the color and mode appropriately.
@@ -140,9 +139,6 @@
class SK_API SkColorFilters {
public:
- // Deprecated: use Matrix(...) with 0...1 values for translate
- static sk_sp<SkColorFilter> MatrixRowMajor255(const float array[20]);
-
static sk_sp<SkColorFilter> Compose(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner) {
return outer ? outer->makeComposed(inner) : inner;
}
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index 107fa67..72b359a 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -32,21 +32,6 @@
return false;
}
-// DEPRECATED
-bool SkColorFilter::asColorMatrix(float rowMajor255[20]) const {
- if (this->asAColorMatrix(rowMajor255)) {
- if (rowMajor255) {
- rowMajor255[ 4] *= 255;
- rowMajor255[ 9] *= 255;
- rowMajor255[14] *= 255;
- rowMajor255[19] *= 255;
- }
- return true;
- }
- return false;
-}
-
-
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> SkColorFilter::asFragmentProcessor(
GrRecordingContext*, const GrColorSpaceInfo&) const {
diff --git a/src/core/SkColorFilter_Matrix.cpp b/src/core/SkColorFilter_Matrix.cpp
index 8757b7e..0a648e5 100644
--- a/src/core/SkColorFilter_Matrix.cpp
+++ b/src/core/SkColorFilter_Matrix.cpp
@@ -16,12 +16,6 @@
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
-static void scale_last_column(float rowMajor[20], float scale) {
- for (int i = 0; i < 4; ++i) {
- rowMajor[5*i + 4] *= scale;
- }
-}
-
void SkColorFilter_Matrix::initState() {
const float* srcA = fMatrix + 15;
fFlags = (srcA[0] == 0 && srcA[1] == 0 && srcA[2] == 0 && srcA[3] == 1 && srcA[4] == 0)
@@ -203,14 +197,6 @@
return Matrix(cm.fMat);
}
-// DEPRECATED
-sk_sp<SkColorFilter> SkColorFilters::MatrixRowMajor255(const float array[20]) {
- float tmp[20];
- memcpy(tmp, array, sizeof(tmp));
- scale_last_column(tmp, 1.0f/255);
- return Matrix(tmp);
-}
-
void SkColorFilter_Matrix::RegisterFlattenables() {
SK_REGISTER_FLATTENABLE(SkColorFilter_Matrix);
@@ -219,7 +205,10 @@
[](SkReadBuffer& buffer) -> sk_sp<SkFlattenable> {
float matrix[20];
if (buffer.readScalarArray(matrix, 20)) {
- scale_last_column(matrix, 1.0f/255);
+ matrix[ 4] *= (1.0f/255);
+ matrix[ 9] *= (1.0f/255);
+ matrix[14] *= (1.0f/255);
+ matrix[19] *= (1.0f/255);
return SkColorFilters::Matrix(matrix);
}
return nullptr;