diff options
author | Hal Canary <halcanary@google.com> | 2017-04-11 12:12:02 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-11 18:57:20 +0000 |
commit | fafe135349bd34961a12bfd8185733709cd0e45e (patch) | |
tree | b40dbd0a0787901843aba62eec1f21a1fe3936e1 | |
parent | 8a8e5fe290307952f9b8df1eb680eed52d83eca9 (diff) |
SkSize can be aggregate-initialized
Previosly, SkSize had a base class, which prevented it.
Also removes unused SkISize::clampNegToZero() and
SkSize::clampNegToZero().
Change-Id: I7b93b42f6f6381c66e294bbedee99ad53c6c3436
Reviewed-on: https://skia-review.googlesource.com/13187
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
-rw-r--r-- | bench/PathBench.cpp | 4 | ||||
-rw-r--r-- | dm/DMSrcSink.cpp | 36 | ||||
-rw-r--r-- | gm/lattice.cpp | 2 | ||||
-rw-r--r-- | gm/ninepatchstretch.cpp | 2 | ||||
-rw-r--r-- | include/core/SkSize.h | 121 | ||||
-rw-r--r-- | src/codec/SkAndroidCodec.cpp | 10 | ||||
-rw-r--r-- | src/core/SkBlurImageFilter.cpp | 10 | ||||
-rw-r--r-- | src/core/SkMaskCache.cpp | 12 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 4 | ||||
-rw-r--r-- | src/pdf/SkPDFShader.cpp | 8 | ||||
-rw-r--r-- | src/utils/SkMultiPictureDocument.cpp | 11 | ||||
-rw-r--r-- | src/utils/SkShadowPaintFilterCanvas.cpp | 2 | ||||
-rw-r--r-- | src/xps/SkXPSDocument.cpp | 3 | ||||
-rw-r--r-- | tests/PathTest.cpp | 2 | ||||
-rw-r--r-- | tests/SizeTest.cpp | 4 |
15 files changed, 99 insertions, 132 deletions
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp index 3a1410a32d..6991db558d 100644 --- a/bench/PathBench.cpp +++ b/bench/PathBench.cpp @@ -1115,8 +1115,8 @@ private: const SkRect ConservativelyContainsBench::kBounds = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100)); -const SkSize ConservativelyContainsBench::kQueryMin = SkSize::Make(SkIntToScalar(1), SkIntToScalar(1)); -const SkSize ConservativelyContainsBench::kQueryMax = SkSize::Make(SkIntToScalar(40), SkIntToScalar(40)); +const SkSize ConservativelyContainsBench::kQueryMin = {SkIntToScalar(1), SkIntToScalar(1)}; +const SkSize ConservativelyContainsBench::kQueryMax = {SkIntToScalar(40), SkIntToScalar(40)}; const SkRect ConservativelyContainsBench::kBaseRect = SkRect::MakeXYWH(SkIntToScalar(25), SkIntToScalar(25), SkIntToScalar(50), SkIntToScalar(50)); const SkScalar ConservativelyContainsBench::kRRRadii[2] = {SkIntToScalar(5), SkIntToScalar(10)}; diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 6db8f262e6..e8c33a4c4b 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -243,10 +243,10 @@ Error BRDSrc::draw(SkCanvas* canvas) const { SkISize BRDSrc::size() const { std::unique_ptr<SkBitmapRegionDecoder> brd(create_brd(fPath)); if (brd) { - return SkISize::Make(SkTMax(1, brd->width() / (int) fSampleSize), - SkTMax(1, brd->height() / (int) fSampleSize)); + return {SkTMax(1, brd->width() / (int)fSampleSize), + SkTMax(1, brd->height() / (int)fSampleSize)}; } - return SkISize::Make(0, 0); + return {0, 0}; } static SkString get_scaled_name(const Path& path, float scale) { @@ -751,7 +751,7 @@ SkISize CodecSrc::size() const { sk_sp<SkData> encoded(SkData::MakeFromFileName(fPath.c_str())); std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(encoded)); if (nullptr == codec) { - return SkISize::Make(0, 0); + return {0, 0}; } auto imageSize = codec->getScaledDimensions(fScale); @@ -857,7 +857,7 @@ SkISize AndroidCodecSrc::size() const { sk_sp<SkData> encoded(SkData::MakeFromFileName(fPath.c_str())); std::unique_ptr<SkAndroidCodec> codec(SkAndroidCodec::NewFromData(encoded)); if (nullptr == codec) { - return SkISize::Make(0, 0); + return {0, 0}; } return codec->getSampledDimensions(fSampleSize); } @@ -976,7 +976,7 @@ SkISize ImageGenSrc::size() const { sk_sp<SkData> encoded(SkData::MakeFromFileName(fPath.c_str())); std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(encoded)); if (nullptr == codec) { - return SkISize::Make(0, 0); + return {0, 0}; } return codec->getInfo().dimensions(); } @@ -1080,9 +1080,9 @@ SkISize ColorCodecSrc::size() const { sk_sp<SkData> encoded(SkData::MakeFromFileName(fPath.c_str())); std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(encoded)); if (nullptr == codec) { - return SkISize::Make(0, 0); + return {0, 0}; } - return SkISize::Make(codec->getInfo().width(), codec->getInfo().height()); + return {codec->getInfo().width(), codec->getInfo().height()}; } Name ColorCodecSrc::name() const { @@ -1114,15 +1114,15 @@ Error SKPSrc::draw(SkCanvas* canvas) const { SkISize SKPSrc::size() const { std::unique_ptr<SkStream> stream = SkStream::MakeFromFile(fPath.c_str()); if (!stream) { - return SkISize::Make(0,0); + return {0, 0}; } SkPictInfo info; if (!SkPicture::InternalOnly_StreamIsSKP(stream.get(), &info)) { - return SkISize::Make(0,0); + return {0, 0}; } SkRect viewport = kSKPViewport; if (!viewport.intersect(info.fCullRect)) { - return SkISize::Make(0,0); + return {0, 0}; } return viewport.roundOut().size(); } @@ -1132,10 +1132,10 @@ Name SKPSrc::name() const { return SkOSPath::Basename(fPath.c_str()); } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #if defined(SK_XML) // Used when the image doesn't have an intrinsic size. -static const SkSize kDefaultSVGSize = SkSize::Make(1000, 1000); +static const SkSize kDefaultSVGSize = {1000, 1000}; // Used to force-scale tiny fixed-size images. -static const SkSize kMinimumSVGSize = SkSize::Make(128, 128); +static const SkSize kMinimumSVGSize = {128, 128}; SVGSrc::SVGSrc(Path path) : fName(SkOSPath::Basename(path.c_str())) @@ -1174,11 +1174,11 @@ Error SVGSrc::draw(SkCanvas* canvas) const { SkISize SVGSrc::size() const { if (!fDom) { - return SkISize::Make(0, 0); + return {0, 0}; } - return SkSize::Make(fDom->containerSize().width() * fScale, - fDom->containerSize().height() * fScale).toRound(); + return SkSize{fDom->containerSize().width() * fScale, fDom->containerSize().height() * fScale} + .toRound(); } Name SVGSrc::name() const { return fName; } @@ -1207,7 +1207,7 @@ int MSKPSrc::pageCount() const { return fPages.count(); } SkISize MSKPSrc::size() const { return this->size(0); } SkISize MSKPSrc::size(int i) const { - return i >= 0 && i < fPages.count() ? fPages[i].fSize.toCeil() : SkISize::Make(0, 0); + return i >= 0 && i < fPages.count() ? fPages[i].fSize.toCeil() : SkISize{0, 0}; } Error MSKPSrc::draw(SkCanvas* c) const { return this->draw(0, c); } @@ -1522,7 +1522,7 @@ static SkISize auto_compute_translate(SkMatrix* matrix, int srcW, int srcH) { SkRect bounds = SkRect::MakeIWH(srcW, srcH); matrix->mapRect(&bounds); matrix->postTranslate(-bounds.x(), -bounds.y()); - return SkISize::Make(SkScalarRoundToInt(bounds.width()), SkScalarRoundToInt(bounds.height())); + return {SkScalarRoundToInt(bounds.width()), SkScalarRoundToInt(bounds.height())}; } ViaMatrix::ViaMatrix(SkMatrix matrix, Sink* sink) : Via(sink), fMatrix(matrix) {} diff --git a/gm/lattice.cpp b/gm/lattice.cpp index 46c5a94989..55759d0cd8 100644 --- a/gm/lattice.cpp +++ b/gm/lattice.cpp @@ -107,7 +107,7 @@ protected: padRight, padBottom); image_to_bitmap(image.get(), &bitmap); - const SkTSize<SkScalar> size[] = { + const SkSize size[] = { { 50, 50, }, // shrink in both axes { 50, 200, }, // shrink in X { 200, 50, }, // shrink in Y diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp index 4c6e7d2742..90a02161ef 100644 --- a/gm/ninepatchstretch.cpp +++ b/gm/ninepatchstretch.cpp @@ -78,7 +78,7 @@ protected: // amount of bm that should not be stretched (unless we have to) const SkScalar fixed = SkIntToScalar(fBitmap.width() - fCenter.width()); - const SkTSize<SkScalar> size[] = { + const SkSize size[] = { { fixed * 4 / 5, fixed * 4 / 5 }, // shrink in both axes { fixed * 4 / 5, fixed * 4 }, // shrink in X { fixed * 4, fixed * 4 / 5 }, // shrink in Y diff --git a/include/core/SkSize.h b/include/core/SkSize.h index 153335da68..061e3c4ca2 100644 --- a/include/core/SkSize.h +++ b/include/core/SkSize.h @@ -10,108 +10,83 @@ #include "SkScalar.h" -template <typename T> struct SkTSize { - T fWidth; - T fHeight; - - static SkTSize Make(T w, T h) { - SkTSize s; - s.fWidth = w; - s.fHeight = h; - return s; - } +struct SkISize { + int32_t fWidth; + int32_t fHeight; - static SkTSize MakeEmpty() { - return {0, 0}; - } + static SkISize Make(int32_t w, int32_t h) { return {w, h}; } - void set(T w, T h) { - fWidth = w; - fHeight = h; - } + static SkISize MakeEmpty() { return {0, 0}; } + + void set(int32_t w, int32_t h) { *this = SkISize{w, h}; } /** Returns true iff fWidth == 0 && fHeight == 0 */ - bool isZero() const { - return 0 == fWidth && 0 == fHeight; - } + bool isZero() const { return 0 == fWidth && 0 == fHeight; } /** Returns true if either widht or height are <= 0 */ - bool isEmpty() const { - return fWidth <= 0 || fHeight <= 0; - } + bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } /** Set the width and height to 0 */ - void setEmpty() { - fWidth = fHeight = 0; - } + void setEmpty() { fWidth = fHeight = 0; } - T width() const { return fWidth; } - T height() const { return fHeight; } - - /** If width or height is < 0, it is set to 0 */ - void clampNegToZero() { - if (fWidth < 0) { - fWidth = 0; - } - if (fHeight < 0) { - fHeight = 0; - } - } + int32_t width() const { return fWidth; } + int32_t height() const { return fHeight; } - bool equals(T w, T h) const { - return fWidth == w && fHeight == h; - } + bool equals(int32_t w, int32_t h) const { return fWidth == w && fHeight == h; } }; -template <typename T> -static inline bool operator==(const SkTSize<T>& a, const SkTSize<T>& b) { +static inline bool operator==(const SkISize& a, const SkISize& b) { return a.fWidth == b.fWidth && a.fHeight == b.fHeight; } -template <typename T> -static inline bool operator!=(const SkTSize<T>& a, const SkTSize<T>& b) { - return !(a == b); -} +static inline bool operator!=(const SkISize& a, const SkISize& b) { return !(a == b); } /////////////////////////////////////////////////////////////////////////////// -typedef SkTSize<int32_t> SkISize; +struct SkSize { + SkScalar fWidth; + SkScalar fHeight; -struct SkSize : public SkTSize<SkScalar> { - static SkSize Make(SkScalar w, SkScalar h) { - SkSize s; - s.fWidth = w; - s.fHeight = h; - return s; - } + static SkSize Make(SkScalar w, SkScalar h) { return {w, h}; } static SkSize Make(const SkISize& src) { - return Make(SkIntToScalar(src.width()), SkIntToScalar(src.height())); + return {SkIntToScalar(src.width()), SkIntToScalar(src.height())}; } SkSize& operator=(const SkISize& src) { - this->set(SkIntToScalar(src.fWidth), SkIntToScalar(src.fHeight)); - return *this; + return *this = SkSize{SkIntToScalar(src.fWidth), SkIntToScalar(src.fHeight)}; } - SkISize toRound() const { - SkISize s; - s.set(SkScalarRoundToInt(fWidth), SkScalarRoundToInt(fHeight)); - return s; - } + static SkSize MakeEmpty() { return {0, 0}; } - SkISize toCeil() const { - SkISize s; - s.set(SkScalarCeilToInt(fWidth), SkScalarCeilToInt(fHeight)); - return s; - } + void set(SkScalar w, SkScalar h) { *this = SkSize{w, h}; } - SkISize toFloor() const { - SkISize s; - s.set(SkScalarFloorToInt(fWidth), SkScalarFloorToInt(fHeight)); - return s; - } + /** Returns true iff fWidth == 0 && fHeight == 0 + */ + bool isZero() const { return 0 == fWidth && 0 == fHeight; } + + /** Returns true if either widht or height are <= 0 */ + bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } + + /** Set the width and height to 0 */ + void setEmpty() { *this = SkSize{0, 0}; } + + SkScalar width() const { return fWidth; } + SkScalar height() const { return fHeight; } + + bool equals(SkScalar w, SkScalar h) const { return fWidth == w && fHeight == h; } + + SkISize toRound() const { return {SkScalarRoundToInt(fWidth), SkScalarRoundToInt(fHeight)}; } + + SkISize toCeil() const { return {SkScalarCeilToInt(fWidth), SkScalarCeilToInt(fHeight)}; } + + SkISize toFloor() const { return {SkScalarFloorToInt(fWidth), SkScalarFloorToInt(fHeight)}; } }; +static inline bool operator==(const SkSize& a, const SkSize& b) { + return a.fWidth == b.fWidth && a.fHeight == b.fHeight; +} + +static inline bool operator!=(const SkSize& a, const SkSize& b) { return !(a == b); } #endif diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp index 96ad72a259..b30dd52e4c 100644 --- a/src/codec/SkAndroidCodec.cpp +++ b/src/codec/SkAndroidCodec.cpp @@ -209,7 +209,7 @@ sk_sp<SkColorSpace> SkAndroidCodec::computeOutputColorSpace(SkColorType outputCo SkISize SkAndroidCodec::getSampledDimensions(int sampleSize) const { if (!is_valid_sample_size(sampleSize)) { - return SkISize::Make(0, 0); + return {0, 0}; } // Fast path for when we are not scaling. @@ -230,7 +230,7 @@ bool SkAndroidCodec::getSupportedSubset(SkIRect* desiredSubset) const { SkISize SkAndroidCodec::getSampledSubsetDimensions(int sampleSize, const SkIRect& subset) const { if (!is_valid_sample_size(sampleSize)) { - return SkISize::Make(0, 0); + return {0, 0}; } // We require that the input subset is a subset that is supported by SkAndroidCodec. @@ -238,7 +238,7 @@ SkISize SkAndroidCodec::getSampledSubsetDimensions(int sampleSize, const SkIRect // are made to the subset. SkIRect copySubset = subset; if (!this->getSupportedSubset(©Subset) || copySubset != subset) { - return SkISize::Make(0, 0); + return {0, 0}; } // If the subset is the entire image, for consistency, use getSampledDimensions(). @@ -248,8 +248,8 @@ SkISize SkAndroidCodec::getSampledSubsetDimensions(int sampleSize, const SkIRect // This should perhaps call a virtual function, but currently both of our subclasses // want the same implementation. - return SkISize::Make(get_scaled_dimension(subset.width(), sampleSize), - get_scaled_dimension(subset.height(), sampleSize)); + return {get_scaled_dimension(subset.width(), sampleSize), + get_scaled_dimension(subset.height(), sampleSize)}; } SkCodec::Result SkAndroidCodec::getAndroidPixels(const SkImageInfo& info, void* pixels, diff --git a/src/core/SkBlurImageFilter.cpp b/src/core/SkBlurImageFilter.cpp index e0f6523593..5e7f2a53ce 100644 --- a/src/core/SkBlurImageFilter.cpp +++ b/src/core/SkBlurImageFilter.cpp @@ -75,13 +75,9 @@ static SkVector map_sigma(const SkSize& localSigma, const SkMatrix& ctm) { return sigma; } -SkBlurImageFilterImpl::SkBlurImageFilterImpl(SkScalar sigmaX, - SkScalar sigmaY, - sk_sp<SkImageFilter> input, - const CropRect* cropRect) - : INHERITED(&input, 1, cropRect) - , fSigma(SkSize::Make(sigmaX, sigmaY)) { -} +SkBlurImageFilterImpl::SkBlurImageFilterImpl( + SkScalar sigmaX, SkScalar sigmaY, sk_sp<SkImageFilter> input, const CropRect* cropRect) + : INHERITED(&input, 1, cropRect), fSigma{sigmaX, sigmaY} {} sk_sp<SkFlattenable> SkBlurImageFilterImpl::CreateProc(SkReadBuffer& buffer) { SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); diff --git a/src/core/SkMaskCache.cpp b/src/core/SkMaskCache.cpp index ccfae18e05..f998a928cc 100644 --- a/src/core/SkMaskCache.cpp +++ b/src/core/SkMaskCache.cpp @@ -110,15 +110,15 @@ public: SkASSERT(1 == count || 2 == count); SkIRect ir; rects[0].roundOut(&ir); - fSizes[0] = SkSize::Make(rects[0].width(), rects[0].height()); + fSizes[0] = SkSize{rects[0].width(), rects[0].height()}; if (2 == count) { - fSizes[1] = SkSize::Make(rects[1].width(), rects[1].height()); - fSizes[2] = SkSize::Make(rects[0].x() - rects[1].x(), rects[0].y() - rects[1].y()); + fSizes[1] = SkSize{rects[1].width(), rects[1].height()}; + fSizes[2] = SkSize{rects[0].x() - rects[1].x(), rects[0].y() - rects[1].y()}; } else { - fSizes[1] = SkSize::Make(0, 0); - fSizes[2] = SkSize::Make(0, 0); + fSizes[1] = SkSize{0, 0}; + fSizes[2] = SkSize{0, 0}; } - fSizes[3] = SkSize::Make(rects[0].x() - ir.x(), rects[0].y() - ir.y()); + fSizes[3] = SkSize{rects[0].x() - ir.x(), rects[0].y() - ir.y()}; this->init(&gRectsBlurKeyNamespaceLabel, 0, sizeof(fSigma) + sizeof(fStyle) + sizeof(fQuality) + sizeof(fSizes)); diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 10b4241235..992508db24 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -2042,9 +2042,7 @@ int SkPDFDevice::getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID) { return resourceIndex; } -static SkSize rect_to_size(const SkRect& r) { - return SkSize::Make(r.width(), r.height()); -} +static SkSize rect_to_size(const SkRect& r) { return {r.width(), r.height()}; } static sk_sp<SkImage> color_filter(const SkImageSubset& imageSubset, SkColorFilter* colorFilter) { diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp index bc87c4a0fe..6a511855b9 100644 --- a/src/pdf/SkPDFShader.cpp +++ b/src/pdf/SkPDFShader.cpp @@ -1269,10 +1269,10 @@ SkPDFShader::State::State(SkShader* shader, const SkMatrix& canvasTransform, rasterScale *= SkScalarSqrt(kMaxBitmapArea / bitmapArea); } - SkISize size = SkISize::Make(SkScalarRoundToInt(rasterScale * bbox.width()), - SkScalarRoundToInt(rasterScale * bbox.height())); - SkSize scale = SkSize::Make(SkIntToScalar(size.width()) / shaderRect.width(), - SkIntToScalar(size.height()) / shaderRect.height()); + SkISize size = {SkScalarRoundToInt(rasterScale * bbox.width()), + SkScalarRoundToInt(rasterScale * bbox.height())}; + SkSize scale = {SkIntToScalar(size.width()) / shaderRect.width(), + SkIntToScalar(size.height()) / shaderRect.height()}; imageDst->allocN32Pixels(size.width(), size.height()); imageDst->eraseColor(SK_ColorTRANSPARENT); diff --git a/src/utils/SkMultiPictureDocument.cpp b/src/utils/SkMultiPictureDocument.cpp index 4251442fcf..9868ca2692 100644 --- a/src/utils/SkMultiPictureDocument.cpp +++ b/src/utils/SkMultiPictureDocument.cpp @@ -37,10 +37,9 @@ static constexpr char kEndPage[] = "SkMultiPictureEndPage"; const uint32_t kVersion = 2; static SkSize join(const SkTArray<SkSize>& sizes) { - SkSize joined = SkSize::Make(0, 0); + SkSize joined = {0, 0}; for (SkSize s : sizes) { - joined = SkSize::Make(SkTMax(joined.width(), s.width()), - SkTMax(joined.height(), s.height())); + joined = SkSize{SkTMax(joined.width(), s.width()), SkTMax(joined.height(), s.height())}; } return joined; } @@ -189,10 +188,10 @@ bool SkMultiPictureDocumentRead(SkStreamSeekable* stream, if (!SkMultiPictureDocumentReadPageSizes(stream, dstArray, dstArrayCount)) { return false; } - SkSize joined = SkSize::Make(0.0f, 0.0f); + SkSize joined = {0.0f, 0.0f}; for (int i = 0; i < dstArrayCount; ++i) { - joined = SkSize::Make(SkTMax(joined.width(), dstArray[i].fSize.width()), - SkTMax(joined.height(), dstArray[i].fSize.height())); + joined = SkSize{SkTMax(joined.width(), dstArray[i].fSize.width()), + SkTMax(joined.height(), dstArray[i].fSize.height())}; } auto picture = SkPicture::MakeFromStream(stream); diff --git a/src/utils/SkShadowPaintFilterCanvas.cpp b/src/utils/SkShadowPaintFilterCanvas.cpp index 289ae3cd0c..bf4a4242f2 100644 --- a/src/utils/SkShadowPaintFilterCanvas.cpp +++ b/src/utils/SkShadowPaintFilterCanvas.cpp @@ -56,7 +56,7 @@ SkISize SkShadowPaintFilterCanvas::ComputeDepthMapSize(const SkLights::Light& li // of the point light and the shapes, etc... If we take upper bounds // on those metrics, the shadow map will be pretty big in any case. // Thus, just using 4x the width and height seems to work for most scenes. - return SkISize::Make(width * 4, height * 4); + return {width * 4, height * 4}; } int dMapWidth = SkMin32(maxDepth * fabs(light.dir().fX) + width, diff --git a/src/xps/SkXPSDocument.cpp b/src/xps/SkXPSDocument.cpp index 80dd5eea6a..0d12e4f7f8 100644 --- a/src/xps/SkXPSDocument.cpp +++ b/src/xps/SkXPSDocument.cpp @@ -36,8 +36,7 @@ SkXPSDocument::~SkXPSDocument() { SkCanvas* SkXPSDocument::onBeginPage(SkScalar width, SkScalar height, const SkRect& trimBox) { - fDevice.beginSheet(fUnitsPerMeter, fPixelsPerMeter, - SkSize::Make(width, height)); + fDevice.beginSheet(fUnitsPerMeter, fPixelsPerMeter, {width, height}); fCanvas.reset(new SkCanvas(&fDevice)); fCanvas->clipRect(trimBox); fCanvas->translate(trimBox.x(), trimBox.y()); diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index d41ed47f77..c4df3887af 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -4531,7 +4531,7 @@ DEF_TEST(Paths, reporter) { test_path_crbugskia6003(); test_fuzz_crbug_668907(); - SkTSize<SkScalar>::Make(3,4); + SkSize::Make(3, 4); SkPath p, empty; SkRect bounds, bounds2; diff --git a/tests/SizeTest.cpp b/tests/SizeTest.cpp index 9800aa29c3..9dccdeb6b3 100644 --- a/tests/SizeTest.cpp +++ b/tests/SizeTest.cpp @@ -16,7 +16,7 @@ DEF_TEST(ISize, reporter) { REPORTER_ASSERT(reporter, a.isEmpty()); a.set(5, -5); REPORTER_ASSERT(reporter, a.isEmpty()); - a.clampNegToZero(); + a = SkISize{5, 0}; REPORTER_ASSERT(reporter, a.isEmpty()); b.set(5, 0); REPORTER_ASSERT(reporter, a == b); @@ -42,7 +42,7 @@ DEF_TEST(Size, reporter) { REPORTER_ASSERT(reporter, a.isEmpty()); a.set(x, -x); REPORTER_ASSERT(reporter, a.isEmpty()); - a.clampNegToZero(); + a = SkSize{x, 0}; REPORTER_ASSERT(reporter, a.isEmpty()); b.set(x, 0); REPORTER_ASSERT(reporter, a == b); |