You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/06/15 16:23:07 UTC

[GitHub] [commons-imaging] arturobernalg opened a new pull request #154: Simplify conditions and avoid extra checks.

arturobernalg opened a new pull request #154:
URL: https://github.com/apache/commons-imaging/pull/154


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-imaging] arturobernalg commented on a change in pull request #154: Simplify conditions and avoid extra checks.

Posted by GitBox <gi...@apache.org>.
arturobernalg commented on a change in pull request #154:
URL: https://github.com/apache/commons-imaging/pull/154#discussion_r663093689



##########
File path: src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
##########
@@ -43,7 +43,7 @@ public boolean performNextMedianCut(final List<ColorGroup> colorGroups, final bo
                 && colorGroup.alphaDiff > colorGroup.redDiff
                 && colorGroup.alphaDiff > colorGroup.greenDiff
                 && colorGroup.alphaDiff > colorGroup.blueDiff) {
-            doCut(colorGroup, ColorComponent.ALPHA, colorGroups, ignoreAlpha);
+            doCut(colorGroup, ColorComponent.ALPHA, colorGroups, false);

Review comment:
       HI @kinow 
   Changed
   TY

##########
File path: src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
##########
@@ -447,7 +447,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map<Strin
             final PaletteFactory paletteFactory = new PaletteFactory();
 
             if (hasAlpha) {
-                palette = paletteFactory.makeQuantizedRgbaPalette(src, hasAlpha, maxColors);
+                palette = paletteFactory.makeQuantizedRgbaPalette(src, true, maxColors);

Review comment:
       HI @kinow 
   Changed
   TY




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-imaging] kinow merged pull request #154: Simplify conditions and avoid extra checks.

Posted by GitBox <gi...@apache.org>.
kinow merged pull request #154:
URL: https://github.com/apache/commons-imaging/pull/154


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-imaging] coveralls edited a comment on pull request #154: Simplify conditions and avoid extra checks.

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #154:
URL: https://github.com/apache/commons-imaging/pull/154#issuecomment-861661613


   
   [![Coverage Status](https://coveralls.io/builds/41087651/badge)](https://coveralls.io/builds/41087651)
   
   Coverage increased (+0.06%) to 76.725% when pulling **55f3020f476b996f0f83d4d8de42491b944418c3 on arturobernalg:feature/simplify** into **c030b47ff32652b273cc8e3e856ab7e3ff62682d on apache:master**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-imaging] kinow commented on a change in pull request #154: Simplify conditions and avoid extra checks.

Posted by GitBox <gi...@apache.org>.
kinow commented on a change in pull request #154:
URL: https://github.com/apache/commons-imaging/pull/154#discussion_r662987475



##########
File path: src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
##########
@@ -447,7 +447,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map<Strin
             final PaletteFactory paletteFactory = new PaletteFactory();
 
             if (hasAlpha) {
-                palette = paletteFactory.makeQuantizedRgbaPalette(src, hasAlpha, maxColors);
+                palette = paletteFactory.makeQuantizedRgbaPalette(src, true, maxColors);

Review comment:
       I think it's fine to pass `hasAlpha` here. Easier to see (or guess) that that's a flag for transparency, especially in case we add more booleans to that method later.

##########
File path: src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
##########
@@ -43,7 +43,7 @@ public boolean performNextMedianCut(final List<ColorGroup> colorGroups, final bo
                 && colorGroup.alphaDiff > colorGroup.redDiff
                 && colorGroup.alphaDiff > colorGroup.greenDiff
                 && colorGroup.alphaDiff > colorGroup.blueDiff) {
-            doCut(colorGroup, ColorComponent.ALPHA, colorGroups, ignoreAlpha);
+            doCut(colorGroup, ColorComponent.ALPHA, colorGroups, false);

Review comment:
       I think it was harmless to keep using `ignoreAlpha` here. There are other conditions in this if statement, and they are all using `ignoreAlpha`. Having that variable in all the conditions might make it easier to remove/update it later if necessary.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-imaging] kinow commented on pull request #154: Simplify conditions and avoid extra checks.

Posted by GitBox <gi...@apache.org>.
kinow commented on pull request #154:
URL: https://github.com/apache/commons-imaging/pull/154#issuecomment-873260494


   Thanks a lot for fixing it so quickly, and also for squashing commits @arturobernalg :+1: merged!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-imaging] coveralls commented on pull request #154: Simplify conditions and avoid extra checks.

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #154:
URL: https://github.com/apache/commons-imaging/pull/154#issuecomment-861661613


   
   [![Coverage Status](https://coveralls.io/builds/40605023/badge)](https://coveralls.io/builds/40605023)
   
   Coverage increased (+0.06%) to 76.725% when pulling **a1e712bbdc612003a0d1f6e9bb61be876a78f980 on arturobernalg:feature/simplify** into **471475c860a6106684ce33cbda96d20d03504c86 on apache:master**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org