skia2/docs/examples/Draw_Looper_Methods.cpp
Mike Reed b7dad44040 Reland "hide drawlooper from paint"
This reverts commit 6dc14ded91.

Reason for revert: add flag to google3

Original change's description:
> Revert "hide drawlooper from paint"
>
> This reverts commit 766b42b7ba.
>
> Reason for revert: afaict this is changing a lot of image filter GMs for the worse
>
> Original change's description:
> > hide drawlooper from paint
> >
> > Bug: skia: 4783
> >
> > Change-Id: I1d0ad1683a2e8345d8ea13db9b69b568ada827dc
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228573
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Mike Reed <reed@google.com>
>
> TBR=fmalita@chromium.org,reed@google.com
>
> Change-Id: I0bfd48ada3f8e48a774527caccf7abdb7a1cc470
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia: 4783
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229005
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=robertphillips@google.com,fmalita@chromium.org,reed@google.com

Change-Id: Ib3cd8941a63cd323b8872dd7fec1c953ab81cbdc
Bug: skia: 4783
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229010
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-07-22 20:03:36 +00:00

23 lines
887 B
C++

// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "tools/fiddle/examples.h"
// HASH=84ec12a36e50df5ac565cc7a75ffbe9f
REG_FIDDLE(Draw_Looper_Methods, 256, 128, false, 0) {
void draw(SkCanvas* canvas) {
#ifdef SK_SUPPORT_LEGACY_DRAWLOOPER
SkLayerDrawLooper::LayerInfo info;
info.fPaintBits = (SkLayerDrawLooper::BitFlags) SkLayerDrawLooper::kColorFilter_Bit;
info.fColorMode = SkBlendMode::kSrc;
SkLayerDrawLooper::Builder looperBuilder;
SkPaint* loopPaint = looperBuilder.addLayer(info);
loopPaint->setColor(SK_ColorRED);
info.fOffset.set(20, 20);
loopPaint = looperBuilder.addLayer(info);
loopPaint->setColor(SK_ColorBLUE);
SkPaint paint;
paint.setDrawLooper(looperBuilder.detach());
canvas->drawCircle(50, 50, 50, paint);
#endif
}
} // END FIDDLE