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

Unified Diff: Source/core/rendering/shapes/Shape.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/rendering/shapes/Shape.cpp
diff --git a/Source/core/rendering/shapes/Shape.cpp b/Source/core/rendering/shapes/Shape.cpp
index 7fcb1d13f014b58af8e1f8fadd58ec5a8b1b1937..a6415e01846e8f18b3629168e2414b8b5e04fc61 100644
--- a/Source/core/rendering/shapes/Shape.cpp
+++ b/Source/core/rendering/shapes/Shape.cpp
@@ -37,6 +37,7 @@
#include "core/rendering/shapes/RectangleShape.h"
#include "platform/LengthFunctions.h"
#include "platform/geometry/FloatSize.h"
+#include "platform/graphics/UnacceleratedImageBufferSurface.h"
#include "platform/graphics/WindRule.h"
#include "wtf/MathExtras.h"
#include "wtf/OwnPtr.h"
@@ -210,15 +211,14 @@ PassOwnPtr<Shape> Shape::createShape(const StyleImage* styleImage, float thresho
Image* image = styleImage->cachedImage()->image();
const IntSize& imageSize = image->size();
- OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageSize);
-
OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(imageSize.height()));
-
- if (imageBuffer) {
- GraphicsContext* graphicsContext = imageBuffer->context();
+ OwnPtr<ImageBufferSurface> surface = adoptPtr(new UnacceleratedImageBufferSurface(imageSize));
+ if (surface->isValid()) {
+ ImageBuffer imageBuffer(surface.release());
+ GraphicsContext* graphicsContext = imageBuffer.context();
graphicsContext->drawImage(image, IntPoint());
- RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImageData(IntRect(IntPoint(), imageSize));
+ RefPtr<Uint8ClampedArray> pixelArray = imageBuffer.getUnmultipliedImageData(IntRect(IntPoint(), imageSize));
unsigned pixelArrayLength = pixelArray->length();
unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA.
uint8_t alphaPixelThreshold = threshold * 255;

Powered by Google App Engine
This is Rietveld 408576698