skia2/samplecode/Sample2PtRadial.cpp
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

47 lines
1.3 KiB
C++

/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/core/SkCanvas.h"
#include "include/effects/SkGradientShader.h"
#include "samplecode/Sample.h"
class TwoPtConicalView : public Sample {
public:
TwoPtConicalView() {}
protected:
virtual bool onQuery(Sample::Event* evt) {
if (Sample::TitleQ(*evt)) {
Sample::TitleR(evt, "2PtConical");
return true;
}
return this->INHERITED::onQuery(evt);
}
virtual void onDrawContent(SkCanvas* canvas) {
canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
SkPoint c0 = { 0, 0 };
SkScalar r0 = 100;
SkPoint c1 = { 100, 100 };
SkScalar r1 = 100;
SkPaint paint;
paint.setShader(SkGradientShader::MakeTwoPointConical(c0, r0, c1, r1, colors,
nullptr, 2,
SkTileMode::kClamp));
canvas->drawPaint(paint);
}
private:
typedef Sample INHERITED;
};
//////////////////////////////////////////////////////////////////////////////
DEF_SAMPLE( return new TwoPtConicalView(); )