Changeset 225091 in webkit


Ignore:
Timestamp:
Nov 21, 2017 10:54:50 PM (6 years ago)
Author:
zandobersek@gmail.com
Message:

Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
https://bugs.webkit.org/show_bug.cgi?id=179921

Reviewed by Carlos Garcia Campos.

.:

  • Source/cmake/WebKitFeatures.cmake: Remove the CMake option that

enabled IMAGE_DECODER_DOWN_SAMPLING code.

Source/WebCore:

Drop the ENABLE_IMAGE_DECODER_DOWN_SAMPLING code, along with the build
guard definitions in WTF and CMake.

This was apparently in use in the Qt port, but since then no port
enables this. It's not exposed in the Xcode build, and the CMake option
is disabled by default, with no way to enable it through build-webkit.

While the code guarded with this build guard is removed, there's still
code in the ScalableImageDecoder class that only operated when this
feature was enabled. This should be addressed in the future, after
evaluating the need for this scaling capability.

No new tests -- no change in behavior.

  • platform/graphics/Image.cpp:

(WebCore::Image::adjustSourceRectForDownSampling const): Deleted.

  • platform/graphics/Image.h:
  • platform/graphics/cairo/CairoOperations.cpp:

(WebCore::Cairo::drawNativeImage):

  • platform/image-decoders/ScalableImageDecoder.h:
  • platform/image-decoders/jpeg/JPEGImageDecoder.cpp:

(WebCore::JPEGImageReader::decode):

  • platform/image-decoders/png/PNGImageDecoder.cpp:

(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::PNGImageDecoder::frameComplete):

Source/WTF:

  • wtf/FeatureDefines.h: Remove the ENABLE_IMAGE_DECODER_DOWN_SAMPLING

definition.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r225066 r225091  
     12017-11-21  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
     4        https://bugs.webkit.org/show_bug.cgi?id=179921
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        * Source/cmake/WebKitFeatures.cmake: Remove the CMake option that
     9        enabled IMAGE_DECODER_DOWN_SAMPLING code.
     10
    1112017-11-20  Carlos Garcia Campos  <cgarcia@igalia.com>
    212
  • trunk/Source/WTF/ChangeLog

    r225042 r225091  
     12017-11-21  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
     4        https://bugs.webkit.org/show_bug.cgi?id=179921
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        * wtf/FeatureDefines.h: Remove the ENABLE_IMAGE_DECODER_DOWN_SAMPLING
     9        definition.
     10
    1112017-11-19  Tim Horton  <timothy_horton@apple.com>
    212
  • trunk/Source/WTF/wtf/FeatureDefines.h

    r225042 r225091  
    421421#endif
    422422
    423 #if !defined(ENABLE_IMAGE_DECODER_DOWN_SAMPLING)
    424 #define ENABLE_IMAGE_DECODER_DOWN_SAMPLING 0
    425 #endif
    426 
    427423#if !defined(ENABLE_INDEXED_DATABASE)
    428424#define ENABLE_INDEXED_DATABASE 0
  • trunk/Source/WebCore/ChangeLog

    r225090 r225091  
     12017-11-21  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
     4        https://bugs.webkit.org/show_bug.cgi?id=179921
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Drop the ENABLE_IMAGE_DECODER_DOWN_SAMPLING code, along with the build
     9        guard definitions in WTF and CMake.
     10
     11        This was apparently in use in the Qt port, but since then no port
     12        enables this. It's not exposed in the Xcode build, and the CMake option
     13        is disabled by default, with no way to enable it through build-webkit.
     14
     15        While the code guarded with this build guard is removed, there's still
     16        code in the ScalableImageDecoder class that only operated when this
     17        feature was enabled. This should be addressed in the future, after
     18        evaluating the need for this scaling capability.
     19
     20        No new tests -- no change in behavior.
     21
     22        * platform/graphics/Image.cpp:
     23        (WebCore::Image::adjustSourceRectForDownSampling const): Deleted.
     24        * platform/graphics/Image.h:
     25        * platform/graphics/cairo/CairoOperations.cpp:
     26        (WebCore::Cairo::drawNativeImage):
     27        * platform/image-decoders/ScalableImageDecoder.h:
     28        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
     29        (WebCore::JPEGImageReader::decode):
     30        * platform/image-decoders/png/PNGImageDecoder.cpp:
     31        (WebCore::PNGImageDecoder::rowAvailable):
     32        (WebCore::PNGImageDecoder::frameComplete):
     33
    1342017-11-21  Commit Queue  <commit-queue@webkit.org>
    235
  • trunk/Source/WebCore/platform/graphics/Image.cpp

    r224731 r225091  
    302302}
    303303
    304 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
    305 FloatRect Image::adjustSourceRectForDownSampling(const FloatRect& srcRect, const IntSize& scaledSize) const
    306 {
    307     const FloatSize unscaledSize = size();
    308     if (unscaledSize == scaledSize)
    309         return srcRect;
    310 
    311     // Image has been down-sampled.
    312     float xscale = static_cast<float>(scaledSize.width()) / unscaledSize.width();
    313     float yscale = static_cast<float>(scaledSize.height()) / unscaledSize.height();
    314     FloatRect scaledSrcRect = srcRect;
    315     scaledSrcRect.scale(xscale, yscale);
    316 
    317     return scaledSrcRect;
    318 }
    319 #endif
    320 
    321304void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
    322305{
  • trunk/Source/WebCore/platform/graphics/Image.h

    r222246 r225091  
    177177        const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal);
    178178
    179 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
    180     FloatRect adjustSourceRectForDownSampling(const FloatRect& srcRect, const IntSize& scaledSize) const;
    181 #endif
    182 
    183179#if !ASSERT_DISABLED
    184180    virtual bool notSolidColor() { return true; }
  • trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp

    r225077 r225091  
    657657        Cairo::State::setCompositeOperation(platformContext, compositeOperator, blendMode);
    658658
    659 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
    660     IntSize scaledSize = nativeImageSize(surface);
    661     FloatRect src = adjustSourceRectForDownSampling(srcRect, scaledSize);
    662 #else
    663     FloatRect src(srcRect);
    664 #endif
    665 
    666659    FloatRect dst = destRect;
    667 
    668660    if (orientation != DefaultImageOrientation) {
    669661        // ImageOrientation expects the origin to be at (0, 0).
     
    678670    }
    679671
    680     platformContext.drawSurfaceToContext(surface, dst, src, targetContext);
     672    platformContext.drawSurfaceToContext(surface, dst, srcRect, targetContext);
    681673    platformContext.restore();
    682674}
  • trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h

    r223968 r225091  
    4343// ScalableImageDecoder is a base for all format-specific decoders
    4444// (e.g. JPEGImageDecoder). This base manages the ImageFrame cache.
    45 //
    46 // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to downsample
    47 // at decode time. Image decoders will downsample any images larger than
    48 // |m_maxNumPixels|. FIXME: Not yet supported by all decoders.
     45
    4946class ScalableImageDecoder : public ImageDecoder {
    5047    WTF_MAKE_NONCOPYABLE(ScalableImageDecoder); WTF_MAKE_FAST_ALLOCATED;
     
    222219    EncodedDataStatus m_encodedDataStatus { EncodedDataStatus::TypeAvailable };
    223220    bool m_decodingSizeFromSetData { false };
    224 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
    225     static const int m_maxNumPixels { 1024 * 1024 };
    226 #else
     221
     222    // FIXME: Evaluate the need for decoded data scaling. m_scaled,
     223    // m_scaledColumns and m_scaledRows are member variables that are
     224    // affected by this value, and are not used at all since the value
     225    // is negavite (see prepareScaleDataIfNecessary()).
    227226    static const int m_maxNumPixels { -1 };
    228 #endif
    229227};
    230228
  • trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

    r223728 r225091  
    328328            m_decoder->setOrientation(readImageOrientation(info()));
    329329
    330 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) && defined(TURBO_JPEG_RGB_SWIZZLE)
    331             // There's no point swizzle decoding if image down sampling will
    332             // be applied. Revert to using JSC_RGB in that case.
    333             if (m_decoder->willDownSample() && turboSwizzled(m_info.out_color_space))
    334                 m_info.out_color_space = JCS_RGB;
    335 #endif
    336330            // Don't allocate a giant and superfluous memory buffer when the
    337331            // image is a sequential JPEG.
  • trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp

    r223728 r225091  
    518518    unsigned char nonTrivialAlphaMask = 0;
    519519
    520 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
    521     if (m_scaled) {
    522         for (int x = 0; x < width; ++x, ++address) {
    523             png_bytep pixel = row + m_scaledColumns[x] * colorChannels;
    524             unsigned alpha = hasAlpha ? pixel[3] : 255;
     520    png_bytep pixel = row;
     521    if (hasAlpha) {
     522        for (int x = 0; x < width; ++x, pixel += 4, ++address) {
     523            unsigned alpha = pixel[3];
    525524            buffer.backingStore()->setPixel(address, pixel[0], pixel[1], pixel[2], alpha);
    526525            nonTrivialAlphaMask |= (255 - alpha);
    527526        }
    528     } else
    529 #endif
    530     {
    531         png_bytep pixel = row;
    532         if (hasAlpha) {
    533             for (int x = 0; x < width; ++x, pixel += 4, ++address) {
    534                 unsigned alpha = pixel[3];
    535                 buffer.backingStore()->setPixel(address, pixel[0], pixel[1], pixel[2], alpha);
    536                 nonTrivialAlphaMask |= (255 - alpha);
    537             }
    538         } else {
    539             for (int x = 0; x < width; ++x, pixel += 3, ++address)
    540                 *address = makeRGB(pixel[0], pixel[1], pixel[2]);
    541         }
     527    } else {
     528        for (int x = 0; x < width; ++x, pixel += 3, ++address)
     529            *address = makeRGB(pixel[0], pixel[1], pixel[2]);
    542530    }
    543531
     
    836824            m_blend = 0;
    837825
    838 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
    839         for (int y = 0; y < rect.maxY() - rect.y(); ++y) {
    840             png_bytep row = interlaceBuffer + (m_scaled ? m_scaledRows[y] : y) * colorChannels * size().width();
    841             RGBA32* address = buffer.backingStore()->pixelAt(rect.x(), y + rect.y());
    842             for (int x = 0; x < rect.maxX() - rect.x(); ++x) {
    843                 png_bytep pixel = row + (m_scaled ? m_scaledColumns[x] : x) * colorChannels;
    844                 unsigned alpha = hasAlpha ? pixel[3] : 255;
    845                 nonTrivialAlpha |= alpha < 255;
    846                 if (!m_blend)
    847                     buffer.backingStore()->setPixel(address++, pixel[0], pixel[1], pixel[2], alpha);
    848                 else
    849                     buffer.backingStore()->blendPixel(address++, pixel[0], pixel[1], pixel[2], alpha);
    850             }
    851         }
    852 #else
    853826        ASSERT(!m_scaled);
    854827        png_bytep row = interlaceBuffer;
     
    865838            }
    866839        }
    867 #endif
    868840
    869841        if (!nonTrivialAlpha) {
  • trunk/Source/cmake/WebKitFeatures.cmake

    r225050 r225091  
    113113    WEBKIT_OPTION_DEFINE(ENABLE_GEOLOCATION "Toggle Geolocation support" PRIVATE OFF)
    114114    WEBKIT_OPTION_DEFINE(ENABLE_ICONDATABASE "Toggle Icon database support" PRIVATE ON)
    115     WEBKIT_OPTION_DEFINE(ENABLE_IMAGE_DECODER_DOWN_SAMPLING "Toggle image decoder down sampling support" PRIVATE OFF)
    116115    WEBKIT_OPTION_DEFINE(ENABLE_INDEXED_DATABASE "Toggle Indexed Database API support" PRIVATE OFF)
    117116    WEBKIT_OPTION_DEFINE(ENABLE_INDEXED_DATABASE_IN_WORKERS "Toggle support for indexed database in workers" PRIVATE OFF)
Note: See TracChangeset for help on using the changeset viewer.