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

Unified Diff: Source/core/platform/graphics/GraphicsContextTest.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/GraphicsContextTest.cpp
diff --git a/Source/core/platform/graphics/GraphicsContextTest.cpp b/Source/core/platform/graphics/GraphicsContextTest.cpp
index b53f27864c45a9e7d4dddfb25c4cbee07426a91d..d745ebaa260853364dac1878ebc101cfc99df2e5 100644
--- a/Source/core/platform/graphics/GraphicsContextTest.cpp
+++ b/Source/core/platform/graphics/GraphicsContextTest.cpp
@@ -31,6 +31,7 @@
#include "core/platform/graphics/ImageBuffer.h"
#include "core/platform/graphics/skia/NativeImageSkia.h"
#include "platform/graphics/DisplayList.h"
+#include "platform/graphics/UnacceleratedImageBufferSurface.h"
#include "third_party/skia/include/core/SkBitmapDevice.h"
#include <gtest/gtest.h>
@@ -244,11 +245,12 @@ TEST(GraphicsContextTest, trackImageMask)
context.setCompositeOperation(CompositeDestinationIn);
context.beginTransparencyLayer(1);
- OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
- alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha);
+ OwnPtr<ImageBufferSurface> surface = adoptPtr(new UnacceleratedImageBufferSurface(IntSize(100, 100)));
+ ImageBuffer alphaImage(surface.release());
Stephen White 2013/12/04 21:18:40 Ooooh, ImageBuffer on the stack. *mindblown*
+ alphaImage.context()->fillRect(IntRect(0, 0, 100, 100), alpha);
context.setCompositeOperation(CompositeSourceOver);
- context.drawImageBuffer(alphaImage.get(), FloatRect(10, 10, 10, 10));
+ context.drawImageBuffer(&alphaImage, FloatRect(10, 10, 10, 10));
context.endLayer();
context.endLayer();
@@ -282,11 +284,12 @@ TEST(GraphicsContextTest, trackImageMaskWithOpaqueRect)
context.setCompositeOperation(CompositeDestinationIn);
context.beginTransparencyLayer(1);
- OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
- alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha);
+ OwnPtr<ImageBufferSurface> surface = adoptPtr(new UnacceleratedImageBufferSurface(IntSize(100, 100)));
+ ImageBuffer alphaImage(surface.release());
+ alphaImage.context()->fillRect(IntRect(0, 0, 100, 100), alpha);
context.setCompositeOperation(CompositeSourceOver);
- context.drawImageBuffer(alphaImage.get(), FloatRect(10, 10, 10, 10));
+ context.drawImageBuffer(&alphaImage, FloatRect(10, 10, 10, 10));
// We can't have an opaque mask actually, but we can pretend here like it would look if we did.
context.fillRect(FloatRect(12, 12, 3, 3), opaque, CompositeSourceOver);

Powered by Google App Engine
This is Rietveld 408576698