blob: 8e18ed2964451150b88e495d354bcefec64ec84b [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=84ec12a36e50df5ac565cc7a75ffbe9f
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Draw_Looper_Methods, 256, 128, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void draw(SkCanvas* canvas) {
Mike Reedb7dad442019-07-22 14:51:10 -04007#ifdef SK_SUPPORT_LEGACY_DRAWLOOPER
Hal Canary87515122019-03-15 14:22:51 -04008 SkLayerDrawLooper::LayerInfo info;
9 info.fPaintBits = (SkLayerDrawLooper::BitFlags) SkLayerDrawLooper::kColorFilter_Bit;
10 info.fColorMode = SkBlendMode::kSrc;
11 SkLayerDrawLooper::Builder looperBuilder;
12 SkPaint* loopPaint = looperBuilder.addLayer(info);
13 loopPaint->setColor(SK_ColorRED);
14 info.fOffset.set(20, 20);
15 loopPaint = looperBuilder.addLayer(info);
16 loopPaint->setColor(SK_ColorBLUE);
17 SkPaint paint;
18 paint.setDrawLooper(looperBuilder.detach());
19 canvas->drawCircle(50, 50, 50, paint);
Mike Reedb7dad442019-07-22 14:51:10 -040020#endif
Hal Canary87515122019-03-15 14:22:51 -040021}
22} // END FIDDLE