Commit b8b20f92 authored by mondrake's avatar mondrake
Browse files

Issue #3311668 by mondrake: Review @todos before cutting a D10 compatible release

parent 2428b3cc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ class DrawRectangle extends GDImageToolkitOperationBase {
    $success = TRUE;
    if ($arguments['fill_color']) {
      $color = $this->allocateColorFromRgba($arguments['fill_color']);
      // @todo cleanup once PHP 8.0 is the minimum supported.
      // @todo cleanup once once Drupal 9 is no longer  supported.
      if (PHP_VERSION_ID >= 80000) {
        $success = imagefilledpolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), $color);
      }
@@ -38,7 +38,7 @@ class DrawRectangle extends GDImageToolkitOperationBase {
    }
    if ($success && $arguments['border_color']) {
      $color = $this->allocateColorFromRgba($arguments['border_color']);
      // @todo cleanup once PHP 8.0 is the minimum supported.
      // @todo cleanup once once Drupal 9 is no longer  supported.
      if (PHP_VERSION_ID >= 80000) {
        $success = imagepolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), $color);
      }
+2 −1
Original line number Diff line number Diff line
@@ -124,7 +124,8 @@ trait GDOperationTrait {
      // @todo when #2583041 is committed, add a check for memory
      // availability before creating the resource.
      $cut = imagecreatetruecolor($src_w, $src_h);
      // @todo remove the is_resource check when PHP 8.0 is minimum version.
      // @todo remove the is_resource check once Drupal 9 is no longer
      // supported.
      if (!is_object($cut) && !is_resource($cut)) {
        return FALSE;
      }
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class GaussianBlur extends GDImageToolkitOperationBase {
   */
  protected function execute(array $arguments) {
    $blur = $this->imageCopyGaussianBlurred($this->getToolkit()->getResource(), $arguments['radius'], $arguments['sigma']);
    // @todo remove the is_resource check when PHP 8.0 is minimum version.
    // @todo remove the is_resource check once Drupal 9 is no longer  supported.
    if ((is_object($blur) && $blur instanceof \GdImage) || is_resource($blur)) {
      $original_resource = $this->getToolkit()->getResource();
      $this->getToolkit()->setResource($blur);
+0 −5
Original line number Diff line number Diff line
@@ -44,13 +44,8 @@ class Background extends ImagemagickImageToolkitOperationBase {
    $w = $arguments['background_image']->getToolkit()->getWidth();
    $h = $arguments['background_image']->getToolkit()->getHeight();
    // Reverse offset sign. Offset arguments require a sign in front.
    // @todo the minus before $arguments gives issues to PHPCS, either as is
    // or with a space in between the minus and the variable. See if later
    // sniffs fix that.
    // @codingStandardsIgnoreStart
    $x = $arguments['x_offset'] > 0 ? ('-' . $arguments['x_offset']) : ('+' . -$arguments['x_offset']);
    $y = $arguments['y_offset'] > 0 ? ('-' . $arguments['y_offset']) : ('+' . -$arguments['y_offset']);
    // @codingStandardsIgnoreEnd
    $op .= " -extent {$w}x{$h}{$x}{$y} ";

    // Add the background image.
+1 −2
Original line number Diff line number Diff line
@@ -99,12 +99,11 @@ class BackgroundTest extends ImageEffectsTestBase {
        ]);
        // The operation replaced the resource, check that the old one has
        // been destroyed.
        // @todo remove once Drupal 9 is no longer supported.
        if (PHP_VERSION_ID < 80000) {
          $new_res = $image->getToolkit()->getResource();
          $this->assertIsResource($new_res);
          $this->assertNotEquals($new_res, $old_res);
          // @todo In https://www.drupal.org/node/3133236 convert this to
          // $this->assertIsNotResource($old_res).
          $this->assertFalse(is_resource($old_res));
        }
        // Save image and compare against original, should differ.
Loading