RFR: 8293478: [java.desktop/macOS] Condense SDRenderType usages in QuartzRenderer.m

SWinxy duke at openjdk.org
Wed Sep 7 18:51:39 UTC 2022


The `SDRenderType` enum is often returned using a variable declared at the start of functions. These can be inlined in the `return` itself. Using a ternary operator condenses what may be 12 lines into one, in the most extreme cases. `doRectUsingCG` and `doPolyUsingCG` were both modified more than the rest, but still are equivalent.

Example change:

SDRenderType renderType = SD_Nothing;

if (fill == YES)
{
    renderType = SD_Fill;
}
else
{
    renderType = SD_Stroke;
}

// ...

return renderType;



// ...

return fill ? SD_Fill : SD_Stroke;

-------------

Commit messages:
 - Inline SDRenderType in QuartzRenderer.m

Changes: https://git.openjdk.org/jdk/pull/10174/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10174&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8293478
  Stats: 125 lines in 1 file changed: 17 ins; 68 del; 40 mod
  Patch: https://git.openjdk.org/jdk/pull/10174.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10174/head:pull/10174

PR: https://git.openjdk.org/jdk/pull/10174



More information about the client-libs-dev mailing list