| 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. |
| 3 |
#include "tools/fiddle/examples.h" |
| 4 |
REG_FIDDLE(Canvas_saveLayer_3, 256, 256, false, 3) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
canvas->drawImage(image, 0, 0); |
| 7 |
SkCanvas::SaveLayerRec rec; |
| 8 |
SkPaint paint; |
| 9 |
paint.setBlendMode(SkBlendMode::kPlus); |
| 10 |
rec.fSaveLayerFlags = SkCanvas::kInitWithPrevious_SaveLayerFlag; |
| 11 |
rec.fPaint = &paint; |
| 12 |
canvas->saveLayer(rec); |
| 13 |
paint.setBlendMode(SkBlendMode::kClear); |
| 14 |
canvas->drawCircle(128, 128, 96, paint); |
| 15 |
canvas->restore(); |
| 16 |
} |
| 17 |
} // END FIDDLE |