aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Klein <mtklein@google.com>2018-10-04 09:06:00 -0400
committerMike Klein <mtklein@google.com>2018-10-04 14:01:11 +0000
commit4429a4f82cfeb2e63593b81ff373f6f1a5702b7c (patch)
tree1e29b573d31f8b05f14965de30c2377726a5c915
parentae5e86413418bbbffef006e160c31dcf887c4ff0 (diff)
downloadskqp-4429a4f82cfeb2e63593b81ff373f6f1a5702b7c.tar.gz
re-precate SkMatrix44::SkMatrix44()
It's been driving me nuts that I can't just write `SkMatrix44 m;`, and I often don't care whether it's initialized or not. The default identity constructor would be nice to use, but it's deprecated. By tagging this constructor deprecated, we're only hurting ourselves; our big clients disable warnings about deprecated routines and use it freely. A quick tally in Skia shows we mostly use the uninitialized constructor, but sometimes the identity constructor, and there is a spread of all three in Chromium. So I've left the two explicit calls available. I switched a bunch of calls in Skia to use the less verbose constructor where it was clear that it didn't matter if the matrix was initialized. Literally zero of the kUninitialized constructor calls looked important for performance, so the only place I've kept is its lone unit test. A few places read clearer with an explicit "identity" to read. Change-Id: I0573cb6201f5a36f3b43070fb111f7d9af92736f Reviewed-on: https://skia-review.googlesource.com/c/159480 Reviewed-by: Brian Osman <brianosman@google.com>
-rw-r--r--bench/Matrix44Bench.cpp18
-rw-r--r--bench/nanobench.cpp2
-rw-r--r--dm/DM.cpp2
-rw-r--r--gm/3dgm.cpp8
-rw-r--r--gm/gamut.cpp2
-rw-r--r--gm/pictureshadercache.cpp2
-rw-r--r--gm/readpixels.cpp2
-rw-r--r--gm/tosrgb_colorfilter.cpp2
-rw-r--r--include/core/SkMatrix44.h5
-rw-r--r--src/core/SkColorSpace.cpp26
-rw-r--r--src/core/SkMatrix44.cpp2
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.cpp2
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.fp2
-rw-r--r--src/images/SkImageEncoderFns.h2
-rw-r--r--tests/AndroidCodecTest.cpp4
-rw-r--r--tests/CodecTest.cpp3
-rw-r--r--tests/ColorSpaceTest.cpp18
-rw-r--r--tests/Matrix44Test.cpp75
-rw-r--r--tests/SurfaceTest.cpp2
-rw-r--r--tools/flags/SkCommonFlagsConfig.cpp2
-rw-r--r--tools/viewer/Viewer.cpp2
21 files changed, 77 insertions, 106 deletions
diff --git a/bench/Matrix44Bench.cpp b/bench/Matrix44Bench.cpp
index b376d5a961..35c3e68404 100644
--- a/bench/Matrix44Bench.cpp
+++ b/bench/Matrix44Bench.cpp
@@ -44,9 +44,6 @@ class EqualsMatrix44Bench : public Matrix44Bench {
public:
EqualsMatrix44Bench()
: INHERITED("equals")
- , fM0(SkMatrix44::kIdentity_Constructor)
- , fM1(SkMatrix44::kIdentity_Constructor)
- , fM2(SkMatrix44::kIdentity_Constructor)
{
fM1.set(0, 0, 0);
fM2.set(3, 3, 0);
@@ -68,7 +65,6 @@ class SetIdentityMatrix44Bench : public Matrix44Bench {
public:
SetIdentityMatrix44Bench()
: INHERITED("setidentity")
- , mat(SkMatrix44::kIdentity_Constructor)
{
double rowMajor[16] =
{ 1, 2, 3, 4,
@@ -92,7 +88,6 @@ class PreScaleMatrix44Bench : public Matrix44Bench {
public:
PreScaleMatrix44Bench()
: INHERITED("prescale")
- , fM0(SkMatrix44::kUninitialized_Constructor)
{
fX = fY = fZ = SkDoubleToMScalar(1.5);
}
@@ -113,8 +108,6 @@ class InvertMatrix44Bench : public Matrix44Bench {
public:
InvertMatrix44Bench()
: INHERITED("invert")
- , fM0(SkMatrix44::kUninitialized_Constructor)
- , fM1(SkMatrix44::kUninitialized_Constructor)
{
fM0.setDouble(0, 0, -1.1);
fM0.setDouble(0, 1, 2.1);
@@ -148,8 +141,6 @@ class InvertAffineMatrix44Bench : public Matrix44Bench {
public:
InvertAffineMatrix44Bench()
: INHERITED("invertaffine")
- , fM0(SkMatrix44::kIdentity_Constructor)
- , fM1(SkMatrix44::kUninitialized_Constructor)
{
fM0.setDouble(0, 0, -1.1);
fM0.setDouble(0, 1, 2.1);
@@ -180,8 +171,6 @@ class InvertScaleTranslateMatrix44Bench : public Matrix44Bench {
public:
InvertScaleTranslateMatrix44Bench()
: INHERITED("invertscaletranslate")
- , fM0(SkMatrix44::kIdentity_Constructor)
- , fM1(SkMatrix44::kUninitialized_Constructor)
{
fM0.setDouble(0, 0, -1.1);
fM0.setDouble(0, 3, 4.1);
@@ -207,8 +196,6 @@ class InvertTranslateMatrix44Bench : public Matrix44Bench {
public:
InvertTranslateMatrix44Bench()
: INHERITED("inverttranslate")
- , fM0(SkMatrix44::kIdentity_Constructor)
- , fM1(SkMatrix44::kUninitialized_Constructor)
{
fM0.setDouble(0, 3, 4.1);
fM0.setDouble(1, 3, 8.1);
@@ -229,7 +216,6 @@ class PostScaleMatrix44Bench : public Matrix44Bench {
public:
PostScaleMatrix44Bench()
: INHERITED("postscale")
- , fM0(SkMatrix44::kUninitialized_Constructor)
{
fX = fY = fZ = SkDoubleToMScalar(1.5);
}
@@ -251,9 +237,6 @@ public:
// SkMatrix44::setConcat() has a fast path for matrices that are at most scale+translate.
SetConcatMatrix44Bench(bool fastPath)
: INHERITED(fastPath ? "setconcat_fast" : "setconcat_general")
- , fM0(SkMatrix44::kUninitialized_Constructor)
- , fM1(SkMatrix44::kUninitialized_Constructor)
- , fM2(SkMatrix44::kUninitialized_Constructor)
{
if (fastPath) {
const SkMScalar v = SkDoubleToMScalar(1.5);
@@ -284,7 +267,6 @@ class GetTypeMatrix44Bench : public Matrix44Bench {
public:
GetTypeMatrix44Bench()
: INHERITED("gettype")
- , fMatrix(SkMatrix44::kIdentity_Constructor)
{}
protected:
// Putting random generation of the matrix inside performTest()
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 513e99c593..ee9f9c0dbe 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -478,7 +478,7 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
CPU_CONFIG(565, kRaster_Backend, kRGB_565_SkColorType, kOpaque_SkAlphaType, nullptr)
// 'narrow' has a gamut narrower than sRGB, and different transfer function.
- SkMatrix44 narrow_gamut(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 narrow_gamut;
narrow_gamut.set3x3RowMajorf(gNarrow_toXYZD50);
auto narrow = SkColorSpace::MakeRGB(k2Dot2Curve_SkGammaNamed, narrow_gamut),
diff --git a/dm/DM.cpp b/dm/DM.cpp
index ab7b46ea0e..22d7c88cbe 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -938,7 +938,7 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi
// Configs relevant to color management testing (and 8888 for reference).
// 'narrow' has a gamut narrower than sRGB, and different transfer function.
- SkMatrix44 narrow_gamut(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 narrow_gamut;
narrow_gamut.set3x3RowMajorf(gNarrow_toXYZD50);
auto narrow = SkColorSpace::MakeRGB(k2Dot2Curve_SkGammaNamed, narrow_gamut),
diff --git a/gm/3dgm.cpp b/gm/3dgm.cpp
index 3c75187896..d2e3eeabfe 100644
--- a/gm/3dgm.cpp
+++ b/gm/3dgm.cpp
@@ -84,7 +84,7 @@ protected:
canvas->restore();
};
- SkMatrix44 tmp(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 tmp;
proc(0x400000FF, m4);
tmp.setTranslate(0, 0, 1);
@@ -103,9 +103,9 @@ protected:
if (!fAnim) {
return;
}
- SkMatrix44 camera(SkMatrix44::kIdentity_Constructor),
- perspective(SkMatrix44::kIdentity_Constructor),
- mv(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 camera,
+ perspective,
+ mv;
SkMatrix viewport;
{
diff --git a/gm/gamut.cpp b/gm/gamut.cpp
index 947bb3de3b..1250cbfa31 100644
--- a/gm/gamut.cpp
+++ b/gm/gamut.cpp
@@ -125,7 +125,7 @@ static void draw_gamut_grid(SkCanvas* canvas, SkTArray<std::unique_ptr<CellRende
0.0000000f, 0.0517813f, 0.7734287f, // -> Z
};
- SkMatrix44 wideGamutRGB_toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 wideGamutRGB_toXYZD50;
wideGamutRGB_toXYZD50.set3x3RowMajorf(gWideGamutRGB_toXYZD50);
// Use the original canvas' color type, but account for gamma requirements
diff --git a/gm/pictureshadercache.cpp b/gm/pictureshadercache.cpp
index 0784222909..b3e2c26ab4 100644
--- a/gm/pictureshadercache.cpp
+++ b/gm/pictureshadercache.cpp
@@ -60,7 +60,7 @@ public:
{
// Render in a funny color space that converts green to yellow.
- SkMatrix44 greenToYellow(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 greenToYellow;
greenToYellow.setFloat(0, 1, 1.0f);
sk_sp<SkColorSpace> gty = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
greenToYellow);
diff --git a/gm/readpixels.cpp b/gm/readpixels.cpp
index 36ff7ed467..d0625ac5eb 100644
--- a/gm/readpixels.cpp
+++ b/gm/readpixels.cpp
@@ -59,7 +59,7 @@ static sk_sp<SkImage> make_picture_image() {
}
static sk_sp<SkColorSpace> make_parametric_transfer_fn(const SkColorSpacePrimaries& primaries) {
- SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZD50;
SkAssertResult(primaries.toXYZD50(&toXYZD50));
SkColorSpaceTransferFn fn;
fn.fA = 1.f; fn.fB = 0.f; fn.fC = 0.f; fn.fD = 0.f; fn.fE = 0.f; fn.fF = 0.f; fn.fG = 1.8f;
diff --git a/gm/tosrgb_colorfilter.cpp b/gm/tosrgb_colorfilter.cpp
index 3835142446..d9c7890aae 100644
--- a/gm/tosrgb_colorfilter.cpp
+++ b/gm/tosrgb_colorfilter.cpp
@@ -36,7 +36,7 @@ DEF_SIMPLE_GM_BG(tosrgb_colorfilter, canvas, 130, 130, SK_ColorBLACK) {
0.25f, 0.20f, // Bx, By
0.3127f, 0.3290f, // Wx, Wy
};
- SkMatrix44 narrowGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 narrowGamutRGBMatrix;
narrowPrimaries.toXYZD50(&narrowGamutRGBMatrix);
auto narrow = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
narrowGamutRGBMatrix);
diff --git a/include/core/SkMatrix44.h b/include/core/SkMatrix44.h
index c8d43ff66a..d22a2610ee 100644
--- a/include/core/SkMatrix44.h
+++ b/include/core/SkMatrix44.h
@@ -145,7 +145,7 @@ public:
kIdentity_Constructor
};
- SkMatrix44(Uninitialized_Constructor) {}
+ SkMatrix44(Uninitialized_Constructor) {} // ironically, cannot be constexpr
constexpr SkMatrix44(Identity_Constructor)
: fMat{{ 1, 0, 0, 0, },
@@ -155,8 +155,7 @@ public:
, fTypeMask(kIdentity_Mask)
{}
- SK_ATTR_DEPRECATED("use the constructors that take an enum")
- SkMatrix44() { this->setIdentity(); }
+ constexpr SkMatrix44() : SkMatrix44{kIdentity_Constructor} {}
SkMatrix44(const SkMatrix44& src) {
memcpy(fMat, src.fMat, sizeof(fMat));
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index 2e1562ba43..681c441dc6 100644
--- a/src/core/SkColorSpace.cpp
+++ b/src/core/SkColorSpace.cpp
@@ -115,13 +115,13 @@ sk_sp<SkColorSpace> SkColorSpace::MakeRGB(const SkColorSpaceTransferFn& coeffs,
}
sk_sp<SkColorSpace> SkColorSpace::MakeRGB(RenderTargetGamma gamma, Gamut gamut) {
- SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZD50;
to_xyz_d50(&toXYZD50, gamut);
return SkColorSpace::MakeRGB(gamma, toXYZD50);
}
sk_sp<SkColorSpace> SkColorSpace::MakeRGB(const SkColorSpaceTransferFn& coeffs, Gamut gamut) {
- SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZD50;
to_xyz_d50(&toXYZD50, gamut);
return SkColorSpace::MakeRGB(coeffs, toXYZD50);
}
@@ -129,7 +129,7 @@ sk_sp<SkColorSpace> SkColorSpace::MakeRGB(const SkColorSpaceTransferFn& coeffs,
class SkColorSpaceSingletonFactory {
public:
static SkColorSpace* Make(SkGammaNamed gamma, const float to_xyz[9]) {
- SkMatrix44 m44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 m44;
m44.set3x3RowMajorf(to_xyz);
(void)m44.getType(); // Force typemask to be computed to avoid races.
return new SkColorSpace(gamma, nullptr, m44);
@@ -197,7 +197,7 @@ void SkColorSpace::invTransferFn(float gabcdef[7]) const {
const SkMatrix44* SkColorSpace::toXYZD50() const {
fToXZYD50_4x4_Once([this] {
- fToXYZD50_4x4.reset(new SkMatrix44(SkMatrix44::kUninitialized_Constructor));
+ fToXYZD50_4x4.reset(new SkMatrix44);
fToXYZD50_4x4->set3x3RowMajorf(fToXYZD50_3x3);
});
return fToXYZD50_4x4.get();
@@ -230,7 +230,7 @@ sk_sp<SkColorSpace> SkColorSpace::makeLinearGamma() const {
if (this->gammaIsLinear()) {
return sk_ref_sp(const_cast<SkColorSpace*>(this));
}
- SkMatrix44 m44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 m44;
this->toXYZD50(&m44);
return SkColorSpace::MakeRGB(kLinear_SkGammaNamed, m44);
}
@@ -239,16 +239,16 @@ sk_sp<SkColorSpace> SkColorSpace::makeSRGBGamma() const {
if (this->gammaCloseToSRGB()) {
return sk_ref_sp(const_cast<SkColorSpace*>(this));
}
- SkMatrix44 m44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 m44;
this->toXYZD50(&m44);
return SkColorSpace::MakeRGB(kSRGB_SkGammaNamed, m44);
}
sk_sp<SkColorSpace> SkColorSpace::makeColorSpin() const {
- SkMatrix44 spin(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 spin;
spin.set3x3(0, 1, 0, 0, 0, 1, 1, 0, 0);
- SkMatrix44 m44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 m44;
this->toXYZD50(&m44);
spin.postConcat(m44);
@@ -279,7 +279,7 @@ sk_sp<SkColorSpace> SkColorSpace::Make(const skcms_ICCProfile& profile) {
}
// TODO: can we save this work and skip lazily inverting the matrix later?
- SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZD50;
toXYZD50.set3x3RowMajorf(&profile.toXYZD50.vals[0][0]);
if (!toXYZD50.invert(nullptr)) {
return nullptr;
@@ -396,7 +396,7 @@ size_t SkColorSpace::writeToMemory(void* memory) const {
ColorSpaceHeader::Pack(k0_Version, 0, gammaNamed,
ColorSpaceHeader::kMatrix_Flag);
memory = SkTAddOffset<void>(memory, sizeof(ColorSpaceHeader));
- SkMatrix44 m44{SkMatrix44::kUninitialized_Constructor};
+ SkMatrix44 m44;
this->toXYZD50(&m44);
m44.as3x4RowMajorf((float*) memory);
}
@@ -421,7 +421,7 @@ size_t SkColorSpace::writeToMemory(void* memory) const {
*(((float*) memory) + 6) = transferFn.fG;
memory = SkTAddOffset<void>(memory, 7 * sizeof(float));
- SkMatrix44 m44{SkMatrix44::kUninitialized_Constructor};
+ SkMatrix44 m44;
this->toXYZD50(&m44);
m44.as3x4RowMajorf((float*) memory);
}
@@ -469,7 +469,7 @@ sk_sp<SkColorSpace> SkColorSpace::Deserialize(const void* data, size_t length) {
return nullptr;
}
- SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZ;
toXYZ.set3x4RowMajorf((const float*) data);
return SkColorSpace::MakeRGB((SkGammaNamed) header.fGammaNamed, toXYZ);
}
@@ -497,7 +497,7 @@ sk_sp<SkColorSpace> SkColorSpace::Deserialize(const void* data, size_t length) {
transferFn.fG = *(((const float*) data) + 6);
data = SkTAddOffset<const void>(data, 7 * sizeof(float));
- SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZ;
toXYZ.set3x4RowMajorf((const float*) data);
return SkColorSpace::MakeRGB(transferFn, toXYZ);
}
diff --git a/src/core/SkMatrix44.cpp b/src/core/SkMatrix44.cpp
index a79b703761..1b089879fe 100644
--- a/src/core/SkMatrix44.cpp
+++ b/src/core/SkMatrix44.cpp
@@ -496,7 +496,7 @@ bool SkMatrix44::invert(SkMatrix44* storage) const {
return true;
}
- SkMatrix44 tmp(kUninitialized_Constructor);
+ SkMatrix44 tmp;
// Use storage if it's available and distinct from this matrix.
SkMatrix44* inverse = (storage && storage != this) ? storage : &tmp;
if (this->isScaleTranslate()) {
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index c1b77b4b51..f13cff46c4 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -44,7 +44,7 @@ std::unique_ptr<GrFragmentProcessor> GrYUVtoRGBEffect::Make(sk_sp<GrTextureProxy
(vProxy->width() != yProxy->width()) || (vProxy->height() != yProxy->height()))
? GrSamplerState::Filter::kBilerp
: GrSamplerState::Filter::kNearest;
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
switch (colorSpace) {
case kJPEG_SkYUVColorSpace:
mat.setColMajorf(kJPEGConversionMatrix);
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.fp b/src/gpu/effects/GrYUVtoRGBEffect.fp
index 453800dd1b..cff255e407 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.fp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.fp
@@ -88,7 +88,7 @@ layout(key) in bool nv12;
(vProxy->height() != yProxy->height())) ?
GrSamplerState::Filter::kBilerp :
GrSamplerState::Filter::kNearest;
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
switch (colorSpace) {
case kJPEG_SkYUVColorSpace:
mat.setColMajorf(kJPEGConversionMatrix);
diff --git a/src/images/SkImageEncoderFns.h b/src/images/SkImageEncoderFns.h
index cd9972952d..6cde0cb087 100644
--- a/src/images/SkImageEncoderFns.h
+++ b/src/images/SkImageEncoderFns.h
@@ -392,7 +392,7 @@ static inline sk_sp<SkData> icc_from_color_space(const SkImageInfo& info) {
}
SkColorSpaceTransferFn fn;
- SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZD50;
if (cs->isNumericalTransferFn(&fn) && cs->toXYZD50(&toXYZD50)) {
return SkICC::WriteToICC(fn, toXYZD50);
}
diff --git a/tests/AndroidCodecTest.cpp b/tests/AndroidCodecTest.cpp
index e8c99abc54..3381d4f5ce 100644
--- a/tests/AndroidCodecTest.cpp
+++ b/tests/AndroidCodecTest.cpp
@@ -190,10 +190,10 @@ DEF_TEST(AndroidCodec_P3, r) {
REPORTER_ASSERT(r, !cs->isSRGB());
REPORTER_ASSERT(r, cs->gammaCloseToSRGB());
- SkMatrix44 matrix{SkMatrix44::kUninitialized_Constructor};
+ SkMatrix44 matrix;
cs->toXYZD50(&matrix);
- SkMatrix44 expected(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 expected;
static constexpr float kExpected[] = {
0.426254272f, 0.369018555f, 0.168914795f,
0.226013184f, 0.685974121f, 0.0880126953f,
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index e77e769937..225710c392 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -1495,8 +1495,7 @@ static void test_encode_icc(skiatest::Reporter* r, SkEncodedImageFormat format)
sk_sp<SkData> p3Data = p3Buf.detachAsData();
std::unique_ptr<SkCodec> p3Codec(SkCodec::MakeFromData(p3Data));
REPORTER_ASSERT(r, p3Codec->getInfo().colorSpace()->gammaCloseToSRGB());
- SkMatrix44 mat0(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 mat1(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat0, mat1;
bool success = p3->toXYZD50(&mat0);
REPORTER_ASSERT(r, success);
success = p3Codec->getInfo().colorSpace()->toXYZD50(&mat1);
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index deaf25256a..42986e950e 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -34,7 +34,7 @@ static void test_space(skiatest::Reporter* r, SkColorSpace* space,
REPORTER_ASSERT(r, nullptr != space);
REPORTER_ASSERT(r, expectedGamma == space->gammaNamed());
- SkMatrix44 mat{SkMatrix44::kUninitialized_Constructor};
+ SkMatrix44 mat;
space->toXYZD50(&mat);
const float src[] = {
1, 0, 0, 1,
@@ -113,7 +113,7 @@ DEF_TEST(ColorSpaceSRGBCompare, r) {
sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::MakeSRGB();
// Create an sRGB color space by value
- SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 srgbToxyzD50;
srgbToxyzD50.set3x3RowMajorf(g_sRGB_XYZ);
sk_sp<SkColorSpace> rgbColorSpace =
SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, srgbToxyzD50);
@@ -147,7 +147,7 @@ DEF_TEST(ColorSpaceSRGBLinearCompare, r) {
REPORTER_ASSERT(r, namedColorSpace == viaSrgbColorSpace);
// Create a linear sRGB color space by value
- SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 srgbToxyzD50;
srgbToxyzD50.set3x3RowMajorf(g_sRGB_XYZ);
sk_sp<SkColorSpace> rgbColorSpace =
SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, srgbToxyzD50);
@@ -294,7 +294,7 @@ static inline bool matrix_almost_equal(const SkMatrix44& a, const SkMatrix44& b)
static inline void check_primaries(skiatest::Reporter* r, const SkColorSpacePrimaries& primaries,
const SkMatrix44& reference) {
- SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 toXYZ;
bool result = primaries.toXYZD50(&toXYZ);
REPORTER_ASSERT(r, result);
REPORTER_ASSERT(r, matrix_almost_equal(toXYZ, reference));
@@ -311,7 +311,7 @@ DEF_TEST(ColorSpace_Primaries, r) {
srgb.fBY = 0.06f;
srgb.fWX = 0.3127f;
srgb.fWY = 0.3290f;
- SkMatrix44 srgbToXYZ(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 srgbToXYZ;
bool result = srgb.toXYZD50(&srgbToXYZ);
REPORTER_ASSERT(r, result);
@@ -329,7 +329,7 @@ DEF_TEST(ColorSpace_Primaries, r) {
proPhoto.fBY = 0.0001f;
proPhoto.fWX = 0.34567f;
proPhoto.fWY = 0.35850f;
- SkMatrix44 proToXYZ(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 proToXYZ;
proToXYZ.set3x3(0.7976749f, 0.2880402f, 0.0000000f,
0.1351917f, 0.7118741f, 0.0000000f,
0.0313534f, 0.0000857f, 0.8252100f);
@@ -345,7 +345,7 @@ DEF_TEST(ColorSpace_Primaries, r) {
ntsc.fBY = 0.08f;
ntsc.fWX = 0.31006f;
ntsc.fWY = 0.31616f;
- SkMatrix44 ntscToXYZ(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 ntscToXYZ;
ntscToXYZ.set3x3(0.6343706f, 0.3109496f, -0.0011817f,
0.1852204f, 0.5915984f, 0.0555518f,
0.1446290f, 0.0974520f, 0.7708399f);
@@ -363,7 +363,7 @@ DEF_TEST(ColorSpace_Primaries, r) {
p3.fWY = 0.3290f;
space = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
SkColorSpace::kDCIP3_D65_Gamut);
- SkMatrix44 reference(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 reference;
SkAssertResult(space->toXYZD50(&reference));
check_primaries(r, p3, reference);
@@ -395,7 +395,7 @@ DEF_TEST(ColorSpace_MatrixHash, r) {
fn.fF = 0.0f;
fn.fG = 3.0f;
- SkMatrix44 srgbMat(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 srgbMat;
srgbMat.set3x3RowMajorf(gSRGB_toXYZD50);
sk_sp<SkColorSpace> strange = SkColorSpace::MakeRGB(fn, srgbMat);
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp
index 6a42a44058..d0311f3fec 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -78,7 +78,7 @@ static bool bits_isonly(int value, int mask) {
static void test_constructor(skiatest::Reporter* reporter) {
// Allocate a matrix on the heap
- SkMatrix44* placeholderMatrix = new SkMatrix44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44* placeholderMatrix = new SkMatrix44;
std::unique_ptr<SkMatrix44> deleteMe(placeholderMatrix);
for (int row = 0; row < 4; ++row) {
@@ -107,7 +107,7 @@ static void test_constructor(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, *testMatrix == SkMatrix44::I());
// Verify that that constructing from an SkMatrix initializes everything.
- SkMatrix44 scaleMatrix(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 scaleMatrix;
scaleMatrix.setScale(3, 4, 5);
REPORTER_ASSERT(reporter, scaleMatrix.isScale());
testMatrix = new(&scaleMatrix) SkMatrix44(SkMatrix::I());
@@ -116,8 +116,8 @@ static void test_constructor(skiatest::Reporter* reporter) {
}
static void test_translate(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
+ SkMatrix44 inverse;
mat.setTranslate(0, 0, 0);
REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_Mask));
@@ -126,9 +126,7 @@ static void test_translate(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, mat.invert(&inverse));
REPORTER_ASSERT(reporter, bits_isonly(inverse.getType(), SkMatrix44::kTranslate_Mask));
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a,b,c;
a.set3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
b.setTranslate(10, 11, 12);
@@ -144,8 +142,8 @@ static void test_translate(skiatest::Reporter* reporter) {
}
static void test_scale(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
+ SkMatrix44 inverse;
mat.setScale(1, 1, 1);
REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_Mask));
@@ -154,9 +152,7 @@ static void test_scale(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, mat.invert(&inverse));
REPORTER_ASSERT(reporter, bits_isonly(inverse.getType(), SkMatrix44::kScale_Mask));
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a,b,c;
a.set3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
b.setScale(10, 11, 12);
@@ -214,7 +210,7 @@ static void test_map2(skiatest::Reporter* reporter, const SkMatrix44& mat) {
}
static void test_map2(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
for (size_t i = 0; i < SK_ARRAY_COUNT(gMakeProcs); ++i) {
gMakeProcs[i](&mat);
@@ -258,7 +254,7 @@ static void test_gettype(skiatest::Reporter* reporter) {
}
static void test_common_angles(skiatest::Reporter* reporter) {
- SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 rot;
// Test precision of rotation in common cases
int common_angles[] = { 0, 90, -90, 180, -180, 270, -270, 360, -360 };
for (int i = 0; i < 9; ++i) {
@@ -271,10 +267,7 @@ static void test_common_angles(skiatest::Reporter* reporter) {
static void test_concat(skiatest::Reporter* reporter) {
int i;
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 d(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a,b,c,d;
a.setTranslate(10, 10, 10);
b.setScale(2, 2, 2);
@@ -315,7 +308,7 @@ static void test_determinant(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, nearly_equal_double(1, a.determinant()));
a.set(1, 1, 2);
REPORTER_ASSERT(reporter, nearly_equal_double(2, a.determinant()));
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 b;
REPORTER_ASSERT(reporter, a.invert(&b));
REPORTER_ASSERT(reporter, nearly_equal_double(0.5, b.determinant()));
SkMatrix44 c = b = a;
@@ -336,7 +329,7 @@ static void test_determinant(skiatest::Reporter* reporter) {
}
static void test_invert(skiatest::Reporter* reporter) {
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 inverse;
double inverseData[16];
SkMatrix44 identity(SkMatrix44::kIdentity_Constructor);
@@ -348,7 +341,7 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 1, 0,
0, 0, 0, 1);
- SkMatrix44 translation(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 translation;
translation.setTranslate(2, 3, 4);
translation.invert(&inverse);
inverse.asRowMajord(inverseData);
@@ -358,7 +351,7 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 1, -4,
0, 0, 0, 1);
- SkMatrix44 scale(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 scale;
scale.setScale(2, 4, 8);
scale.invert(&inverse);
inverse.asRowMajord(inverseData);
@@ -368,7 +361,7 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 0.125, 0,
0, 0, 0, 1);
- SkMatrix44 scaleTranslation(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 scaleTranslation;
scaleTranslation.setScale(32, 128, 1024);
scaleTranslation.preTranslate(2, 3, 4);
scaleTranslation.invert(&inverse);
@@ -379,10 +372,10 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 0.0009765625, -4,
0, 0, 0, 1);
- SkMatrix44 rotation(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 rotation;
rotation.setRotateDegreesAbout(0, 0, 1, 90);
rotation.invert(&inverse);
- SkMatrix44 expected(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 expected;
double expectedInverseRotation[16] =
{0, 1, 0, 0,
-1, 0, 0, 0,
@@ -391,7 +384,7 @@ static void test_invert(skiatest::Reporter* reporter) {
expected.setRowMajord(expectedInverseRotation);
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
- SkMatrix44 affine(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 affine;
affine.setRotateDegreesAbout(0, 0, 1, 90);
affine.preScale(10, 20, 100);
affine.preTranslate(2, 3, 4);
@@ -455,8 +448,7 @@ static void test_invert(skiatest::Reporter* reporter) {
}
static void test_transpose(skiatest::Reporter* reporter) {
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a,b;
int i = 0;
for (int row = 0; row < 4; ++row) {
@@ -471,7 +463,7 @@ static void test_transpose(skiatest::Reporter* reporter) {
}
static void test_get_set_double(skiatest::Reporter* reporter) {
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a;
for (int row = 0; row < 4; ++row) {
for (int col = 0; col < 4; ++col) {
a.setDouble(row, col, 3.141592653589793);
@@ -488,7 +480,7 @@ static void test_get_set_double(skiatest::Reporter* reporter) {
static void test_set_3x3(skiatest::Reporter* r) {
static float vals[9] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, };
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
mat.set3x3RowMajorf(vals);
REPORTER_ASSERT(r, 1.0f == mat.getFloat(0, 0));
@@ -503,8 +495,7 @@ static void test_set_3x3(skiatest::Reporter* r) {
}
static void test_set_row_col_major(skiatest::Reporter* reporter) {
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a,b;
for (int row = 0; row < 4; ++row) {
for (int col = 0; col < 4; ++col) {
@@ -540,7 +531,7 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
5, 6, 0, 8,
0, 0, 1, 0,
13, 14, 0, 16 };
- SkMatrix44 a44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a44;
a44.setRowMajor(values4x4);
SkMatrix a33 = a44;
@@ -549,7 +540,7 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, expected33 == a33);
SkMatrix44 a44flattened = a33;
- SkMatrix44 expected44flattened(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 expected44flattened;
expected44flattened.setRowMajor(values4x4flattened);
REPORTER_ASSERT(reporter, nearly_equal(a44flattened, expected44flattened));
@@ -652,8 +643,8 @@ static void test(bool expected, skiatest::Reporter* reporter, const SkMatrix44&
}
static void test_preserves_2d_axis_alignment(skiatest::Reporter* reporter) {
- SkMatrix44 transform(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 transform2(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 transform;
+ SkMatrix44 transform2;
static const struct TestCase {
SkMScalar a; // row 1, column 1
@@ -814,7 +805,7 @@ static void test_preserves_2d_axis_alignment(skiatest::Reporter* reporter) {
// just want to exercise the various converters for MScalar
static void test_toint(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
mat.setScale(3, 3, 3);
SkMScalar sum = SkMScalarFloor(mat.get(0, 0)) +
@@ -829,11 +820,11 @@ static void test_toint(skiatest::Reporter* reporter) {
}
DEF_TEST(Matrix44, reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 iden1(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 iden2(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
+ SkMatrix44 inverse;
+ SkMatrix44 iden1;
+ SkMatrix44 iden2;
+ SkMatrix44 rot;
mat.setTranslate(1, 1, 1);
mat.invert(&inverse);
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index d5f2a6cfe4..71c437ce8a 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -913,7 +913,7 @@ static void test_surface_creation_and_snapshot_with_color_space(
std::function<sk_sp<SkSurface>(const SkImageInfo&)> surfaceMaker) {
auto srgbColorSpace = SkColorSpace::MakeSRGB();
- SkMatrix44 srgbMatrix{SkMatrix44::kUninitialized_Constructor};
+ SkMatrix44 srgbMatrix;
srgbColorSpace->toXYZD50(&srgbMatrix);
SkColorSpaceTransferFn oddGamma;
diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp
index 7eacb3fc86..f7878b84a3 100644
--- a/tools/flags/SkCommonFlagsConfig.cpp
+++ b/tools/flags/SkCommonFlagsConfig.cpp
@@ -314,7 +314,7 @@ static bool parse_option_gpu_color(const SkString& value,
*outColorType = kRGBA_F16_SkColorType;
*outColorSpace = SkColorSpace::MakeSRGB();
} else if (value.equals("narrow") || value.equals("enarrow")) {
- SkMatrix44 narrow_gamut(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 narrow_gamut;
narrow_gamut.set3x3RowMajorf(gNarrow_toXYZD50);
*outColorType = value.equals("narrow") ? kRGBA_8888_SkColorType : kRGBA_F16_SkColorType;
*outColorSpace = SkColorSpace::MakeRGB(k2Dot2Curve_SkGammaNamed, narrow_gamut);
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 5919654ff9..b37ee9f9ea 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -1109,7 +1109,7 @@ void Viewer::drawSlide(SkCanvas* canvas) {
if (ColorMode::kLegacy != fColorMode) {
auto transferFn = (ColorMode::kColorManagedLinearF16 == fColorMode)
? SkColorSpace::kLinear_RenderTargetGamma : SkColorSpace::kSRGB_RenderTargetGamma;
- SkMatrix44 toXYZ(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 toXYZ;
SkAssertResult(fColorSpacePrimaries.toXYZD50(&toXYZ));
if (ColorMode::kColorManagedSRGB8888_NonLinearBlending == fColorMode) {
cs = SkColorSpace::MakeRGB(fColorSpaceTransferFn, toXYZ);