Remove SkSize& SkSize::operator=(const SkISize&)

Having it means you cannot write:

SkSize size;
float x, y;
size = {x , y};

clang allows it but GCC does not, claiming it is ambiguous between the
implicitly generated
SkSize& SkSize::operator=(const SkSize&)
  and
SkSize& SkSize::operator=(const SkISize&)

clang gives the same error if the former is explicitly declared default.

Change-Id: I3b64436ef6aa669b3d87e7f37057c5dcb4add987
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257880
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2019-12-04 10:33:52 -05:00 committed by Skia Commit-Bot
parent a06f9d0787
commit 4e1066f248
6 changed files with 8 additions and 11 deletions

View File

@ -7,6 +7,9 @@ This file includes a list of high level updates for each milestone release.
Milestone 80
<Insert new notes here- top is most recent.>
* Removed SkSize& SkSize::operator=(const SkISize&)
https://review.skia.org/257880
* SkISize width() and height() now constexpr
https://review.skia.org/257680

View File

@ -1663,8 +1663,7 @@ Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
SKPSink::SKPSink() {}
Error SKPSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
SkSize size;
size = src.size();
auto size = SkSize::Make(src.size());
SkPictureRecorder recorder;
Error err = src.draw(recorder.beginRecording(size.width(), size.height()));
if (!err.isEmpty()) {

View File

@ -56,10 +56,6 @@ struct SkSize {
return {SkIntToScalar(src.width()), SkIntToScalar(src.height())};
}
SkSize& operator=(const SkISize& src) {
return *this = SkSize{SkIntToScalar(src.fWidth), SkIntToScalar(src.fHeight)};
}
static SkSize MakeEmpty() { return {0, 0}; }
void set(SkScalar w, SkScalar h) { *this = SkSize{w, h}; }

View File

@ -121,7 +121,7 @@ sk_sp<sksg::RenderNode> AnimationBuilder::attachImageAsset(const skjson::ObjectV
}
// Image layers are sized explicitly.
layer_info->fSize = asset_info->fSize;
layer_info->fSize = SkSize::Make(asset_info->fSize);
if (!image_transform) {
// No resize needed.

View File

@ -40,8 +40,8 @@ std::unique_ptr<GrFragmentProcessor> GrYUVtoRGBEffect::Make(const sk_sp<GrTextur
// the image size divided by the subsampling factor (2). Our API for creating YUVA doesn't
// capture the intended subsampling (and we should fix that). This fixes up 2x subsampling
// for images with odd widths/heights (e.g. JPEG 420 or 422).
scales[i] = SkSize{dimensions.width() / SkIntToScalar(YDimensions.width()),
dimensions.height() / SkIntToScalar(YDimensions.height())};
scales[i] = {dimensions.width() / SkIntToScalar(YDimensions.width()),
dimensions.height() / SkIntToScalar(YDimensions.height())};
if ((YDimensions.width() & 0b1) && dimensions.width() == YDimensions.width() / 2 + 1) {
scales[i].fWidth = 0.5f;
}

View File

@ -317,8 +317,7 @@ int main(int argc, char** argv) {
}
}
if (options.skp) {
SkSize size;
size = options.size;
auto size = SkSize::Make(options.size);
SkPictureRecorder recorder;
srand(0);
draw(prepare_canvas(recorder.beginRecording(size.width(), size.height())));