Title: [207676] trunk/Source/WebCore
Revision
207676
Author
ddkil...@apple.com
Date
2016-10-21 09:14:06 -0700 (Fri, 21 Oct 2016)

Log Message

Bug 163757: Use IntSize::unclampedArea() in PDFDocumentImage::updateCachedImageIfNeeded()
<https://webkit.org/b/163757>

Reviewed by Brent Fulgham.

No new tests since there is no change in nominal behavior.

* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Use
IntSize::unclampedArea() where manual calculations were used
previously.  Also gets rid of more safeCast<size_t>() use.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207675 => 207676)


--- trunk/Source/WebCore/ChangeLog	2016-10-21 16:12:58 UTC (rev 207675)
+++ trunk/Source/WebCore/ChangeLog	2016-10-21 16:14:06 UTC (rev 207676)
@@ -1,3 +1,17 @@
+2016-10-21  David Kilzer  <ddkil...@apple.com>
+
+        Bug 163757: Use IntSize::unclampedArea() in PDFDocumentImage::updateCachedImageIfNeeded()
+        <https://webkit.org/b/163757>
+
+        Reviewed by Brent Fulgham.
+
+        No new tests since there is no change in nominal behavior.
+
+        * platform/graphics/cg/PDFDocumentImage.cpp:
+        (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Use
+        IntSize::unclampedArea() where manual calculations were used
+        previously.  Also gets rid of more safeCast<size_t>() use.
+
 2016-10-21  Chris Dumez  <cdu...@apple.com>
 
         [Web IDL] Support unions in our overload resolution algorithm

Modified: trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp (207675 => 207676)


--- trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp	2016-10-21 16:12:58 UTC (rev 207675)
+++ trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp	2016-10-21 16:14:06 UTC (rev 207676)
@@ -236,7 +236,7 @@
     // Cache the PDF image only if the size of the new image won't exceed the cache threshold.
     if (m_pdfImageCachingPolicy == PDFImageCachingBelowMemoryLimit) {
         IntSize scaledSize = ImageBuffer::compatibleBufferSize(cachedImageSize, context);
-        if (s_allDecodedDataSize + safeCast<size_t>(scaledSize.width()) * scaledSize.height() * 4 - m_cachedBytes > s_maxDecodedDataSize) {
+        if (s_allDecodedDataSize + scaledSize.unclampedArea() * 4 - m_cachedBytes > s_maxDecodedDataSize) {
             destroyDecodedData();
             return;
         }
@@ -260,7 +260,7 @@
     m_cachedSourceRect = srcRect;
 
     IntSize internalSize = m_cachedImageBuffer->internalSize();
-    decodedSizeChanged(safeCast<size_t>(internalSize.width()) * internalSize.height() * 4);
+    decodedSizeChanged(internalSize.unclampedArea() * 4);
 }
 
 void PDFDocumentImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator op, BlendMode, ImageOrientationDescription)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to