Reland "Reland "remove legacy 255-biased colormatrix""
This reverts commit 7cf4242f8adf74d6e79653ed371e7ca22bc67bdb.
Reason for revert: flutter in google3 updated
Original change's description:
> Revert "Reland "remove legacy 255-biased colormatrix""
>
> This reverts commit b75be23bc485b3f87c7a2d3574ad5ec57c09ad51.
>
> Reason for revert: Flutter also appears to be using this
>
> third_party/flutter_engine/lib/ui/painting/paint.cc:95:32: error: no member named 'MatrixRowMajor255' in 'SkColorFilters'
> return SkColorFilters::MatrixRowMajor255(decoded.data());
>
> Original change's description:
> > Reland "remove legacy 255-biased colormatrix"
> >
> > This reverts commit 34d286a6d7a4522ff8d9db9e907bfcece52474ee.
> >
> > Reason for revert: google3 sites updated (hopefully)
> >
> > Original change's description:
> > > Revert "remove legacy 255-biased colormatrix"
> > >
> > > This reverts commit ec654f73975f99443c5828f1090a5e186975a431.
> > >
> > > Reason for revert: Seems to be breaking the Google3 roll
> > >
> > > Original change's description:
> > > > 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>
> > >
> > > TBR=reed@google.com
> > >
> > > Change-Id: Ib51de4f5a3f5d28b4870ca61fff43cce96e7426f
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:4872, skia:9012
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211587
> > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > Commit-Queue: Robert Phillips <robertphillips@google.com>
> >
> > TBR=robertphillips@google.com,reed@google.com
> >
> > Change-Id: I60e966eb05a092c2b590f819db5bacc1fe6db5db
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: skia:4872, skia:9012
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211643
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
>
> TBR=robertphillips@google.com,reed@google.com
>
> Change-Id: I6f0852e6c6c7d7dc38e51112d9e01cd302447772
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:4872, skia:9012
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211655
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=robertphillips@google.com,reed@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:4872, skia:9012
Change-Id: Ife10b97b48cc6ab214a1bdeb0c990f629f5c3bc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213420
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: 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 85a39c3..98edc3d 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;