Index: tests/DeferredCanvasTest.cpp |
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp |
index aa360be4010c7fea3edea10c0239a36f564e8a13..0af0c51fede0db8c98dbf063cdf2794a94b583ee 100644 |
--- a/tests/DeferredCanvasTest.cpp |
+++ b/tests/DeferredCanvasTest.cpp |
@@ -26,21 +26,6 @@ class GrContextFactory; |
static const int gWidth = 2; |
static const int gHeight = 2; |
-static void callWritePixels(SkCanvas* canvas, const SkBitmap& src, int x, int y, |
- SkCanvas::Config8888 config) { |
- SkBitmap bm(src); |
- bm.lockPixels(); |
- |
- SkImageInfo info = bm.info(); |
- sk_tool_utils::config8888_to_imagetypes(config, &info.fColorType, &info.fAlphaType); |
- |
- if (src.isOpaque()) { |
- info.fAlphaType = kOpaque_SkAlphaType; |
- } |
- |
- canvas->writePixels(info, bm.getPixels(), bm.rowBytes(), x, y); |
-} |
- |
static void create(SkBitmap* bm, SkColor color) { |
bm->allocN32Pixels(gWidth, gHeight); |
bm->eraseColor(color); |
@@ -122,7 +107,7 @@ static void TestDeferredCanvasWritePixelsToSurface(skiatest::Reporter* reporter) |
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface.get())); |
SkBitmap srcBitmap; |
- srcBitmap.allocN32Pixels(10, 10); |
+ srcBitmap.allocPixels(SkImageInfo::Make(10, 10, kRGBA_8888_SkColorType, kUnpremul_SkAlphaType)); |
srcBitmap.eraseColor(SK_ColorGREEN); |
// Tests below depend on this bitmap being recognized as opaque |
@@ -174,7 +159,7 @@ static void TestDeferredCanvasWritePixelsToSurface(skiatest::Reporter* reporter) |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
surface->clearCounts(); |
- callWritePixels(canvas, srcBitmap, 0, 0, SkCanvas::kRGBA_Unpremul_Config8888); |
+ canvas->writePixels(srcBitmap, 0, 0); |
REPORTER_ASSERT(reporter, 1 == surface->fDiscardCount); |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
@@ -191,7 +176,7 @@ static void TestDeferredCanvasWritePixelsToSurface(skiatest::Reporter* reporter) |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
surface->clearCounts(); |
- callWritePixels(canvas, srcBitmap, 5, 0, SkCanvas::kRGBA_Unpremul_Config8888); |
+ canvas->writePixels(srcBitmap, 5, 0); |
REPORTER_ASSERT(reporter, 0 == surface->fDiscardCount); |
REPORTER_ASSERT(reporter, 1 == surface->fRetainCount); |
@@ -213,7 +198,7 @@ static void TestDeferredCanvasWritePixelsToSurface(skiatest::Reporter* reporter) |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
surface->clearCounts(); |
- callWritePixels(canvas, srcBitmap, 0, 0, SkCanvas::kRGBA_Unpremul_Config8888); |
+ canvas->writePixels(srcBitmap, 0, 0); |
REPORTER_ASSERT(reporter, 1 == surface->fDiscardCount); |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
@@ -235,7 +220,7 @@ static void TestDeferredCanvasWritePixelsToSurface(skiatest::Reporter* reporter) |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
surface->clearCounts(); |
- callWritePixels(canvas, srcBitmap, 5, 0, SkCanvas::kRGBA_Unpremul_Config8888); |
+ canvas->writePixels(srcBitmap, 5, 0); |
REPORTER_ASSERT(reporter, 1 == surface->fDiscardCount); // because of the clear |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
@@ -259,7 +244,7 @@ static void TestDeferredCanvasWritePixelsToSurface(skiatest::Reporter* reporter) |
REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
surface->clearCounts(); |
- callWritePixels(canvas, srcBitmap, 5, 0, SkCanvas::kRGBA_Unpremul_Config8888); |
+ canvas->writePixels(srcBitmap, 5, 0); |
REPORTER_ASSERT(reporter, 0 == surface->fDiscardCount); |
REPORTER_ASSERT(reporter, 1 == surface->fRetainCount); |