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

Unified Diff: Source/core/platform/graphics/filters/FETile.cpp

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fixes for win+mac Created 7 years 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
Index: Source/core/platform/graphics/filters/FETile.cpp
diff --git a/Source/core/platform/graphics/filters/FETile.cpp b/Source/core/platform/graphics/filters/FETile.cpp
index 44d9b749283aed242bbf21a1d767710743d7e97b..5140847c2c800cdb850eeb6a566c20fc50078f43 100644
--- a/Source/core/platform/graphics/filters/FETile.cpp
+++ b/Source/core/platform/graphics/filters/FETile.cpp
@@ -29,6 +29,8 @@
#include "core/platform/graphics/GraphicsContext.h"
#include "core/platform/graphics/Pattern.h"
#include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
+#include "core/platform/graphics/gpu/AcceleratedImageBufferSurface.h"
+#include "platform/graphics/UnacceleratedImageBufferSurface.h"
#include "platform/text/TextStream.h"
#include "platform/transforms/AffineTransform.h"
#include "third_party/skia/include/core/SkDevice.h"
@@ -66,15 +68,24 @@ void FETile::applySoftware()
tileRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
}
- OwnPtr<ImageBuffer> tileImage = ImageBuffer::createBufferForTile(tileRect.size(), tileRect.size(), filter()->renderingMode());
- if (!tileImage)
+ OwnPtr<ImageBufferSurface> surface;
+ IntSize intTileSize = roundedIntSize(tileRect.size());
+ if (filter()->isAccelerated()) {
+ surface = adoptPtr(new AcceleratedImageBufferSurface(intTileSize));
+ }
+ if (!surface || !surface->isValid()) {
+ surface = adoptPtr(new UnacceleratedImageBufferSurface(intTileSize));
+ }
+ if (!surface->isValid())
return;
+ ImageBuffer tileImage(surface.release());
- GraphicsContext* tileImageContext = tileImage->context();
+ GraphicsContext* tileImageContext = tileImage.context();
+ tileImageContext->scale(FloatSize(intTileSize.width() / tileRect.width(), intTileSize.height() / tileRect.height()));
tileImageContext->translate(-inMaxEffectLocation.x(), -inMaxEffectLocation.y());
tileImageContext->drawImageBuffer(in->asImageBuffer(), in->absolutePaintRect().location());
- RefPtr<Pattern> pattern = Pattern::create(tileImage->copyImage(CopyBackingStore), true, true);
+ RefPtr<Pattern> pattern = Pattern::create(tileImage.copyImage(CopyBackingStore), true, true);
AffineTransform patternTransform;
patternTransform.translate(inMaxEffectLocation.x() - maxEffectLocation.x(), inMaxEffectLocation.y() - maxEffectLocation.y());

Powered by Google App Engine
This is Rietveld 408576698