Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp

Issue 10787031: Revert 120033 - GeneratorGeneratedImage should cache images for the non-tiled case (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp
===================================================================
--- Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (revision 122782)
+++ Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (working copy)
@@ -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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698