Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 1 | // 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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 3 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 4 | // HASH=84ec12a36e50df5ac565cc7a75ffbe9f |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 5 | REG_FIDDLE(Draw_Looper_Methods, 256, 128, false, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 6 | void draw(SkCanvas* canvas) { |
Mike Reed | b7dad44 | 2019-07-22 14:51:10 -0400 | [diff] [blame] | 7 | #ifdef SK_SUPPORT_LEGACY_DRAWLOOPER |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 8 | 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 Reed | b7dad44 | 2019-07-22 14:51:10 -0400 | [diff] [blame] | 20 | #endif |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 21 | } |
| 22 | } // END FIDDLE |