2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
10 #include "SkLerpXfermode.h"
12 static void show_circlelayers(SkCanvas* canvas, SkXfermode* mode) {
14 paint.setAntiAlias(true);
15 SkRect r, bounds = { 10, 10, 110, 110 };
18 r.fRight = bounds.centerX();
19 canvas->drawRect(r, paint);
21 canvas->saveLayer(&bounds, NULL);
23 paint.setColor(0x80FF0000);
26 canvas->drawOval(r, paint);
28 paint.setColor(0x800000FF);
31 paint.setXfermode(mode);
32 canvas->drawOval(r, paint);
37 class LerpXfermodeGM : public skiagm::GM {
42 virtual SkString onShortName() SK_OVERRIDE {
43 return SkString("lerpmode");
46 virtual SkISize onISize() SK_OVERRIDE {
47 return SkISize::Make(240, 120);
50 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
51 show_circlelayers(canvas, NULL);
52 canvas->translate(150, 0);
53 SkAutoTUnref<SkXfermode> mode(SkLerpXfermode::Create(0.5f));
54 show_circlelayers(canvas, mode.get());
58 typedef skiagm::GM INHERITED;
61 //////////////////////////////////////////////////////////////////////////////
63 DEF_GM( return SkNEW(LerpXfermodeGM); )