WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-200498-20190820193054.patch (text/plain), 23.79 KB, created by
Fujii Hironori
on 2019-08-20 03:30:55 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2019-08-20 03:30:55 PDT
Size:
23.79 KB
patch
obsolete
>Subversion Revision: 248888 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 999012c272b83bf4b2172f2a95ee870d6f47bfa9..89a9df78e2f7d468f44028cb440b6bc7c492f9dc 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2019-08-20 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ Remove the dead code of ScalableImageDecoder for scaling >+ https://bugs.webkit.org/show_bug.cgi?id=200498 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No ports are using the down scaling feature of >+ ScalableImageDecoder now. Removed it. >+ >+ No behavior change. >+ >+ * platform/image-decoders/ScalableImageDecoder.cpp: >+ (WebCore::ScalableImageDecoder::prepareScaleDataIfNecessary): Deleted. >+ (WebCore::ScalableImageDecoder::upperBoundScaledX): Deleted. >+ (WebCore::ScalableImageDecoder::lowerBoundScaledX): Deleted. >+ (WebCore::ScalableImageDecoder::upperBoundScaledY): Deleted. >+ (WebCore::ScalableImageDecoder::lowerBoundScaledY): Deleted. >+ (WebCore::ScalableImageDecoder::scaledY): Deleted. >+ * platform/image-decoders/ScalableImageDecoder.h: >+ (WebCore::ScalableImageDecoder::scaledSize): Deleted. >+ * platform/image-decoders/gif/GIFImageDecoder.cpp: >+ (WebCore::GIFImageDecoder::setSize): >+ (WebCore::GIFImageDecoder::findFirstRequiredFrameToDecode): >+ (WebCore::GIFImageDecoder::haveDecodedRow): >+ (WebCore::GIFImageDecoder::frameComplete): >+ (WebCore::GIFImageDecoder::initFrameBuffer): >+ * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: >+ (WebCore::JPEGImageDecoder::outputScanlines): >+ (WebCore::JPEGImageDecoder::setSize): Deleted. >+ * platform/image-decoders/jpeg/JPEGImageDecoder.h: >+ * platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp: >+ (WebCore::JPEG2000ImageDecoder::decode): >+ * platform/image-decoders/png/PNGImageDecoder.cpp: >+ (WebCore::PNGImageDecoder::rowAvailable): >+ (WebCore::PNGImageDecoder::initFrameBuffer): >+ (WebCore::PNGImageDecoder::frameComplete): >+ (WebCore::PNGImageDecoder::setSize): Deleted. >+ * platform/image-decoders/png/PNGImageDecoder.h: >+ > 2019-08-19 Jer Noble <jer.noble@apple.com> > > [Cocoa] Fix misspelling of -preventsDisplaySleepForVideoPlayback >diff --git a/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp b/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp >index 0eaf86f8c5ae537271153d2b4df7e03ea7449792..26299b61e8004ef84cf1025c8eecea60cd1d1574 100644 >--- a/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp >+++ b/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp >@@ -153,47 +153,6 @@ RefPtr<ScalableImageDecoder> ScalableImageDecoder::create(SharedBuffer& data, Al > return nullptr; > } > >-namespace { >- >-enum MatchType { >- Exact, >- UpperBound, >- LowerBound >-}; >- >-inline void fillScaledValues(Vector<int>& scaledValues, double scaleRate, int length) >-{ >- double inflateRate = 1. / scaleRate; >- scaledValues.reserveCapacity(static_cast<int>(length * scaleRate + 0.5)); >- for (int scaledIndex = 0; ; ++scaledIndex) { >- int index = static_cast<int>(scaledIndex * inflateRate + 0.5); >- if (index >= length) >- break; >- scaledValues.append(index); >- } >-} >- >-template <MatchType type> int getScaledValue(const Vector<int>& scaledValues, int valueToMatch, int searchStart) >-{ >- if (scaledValues.isEmpty()) >- return valueToMatch; >- >- const int* dataStart = scaledValues.data(); >- const int* dataEnd = dataStart + scaledValues.size(); >- const int* matched = std::lower_bound(dataStart + searchStart, dataEnd, valueToMatch); >- switch (type) { >- case Exact: >- return matched != dataEnd && *matched == valueToMatch ? matched - dataStart : -1; >- case LowerBound: >- return matched != dataEnd && *matched == valueToMatch ? matched - dataStart : matched - dataStart - 1; >- case UpperBound: >- default: >- return matched != dataEnd ? matched - dataStart : -1; >- } >-} >- >-} >- > bool ScalableImageDecoder::frameIsCompleteAtIndex(size_t index) const > { > LockHolder lockHolder(m_mutex); >@@ -264,49 +223,6 @@ NativeImagePtr ScalableImageDecoder::createFrameImageAtIndex(size_t index, Subsa > return buffer->backingStore()->image(); > } > >-void ScalableImageDecoder::prepareScaleDataIfNecessary() >-{ >- m_scaled = false; >- m_scaledColumns.clear(); >- m_scaledRows.clear(); >- >- int width = size().width(); >- int height = size().height(); >- int numPixels = height * width; >- if (m_maxNumPixels <= 0 || numPixels <= m_maxNumPixels) >- return; >- >- m_scaled = true; >- double scale = sqrt(m_maxNumPixels / (double)numPixels); >- fillScaledValues(m_scaledColumns, scale, width); >- fillScaledValues(m_scaledRows, scale, height); >-} >- >-int ScalableImageDecoder::upperBoundScaledX(int origX, int searchStart) >-{ >- return getScaledValue<UpperBound>(m_scaledColumns, origX, searchStart); >-} >- >-int ScalableImageDecoder::lowerBoundScaledX(int origX, int searchStart) >-{ >- return getScaledValue<LowerBound>(m_scaledColumns, origX, searchStart); >-} >- >-int ScalableImageDecoder::upperBoundScaledY(int origY, int searchStart) >-{ >- return getScaledValue<UpperBound>(m_scaledRows, origY, searchStart); >-} >- >-int ScalableImageDecoder::lowerBoundScaledY(int origY, int searchStart) >-{ >- return getScaledValue<LowerBound>(m_scaledRows, origY, searchStart); >-} >- >-int ScalableImageDecoder::scaledY(int origY, int searchStart) >-{ >- return getScaledValue<Exact>(m_scaledRows, origY, searchStart); >-} >- > #if USE(DIRECT2D) > void ScalableImageDecoder::setTargetContext(ID2D1RenderTarget*) > { >diff --git a/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h b/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h >index 8890aaa3ed53b8a6fde344408f285812a82024d9..99729ba21c937c8e8b87af2ce485a091357f535f 100644 >--- a/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h >+++ b/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h >@@ -98,11 +98,6 @@ public: > > IntSize size() const override { return isSizeAvailable() ? m_size : IntSize(); } > >- IntSize scaledSize() >- { >- return m_scaled ? IntSize(m_scaledColumns.size(), m_scaledRows.size()) : size(); >- } >- > // This will only differ from size() for ICO (where each frame is a > // different icon) or other formats where different frames are different > // sizes. This does NOT differ from size() for GIF, since decoding GIFs >@@ -197,19 +192,9 @@ public: > Optional<IntPoint> hotSpot() const override { return WTF::nullopt; } > > protected: >- void prepareScaleDataIfNecessary(); >- int upperBoundScaledX(int origX, int searchStart = 0); >- int lowerBoundScaledX(int origX, int searchStart = 0); >- int upperBoundScaledY(int origY, int searchStart = 0); >- int lowerBoundScaledY(int origY, int searchStart = 0); >- int scaledY(int origY, int searchStart = 0); >- > RefPtr<SharedBuffer> m_data; // The encoded data. > Vector<ScalableImageDecoderFrame, 1> m_frameBufferCache; > mutable Lock m_mutex; >- bool m_scaled { false }; >- Vector<int> m_scaledColumns; >- Vector<int> m_scaledRows; > bool m_premultiplyAlpha; > bool m_ignoreGammaAndColorProfile; > ImageOrientation m_orientation; >@@ -224,12 +209,6 @@ private: > IntSize m_size; > EncodedDataStatus m_encodedDataStatus { EncodedDataStatus::TypeAvailable }; > bool m_decodingSizeFromSetData { false }; >- >- // FIXME: Evaluate the need for decoded data scaling. m_scaled, >- // m_scaledColumns and m_scaledRows are member variables that are >- // affected by this value, and are not used at all since the value >- // is negavite (see prepareScaleDataIfNecessary()). >- static const int m_maxNumPixels { -1 }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp b/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp >index 4f3487e33476405474cf86b5c606d2c1988c7cba..ecd9eee20febea129b3cc62205a86a5198d1a4c5 100644 >--- a/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp >+++ b/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp >@@ -53,11 +53,7 @@ bool GIFImageDecoder::setSize(const IntSize& size) > if (ScalableImageDecoder::encodedDataStatus() >= EncodedDataStatus::SizeAvailable && this->size() == size) > return true; > >- if (!ScalableImageDecoder::setSize(size)) >- return false; >- >- prepareScaleDataIfNecessary(); >- return true; >+ return ScalableImageDecoder::setSize(size); > } > > size_t GIFImageDecoder::frameCount() const >@@ -126,9 +122,6 @@ size_t GIFImageDecoder::findFirstRequiredFrameToDecode(size_t frameIndex) > const auto* frameContext = m_reader->frameContext(i - 1); > ASSERT(frameContext); > IntRect frameRect(frameContext->xOffset, frameContext->yOffset, frameContext->width, frameContext->height); >- // We would need to scale frameRect and check whether it fills the whole scaledSize(). But >- // can check whether the original frameRect fills size() instead. If the frame fills the >- // whole area then it can be decoded without dependencies. > if (frameRect.contains({ { }, size() })) > return i; > } >@@ -216,10 +209,10 @@ bool GIFImageDecoder::haveDecodedRow(unsigned frameIndex, const Vector<unsigned > // that width == (size().width() - frameContext->xOffset), so > // we must ensure we don't run off the end of either the source data or the > // row's X-coordinates. >- int xBegin = upperBoundScaledX(frameContext->xOffset); >- int yBegin = upperBoundScaledY(frameContext->yOffset + rowNumber); >- int xEnd = lowerBoundScaledX(std::min(static_cast<int>(frameContext->xOffset + width), size().width()) - 1, xBegin + 1) + 1; >- int yEnd = lowerBoundScaledY(std::min(static_cast<int>(frameContext->yOffset + rowNumber + repeatCount), size().height()) - 1, yBegin + 1) + 1; >+ int xBegin = frameContext->xOffset; >+ int yBegin = frameContext->yOffset + rowNumber; >+ int xEnd = std::min(static_cast<int>(frameContext->xOffset + width), size().width()); >+ int yEnd = std::min(static_cast<int>(frameContext->yOffset + rowNumber + repeatCount), size().height()); > if (rowBuffer.isEmpty() || (xBegin < 0) || (yBegin < 0) || (xEnd <= xBegin) || (yEnd <= yBegin)) > return true; > >@@ -244,7 +237,7 @@ bool GIFImageDecoder::haveDecodedRow(unsigned frameIndex, const Vector<unsigned > auto* currentAddress = buffer.backingStore()->pixelAt(xBegin, yBegin); > // Write one row's worth of data into the frame. > for (int x = xBegin; x < xEnd; ++x) { >- const unsigned char sourceValue = rowBuffer[(m_scaled ? m_scaledColumns[x] : x) - frameContext->xOffset]; >+ const unsigned char sourceValue = rowBuffer[x - frameContext->xOffset]; > if ((!frameContext->isTransparent || (sourceValue != frameContext->tpixel)) && (sourceValue < colorMapSize)) { > const size_t colorIndex = static_cast<size_t>(sourceValue) * 3; > buffer.backingStore()->setPixel(currentAddress, colorMap[colorIndex], colorMap[colorIndex + 1], colorMap[colorIndex + 2], 255); >@@ -287,7 +280,7 @@ bool GIFImageDecoder::frameComplete(unsigned frameIndex, unsigned frameDuration, > > // The whole frame was non-transparent, so it's possible that the entire > // resulting buffer was non-transparent, and we can setHasAlpha(false). >- if (rect.contains(IntRect(IntPoint(), scaledSize()))) >+ if (rect.contains(IntRect(IntPoint(), size()))) > buffer.setHasAlpha(false); > else if (frameIndex) { > // Tricky case. This frame does not have alpha only if everywhere >@@ -374,7 +367,7 @@ bool GIFImageDecoder::initFrameBuffer(unsigned frameIndex) > > if (!frameIndex) { > // This is the first frame, so we're not relying on any previous data. >- if (!buffer->initialize(scaledSize(), m_premultiplyAlpha)) >+ if (!buffer->initialize(size(), m_premultiplyAlpha)) > return setFailed(); > } else { > // The starting state for this frame depends on the previous frame's >@@ -402,8 +395,8 @@ bool GIFImageDecoder::initFrameBuffer(unsigned frameIndex) > // We want to clear the previous frame to transparent, without > // affecting pixels in the image outside of the frame. > IntRect prevRect = prevBuffer->backingStore()->frameRect(); >- const IntSize& bufferSize = scaledSize(); >- if (!frameIndex || prevRect.contains(IntRect(IntPoint(), scaledSize()))) { >+ const IntSize& bufferSize = size(); >+ if (!frameIndex || prevRect.contains(IntRect(IntPoint(), size()))) { > // Clearing the first frame, or a frame the size of the whole > // image, results in a completely empty image. > if (!buffer->initialize(bufferSize, m_premultiplyAlpha)) >@@ -424,11 +417,7 @@ bool GIFImageDecoder::initFrameBuffer(unsigned frameIndex) > if (frameRect.maxY() > size().height()) > frameRect.setHeight(size().height() - frameContext->yOffset); > >- int left = upperBoundScaledX(frameRect.x()); >- int right = lowerBoundScaledX(frameRect.maxX(), left); >- int top = upperBoundScaledY(frameRect.y()); >- int bottom = lowerBoundScaledY(frameRect.maxY(), top); >- buffer->backingStore()->setFrameRect(IntRect(left, top, right - left, bottom - top)); >+ buffer->backingStore()->setFrameRect(frameRect); > > // Update our status to be partially complete. > buffer->setDecodingStatus(DecodingStatus::Partial); >diff --git a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp >index 0c0549b5a3ee04af29ca7d606035fcfe61748526..77cdf917923196e94b601f680c553bd69bf22150 100644 >--- a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp >+++ b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp >@@ -502,15 +502,6 @@ JPEGImageDecoder::JPEGImageDecoder(AlphaOption alphaOption, GammaAndColorProfile > > JPEGImageDecoder::~JPEGImageDecoder() = default; > >-bool JPEGImageDecoder::setSize(const IntSize& size) >-{ >- if (!ScalableImageDecoder::setSize(size)) >- return false; >- >- prepareScaleDataIfNecessary(); >- return true; >-} >- > ScalableImageDecoderFrame* JPEGImageDecoder::frameBufferAtIndex(size_t index) > { > if (index) >@@ -556,12 +547,12 @@ void setPixel(ScalableImageDecoderFrame& buffer, uint32_t* currentAddress, JSAMP > } > } > >-template <J_COLOR_SPACE colorSpace, bool isScaled> >+template <J_COLOR_SPACE colorSpace> > bool JPEGImageDecoder::outputScanlines(ScalableImageDecoderFrame& buffer) > { > JSAMPARRAY samples = m_reader->samples(); > jpeg_decompress_struct* info = m_reader->info(); >- int width = isScaled ? m_scaledColumns.size() : info->output_width; >+ int width = info->output_width; > > while (info->output_scanline < info->output_height) { > // jpeg_read_scanlines will increase the scanline counter, so we >@@ -571,25 +562,18 @@ bool JPEGImageDecoder::outputScanlines(ScalableImageDecoderFrame& buffer) > if (jpeg_read_scanlines(info, samples, 1) != 1) > return false; > >- int destY = scaledY(sourceY); >- if (destY < 0) >+ if (sourceY < 0) > continue; > >- auto* currentAddress = buffer.backingStore()->pixelAt(0, destY); >+ auto* currentAddress = buffer.backingStore()->pixelAt(0, sourceY); > for (int x = 0; x < width; ++x) { >- setPixel<colorSpace>(buffer, currentAddress, samples, isScaled ? m_scaledColumns[x] : x); >+ setPixel<colorSpace>(buffer, currentAddress, samples, x); > ++currentAddress; > } > } > return true; > } > >-template <J_COLOR_SPACE colorSpace> >-bool JPEGImageDecoder::outputScanlines(ScalableImageDecoderFrame& buffer) >-{ >- return m_scaled ? outputScanlines<colorSpace, true>(buffer) : outputScanlines<colorSpace, false>(buffer); >-} >- > bool JPEGImageDecoder::outputScanlines() > { > if (m_frameBufferCache.isEmpty()) >@@ -598,7 +582,7 @@ bool JPEGImageDecoder::outputScanlines() > // Initialize the framebuffer if needed. > auto& buffer = m_frameBufferCache[0]; > if (buffer.isInvalid()) { >- if (!buffer.initialize(scaledSize(), m_premultiplyAlpha)) >+ if (!buffer.initialize(size(), m_premultiplyAlpha)) > return setFailed(); > buffer.setDecodingStatus(DecodingStatus::Partial); > // The buffer is transparent outside the decoded area while the image is >@@ -609,7 +593,7 @@ bool JPEGImageDecoder::outputScanlines() > jpeg_decompress_struct* info = m_reader->info(); > > #if defined(TURBO_JPEG_RGB_SWIZZLE) >- if (!m_scaled && turboSwizzled(info->out_color_space)) { >+ if (turboSwizzled(info->out_color_space)) { > while (info->output_scanline < info->output_height) { > unsigned char* row = reinterpret_cast<unsigned char*>(buffer.backingStore()->pixelAt(0, info->output_scanline)); > if (jpeg_read_scanlines(info, &row, 1) != 1) >@@ -620,7 +604,7 @@ bool JPEGImageDecoder::outputScanlines() > #endif > > switch (info->out_color_space) { >- // The code inside outputScanlines<int, bool> will be executed >+ // The code inside outputScanlines<int> will be executed > // for each pixel, so we want to avoid any extra comparisons there. > // That is why we use template and template specializations here so > // the proper code will be generated at compile time. >diff --git a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h >index 69521dcf7b086ba73b023cbe24299a8279f09d34..825226dd6b87644073d98d228cc0289ee4370e68 100644 >--- a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h >+++ b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h >@@ -52,19 +52,12 @@ namespace WebCore { > > // ScalableImageDecoder > String filenameExtension() const override { return "jpg"_s; } >- bool setSize(const IntSize&) override; > ScalableImageDecoderFrame* frameBufferAtIndex(size_t index) override; > // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid > // accessing deleted memory, especially when calling this from inside > // JPEGImageReader! > bool setFailed() override; > >- bool willDownSample() >- { >- ASSERT(ScalableImageDecoder::encodedDataStatus() >= EncodedDataStatus::SizeAvailable); >- return m_scaled; >- } >- > bool outputScanlines(); > void jpegComplete(); > >diff --git a/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp b/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp >index 35047e1d5d928d05f94ebd17bac7db3d635e0e4d..52631fb6d1423b4eff00a6b9ffe2c56165f4ca2f 100644 >--- a/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp >+++ b/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp >@@ -479,7 +479,7 @@ void JPEG2000ImageDecoder::decode(bool onlySize, bool allDataReceived) > } > > auto& buffer = m_frameBufferCache[0]; >- if (!buffer.initialize(scaledSize(), m_premultiplyAlpha)) { >+ if (!buffer.initialize(size(), m_premultiplyAlpha)) { > setFailed(); > return; > } >diff --git a/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp b/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp >index 62cb9b22a01f26e9f2cd41dea381b3636897ee42..e6259c12f14f956dfd43629cbf1a61074c8db198 100644 >--- a/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp >+++ b/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp >@@ -248,15 +248,6 @@ RepetitionCount PNGImageDecoder::repetitionCount() const > } > #endif > >-bool PNGImageDecoder::setSize(const IntSize& size) >-{ >- if (!ScalableImageDecoder::setSize(size)) >- return false; >- >- prepareScaleDataIfNecessary(); >- return true; >-} >- > ScalableImageDecoderFrame* PNGImageDecoder::frameBufferAtIndex(size_t index) > { > #if ENABLE(APNG) >@@ -435,7 +426,7 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, > auto& buffer = m_frameBufferCache[m_currentFrame]; > if (buffer.isInvalid()) { > png_structp png = m_reader->pngPtr(); >- if (!buffer.initialize(scaledSize(), m_premultiplyAlpha)) { >+ if (!buffer.initialize(size(), m_premultiplyAlpha)) { > longjmp(JMPBUF(png), 1); > return; > } >@@ -477,8 +468,7 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, > // make our lives easier. > if (!rowBuffer) > return; >- int y = !m_scaled ? rowIndex : scaledY(rowIndex); >- if (y < 0 || y >= scaledSize().height()) >+ if (rowIndex >= size().height()) > return; > > /* libpng comments (continued). >@@ -516,8 +506,8 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, > } > > // Write the decoded row pixels to the frame buffer. >- auto* address = buffer.backingStore()->pixelAt(0, y); >- int width = scaledSize().width(); >+ auto* address = buffer.backingStore()->pixelAt(0, rowIndex); >+ int width = size().width(); > unsigned char nonTrivialAlphaMask = 0; > > png_bytep pixel = row; >@@ -777,7 +767,7 @@ void PNGImageDecoder::initFrameBuffer(size_t frameIndex) > // We want to clear the previous frame to transparent, without > // affecting pixels in the image outside of the frame. > IntRect prevRect = prevBuffer->backingStore()->frameRect(); >- if (!frameIndex || prevRect.contains(IntRect(IntPoint(), scaledSize()))) { >+ if (!frameIndex || prevRect.contains(IntRect(IntPoint(), size()))) { > // Clearing the first frame, or a frame the size of the whole > // image, results in a completely empty image. > buffer.backingStore()->clear(); >@@ -801,11 +791,7 @@ void PNGImageDecoder::initFrameBuffer(size_t frameIndex) > if (frameRect.maxY() > size().height()) > frameRect.setHeight(size().height() - m_yOffset); > >- int left = upperBoundScaledX(frameRect.x()); >- int right = lowerBoundScaledX(frameRect.maxX(), left); >- int top = upperBoundScaledY(frameRect.y()); >- int bottom = lowerBoundScaledY(frameRect.maxY(), top); >- buffer.backingStore()->setFrameRect(IntRect(left, top, right - left, bottom - top)); >+ buffer.backingStore()->setFrameRect(frameRect); > } > > void PNGImageDecoder::frameComplete() >@@ -826,7 +812,6 @@ void PNGImageDecoder::frameComplete() > if (m_blend && !hasAlpha) > m_blend = 0; > >- ASSERT(!m_scaled); > png_bytep row = interlaceBuffer; > for (int y = rect.y(); y < rect.maxY(); ++y, row += colorChannels * size().width()) { > png_bytep pixel = row; >@@ -843,7 +828,7 @@ void PNGImageDecoder::frameComplete() > > if (!nonTrivialAlpha) { > IntRect rect = buffer.backingStore()->frameRect(); >- if (rect.contains(IntRect(IntPoint(), scaledSize()))) >+ if (rect.contains(IntRect(IntPoint(), size()))) > buffer.setHasAlpha(false); > else { > size_t frameIndex = m_currentFrame; >diff --git a/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h b/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h >index 85f705335e3161a193449606745326d56aefa0da..3fbea2d7f33d1d4214895dc3ccdf4f6130c15fa9 100644 >--- a/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h >+++ b/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h >@@ -50,7 +50,6 @@ namespace WebCore { > size_t frameCount() const override { return m_frameCount; } > RepetitionCount repetitionCount() const override; > #endif >- bool setSize(const IntSize&) override; > ScalableImageDecoderFrame* frameBufferAtIndex(size_t index) override; > // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid > // accessing deleted memory, especially when calling this from inside
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 200498
:
376761
|
376840
|
376967