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

Unified Diff: tests/LayerDrawLooperTest.cpp

Issue 133813005: Builder class for SkLayerDrawLooper. (Closed) Base URL: https://skia.googlesource.com/skia.git@draw_looper_context
Patch Set: Implement own CreateProc & remove SkLayerDrawLooper(SkReadBuffer&). Created 6 years, 10 months 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 | « src/effects/SkLayerDrawLooper.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/LayerDrawLooperTest.cpp
diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp
index a1319a50def8377428edf35713ea88b5c965c2e0..8f8a6b6eb0bb13a566c221bdbe658880b2f86552 100644
--- a/tests/LayerDrawLooperTest.cpp
+++ b/tests/LayerDrawLooperTest.cpp
@@ -35,21 +35,22 @@ private:
};
static void test_frontToBack(skiatest::Reporter* reporter) {
- SkAutoTUnref<SkLayerDrawLooper> looper(SkNEW(SkLayerDrawLooper));
+ SkLayerDrawLooper::Builder looperBuilder;
SkLayerDrawLooper::LayerInfo layerInfo;
// Add the front layer, with the defaults.
- (void)looper->addLayer(layerInfo);
+ (void)looperBuilder.addLayer(layerInfo);
// Add the back layer, with some layer info set.
layerInfo.fOffset.set(10.0f, 20.0f);
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
- SkPaint* layerPaint = looper->addLayer(layerInfo);
+ SkPaint* layerPaint = looperBuilder.addLayer(layerInfo);
layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
FakeDevice device;
SkCanvas canvas(&device);
SkPaint paint;
+ SkAutoTUnref<SkLayerDrawLooper> looper(looperBuilder.detachLooper());
looper->init(&canvas);
// The back layer should come first.
@@ -72,21 +73,22 @@ static void test_frontToBack(skiatest::Reporter* reporter) {
}
static void test_backToFront(skiatest::Reporter* reporter) {
- SkAutoTUnref<SkLayerDrawLooper> looper(SkNEW(SkLayerDrawLooper));
+ SkLayerDrawLooper::Builder looperBuilder;
SkLayerDrawLooper::LayerInfo layerInfo;
// Add the back layer, with the defaults.
- (void)looper->addLayerOnTop(layerInfo);
+ (void)looperBuilder.addLayerOnTop(layerInfo);
// Add the front layer, with some layer info set.
layerInfo.fOffset.set(10.0f, 20.0f);
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
- SkPaint* layerPaint = looper->addLayerOnTop(layerInfo);
+ SkPaint* layerPaint = looperBuilder.addLayerOnTop(layerInfo);
layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
FakeDevice device;
SkCanvas canvas(&device);
SkPaint paint;
+ SkAutoTUnref<SkLayerDrawLooper> looper(looperBuilder.detachLooper());
looper->init(&canvas);
// The back layer should come first.
@@ -109,21 +111,22 @@ static void test_backToFront(skiatest::Reporter* reporter) {
}
static void test_mixed(skiatest::Reporter* reporter) {
- SkAutoTUnref<SkLayerDrawLooper> looper(SkNEW(SkLayerDrawLooper));
+ SkLayerDrawLooper::Builder looperBuilder;
SkLayerDrawLooper::LayerInfo layerInfo;
// Add the back layer, with the defaults.
- (void)looper->addLayer(layerInfo);
+ (void)looperBuilder.addLayer(layerInfo);
// Add the front layer, with some layer info set.
layerInfo.fOffset.set(10.0f, 20.0f);
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
- SkPaint* layerPaint = looper->addLayerOnTop(layerInfo);
+ SkPaint* layerPaint = looperBuilder.addLayerOnTop(layerInfo);
layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
FakeDevice device;
SkCanvas canvas(&device);
SkPaint paint;
+ SkAutoTUnref<SkLayerDrawLooper> looper(looperBuilder.detachLooper());
looper->init(&canvas);
// The back layer should come first.
« no previous file with comments | « src/effects/SkLayerDrawLooper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698