Title: [122784] branches/chromium/1180/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp
Revision
122784
Author
[email protected]
Date
2012-07-16 17:44:05 -0700 (Mon, 16 Jul 2012)

Log Message

Revert 120033 - GeneratorGeneratedImage should cache images for the non-tiled case
https://bugs.webkit.org/show_bug.cgi?id=87094

Patch by Jin Yang <[email protected]> on 2012-06-11
Reviewed by Simon Fraser.

Source/WebCore:

We cache the generated image if generator is not changed. By compared
with generating image on the fly, it will lose a little pixel precision
and several layout tests should be rebaselined. With this patch, the IE test
drive benchmark "Bayou" can gain about 50%.

No new tests. Performance optimization.

* platform/graphics/GeneratorGeneratedImage.cpp:
(WebCore::GeneratorGeneratedImage::draw):

LayoutTests:

Update expectations: added failures for baselines to come.

* platform/chromium/TestExpectations:

[email protected]
Review URL: https://chromiumcodereview.appspot.com/10787031

Modified Paths

Diff

Modified: branches/chromium/1180/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (122783 => 122784)


--- branches/chromium/1180/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp	2012-07-17 00:43:21 UTC (rev 122783)
+++ branches/chromium/1180/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp	2012-07-17 00:44:05 UTC (rev 122784)
@@ -32,25 +32,16 @@
 
 namespace WebCore {
 
-void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp)
+void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
 {
-    unsigned generatorHash = m_generator->hash();
-    if (!m_cachedImageBuffer || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != m_size || !destContext->isCompatibleWithBuffer(m_cachedImageBuffer.get())) {
-        // Create a BitmapImage and call draw on it.
-        m_cachedImageBuffer = destContext->createCompatibleBuffer(m_size);
-        if (!m_cachedImageBuffer)
-            return;
-
-        // Fill with the generated image.
-        m_cachedImageBuffer->context()->fillRect(FloatRect(FloatPoint(), m_size), *m_generator);
-
-        m_cachedGeneratorHash = generatorHash;
-        m_cachedAdjustedSize = m_size;
-    }
-
-    // Draw the image buffer to the destination
-    m_cachedImageBuffer->draw(destContext, styleColorSpace, destRect, srcRect, compositeOp);
-    m_cacheTimer.restart();
+    GraphicsContextStateSaver stateSaver(*destContext);
+    destContext->setCompositeOperation(compositeOp);
+    destContext->clip(destRect);
+    destContext->translate(destRect.x(), destRect.y());
+    if (destRect.size() != srcRect.size())
+        destContext->scale(FloatSize(destRect.width() / srcRect.width(), destRect.height() / srcRect.height()));
+    destContext->translate(-srcRect.x(), -srcRect.y());
+    destContext->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get());
 }
 
 void GeneratorGeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to