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>
This commit is contained in:
parent
6c8f5b31ac
commit
ec654f7397
@ -37,7 +37,6 @@ public:
|
||||
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 @@ private:
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -32,21 +32,6 @@ bool SkColorFilter::onAsAColorMatrix(float matrix[20]) const {
|
||||
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 {
|
||||
|
@ -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 @@ sk_sp<SkColorFilter> SkColorFilters::Matrix(const SkColorMatrix& cm) {
|
||||
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 @@ void SkColorFilter_Matrix::RegisterFlattenables() {
|
||||
[](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;
|
||||
|
Loading…
Reference in New Issue
Block a user