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

Unified Diff: Source/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: rebase mayhem 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
« no previous file with comments | « Source/platform/graphics/filters/FELighting.cpp ('k') | Source/platform/graphics/filters/FETurbulence.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/filters/FETile.cpp
diff --git a/Source/platform/graphics/filters/FETile.cpp b/Source/platform/graphics/filters/FETile.cpp
index ad838e127d1e333cb747059f20271171f024979e..2e865d3141fd84f7e9cbea58cc6a04813b641ecd 100644
--- a/Source/platform/graphics/filters/FETile.cpp
+++ b/Source/platform/graphics/filters/FETile.cpp
@@ -27,7 +27,9 @@
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/Pattern.h"
+#include "platform/graphics/UnacceleratedImageBufferSurface.h"
#include "platform/graphics/filters/SkiaImageFilterBuilder.h"
+#include "platform/graphics/gpu/AcceleratedImageBufferSurface.h"
#include "platform/text/TextStream.h"
#include "platform/transforms/AffineTransform.h"
#include "third_party/skia/include/core/SkDevice.h"
@@ -65,11 +67,20 @@ void FETile::applySoftware()
tileRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
}
- OwnPtr<ImageBuffer> tileImage = ImageBuffer::createBufferForTile(tileRect.size(), tileRect.size(), filter()->renderingMode());
+ 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));
+ }
+ OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(surface.release());
if (!tileImage)
return;
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());
« no previous file with comments | « Source/platform/graphics/filters/FELighting.cpp ('k') | Source/platform/graphics/filters/FETurbulence.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698