Skip to content

Conversation

@Sheyne
Copy link
Contributor

@Sheyne Sheyne commented Oct 1, 2019

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Before going though all the prereqs since I'm new to this project I'm creating this to discuss #1016 further

Note that the switch approach isn't possible because Types aren't compile time constants. If statements should work though

Possible now we have access to C# 8 😄

@CLAassistant
Copy link

CLAassistant commented Oct 1, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sheyne thanks for the contribution! Generally, it looks good, but there are two blockers to be resolved in order to allow it through our QA gate:

  1. StyleCop findings shall be fixed. Hint: in release mode warnings are shown as errors.
  2. We need test cases for the new feature, so we can change the implementation without introducing a regression.

Suggestion: a variant of PngEncoderTests.WorksWithAllBitDepths:

  • Without passing PngColorType and PngBitDepth as argument, letting PngEncoder to infer it
  • We need to make sure that all cases are covered, including the handling of the alpha channel
  • Instead of using test pattern, a blank image could be manipulated in a way similar to the reproduction steps in #1016. The [WithBlankImages] attribute could be utilized:
[WithBlankImages(2, 2, PixelTypes.Rgb24 | PixelTypes.Rgba32 | PixelTypes.Gray16 | ...)]

It's kinda tricky to do Rgba64 -> TPixel conversions at the moment. The following code snippet may help:

Rgba64 rgba = new Rgba64(2017, 2017, 2017, 43777);
TPixel pixel = ((Color)rgba).ToPixel<TPixel>();
image[0, 0] = pixel;

UPDATE: Made a simplification

@Sheyne
Copy link
Contributor Author

Sheyne commented Oct 3, 2019

For some reason the project isn't building on my machine, so I can't run the test suite locally. I'm hoping that the CI test checks it okay. Is there some dependency I need to install?

@JimBobSquarePants
Copy link
Member

@Sheyne What build issues are you seeing? The CI builds are working but we've got failing tests related to your changes.

https://ci.appveyor.com/project/six-labors/imagesharp/builds/27856181/job/njb2lp2nsiy4ntfq/tests

@Sheyne
Copy link
Contributor Author

Sheyne commented Oct 17, 2019

@JimBobSquarePants

https://gist.github.com/Sheyne/ef6ac8657d30b508ec4b59d3bca25bc1

@codecov
Copy link

codecov bot commented Jan 27, 2020

Codecov Report

Merging #1019 into master will decrease coverage by 8.37%.
The diff coverage is 87.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1019      +/-   ##
==========================================
- Coverage   89.86%   81.49%   -8.38%     
==========================================
  Files        1099      704     -395     
  Lines       48843    29381   -19462     
  Branches     3441     3289     -152     
==========================================
- Hits        43895    23944   -19951     
- Misses       4246     4745     +499     
+ Partials      702      692      -10
Flag Coverage Δ
#unittests 81.49% <87.22%> (?)
Impacted Files Coverage Δ
src/ImageSharp/Memory/BufferArea{T}.cs 97.05% <ø> (ø) ⬆️
src/ImageSharp/Formats/Gif/LzwEncoder.cs 98.19% <ø> (ø) ⬆️
src/ImageSharp/Metadata/ImageMetadata.cs 100% <ø> (ø)
src/ImageSharp/Formats/Jpeg/JpegConstants.cs 100% <ø> (ø) ⬆️
...ta/Profiles/ICC/DataReader/IccDataReader.Curves.cs 87.34% <ø> (ø)
...adata/Profiles/ICC/DataReader/IccDataReader.Lut.cs 96.07% <ø> (ø)
.../Metadata/Profiles/ICC/DataWriter/IccDataWriter.cs 83.01% <ø> (ø)
...files/ICC/DataReader/IccDataReader.TagDataEntry.cs 88.4% <ø> (ø)
...ta/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs 96.29% <ø> (ø)
...adata/Profiles/Exif/Values/ExifSignedShortArray.cs 0% <ø> (ø)
... and 1170 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7bbd84b...819b2fa. Read the comment docs.

@JimBobSquarePants
Copy link
Member

Ignore the codecov report here. The system is still trying to get on track and comparing to the old coverage calculations.

@JimBobSquarePants
Copy link
Member

@Sheyne Please accept my apologies for replying to you so late. This issue got swept to the side while we went through a massive code reorganization process.

Regarding your build issues. Your problem was due to the lack of submodules installed in the repository. I've updated the readme since you started to make it more clear how to get everything up and running.

Copy link
Collaborator

@brianpopow brianpopow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@JimBobSquarePants JimBobSquarePants merged commit 966dd46 into SixLabors:master Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants