Remove samples that aren't built
Change-Id: Ied09d28149cdb38ab1b4a4b704c993a726324220 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205488 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
16b1efb871
commit
47ba54d382
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* 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 "Sample.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkGraphics.h"
|
||||
#include "SkRandom.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkPicture.h"
|
||||
|
||||
static sk_sp<SkShader> make_linear() {
|
||||
SkPoint pts[] = { 0, 0, SK_Scalar1/500, SK_Scalar1/500 };
|
||||
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
|
||||
return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
|
||||
}
|
||||
|
||||
class ClampView : public Sample {
|
||||
sk_sp<SkShader> fGrad;
|
||||
|
||||
public:
|
||||
ClampView() {
|
||||
fGrad = make_linear();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool onQuery(Sample::Event* evt) {
|
||||
if (Sample::TitleQ(*evt)) {
|
||||
Sample::TitleR(evt, "Clamp");
|
||||
return true;
|
||||
}
|
||||
return this->INHERITED::onQuery(evt);
|
||||
}
|
||||
|
||||
virtual void onDrawContent(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
paint.setShader(fGrad);
|
||||
|
||||
// canvas->translate(this->width()/2, this->height()/2);
|
||||
canvas->translate(64, 64);
|
||||
canvas->drawPaint(paint);
|
||||
|
||||
SkPicture pic;
|
||||
SkCanvas* c = pic.beginRecording(100, 100, 0);
|
||||
SkCanvas::LayerIter layerIterator(c, false);
|
||||
layerIterator.next();
|
||||
layerIterator.done();
|
||||
}
|
||||
|
||||
private:
|
||||
typedef Sample INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Sample* MyFactory() { return new ClampView; }
|
||||
static SampleRegister reg(MyFactory);
|
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* 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 "Sample.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkGraphics.h"
|
||||
#include "SkRandom.h"
|
||||
#include "SkBlurDrawLooper.h"
|
||||
#include "SkGradientShader.h"
|
||||
|
||||
typedef SkScalar (*MakePathProc)(SkPath*);
|
||||
|
||||
static SkScalar make_frame(SkPath* path) {
|
||||
SkRect r = { 10, 10, 630, 470 };
|
||||
path->addRoundRect(r, 15, 15);
|
||||
|
||||
SkPaint paint;
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
paint.setStrokeWidth(5);
|
||||
paint.getFillPath(*path, path);
|
||||
return 15;
|
||||
}
|
||||
|
||||
static SkScalar make_triangle(SkPath* path) {
|
||||
static const int gCoord[] = {
|
||||
10, 20, 15, 5, 30, 30
|
||||
};
|
||||
path->moveTo(SkIntToScalar(gCoord[0]), SkIntToScalar(gCoord[1]));
|
||||
path->lineTo(SkIntToScalar(gCoord[2]), SkIntToScalar(gCoord[3]));
|
||||
path->lineTo(SkIntToScalar(gCoord[4]), SkIntToScalar(gCoord[5]));
|
||||
path->close();
|
||||
path->offset(10, 0);
|
||||
return SkIntToScalar(30);
|
||||
}
|
||||
|
||||
static SkScalar make_rect(SkPath* path) {
|
||||
SkRect r = { 10, 10, 30, 30 };
|
||||
path->addRect(r);
|
||||
path->offset(10, 0);
|
||||
return SkIntToScalar(30);
|
||||
}
|
||||
|
||||
static SkScalar make_oval(SkPath* path) {
|
||||
SkRect r = { 10, 10, 30, 30 };
|
||||
path->addOval(r);
|
||||
path->offset(10, 0);
|
||||
return SkIntToScalar(30);
|
||||
}
|
||||
|
||||
static SkScalar make_sawtooth(SkPath* path) {
|
||||
SkScalar x = SkIntToScalar(20);
|
||||
SkScalar y = SkIntToScalar(20);
|
||||
const SkScalar x0 = x;
|
||||
const SkScalar dx = SK_Scalar1 * 5;
|
||||
const SkScalar dy = SK_Scalar1 * 10;
|
||||
|
||||
path->moveTo(x, y);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
x += dx;
|
||||
path->lineTo(x, y - dy);
|
||||
x += dx;
|
||||
path->lineTo(x, y + dy);
|
||||
}
|
||||
path->lineTo(x, y + 2 * dy);
|
||||
path->lineTo(x0, y + 2 * dy);
|
||||
path->close();
|
||||
return SkIntToScalar(30);
|
||||
}
|
||||
|
||||
static SkScalar make_star(SkPath* path, int n) {
|
||||
const SkScalar c = SkIntToScalar(45);
|
||||
const SkScalar r = SkIntToScalar(20);
|
||||
|
||||
SkScalar rad = -SK_ScalarPI / 2;
|
||||
const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n;
|
||||
|
||||
path->moveTo(c, c - r);
|
||||
for (int i = 1; i < n; i++) {
|
||||
rad += drad;
|
||||
path->lineTo(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r);
|
||||
}
|
||||
path->close();
|
||||
return r * 2 * 6 / 5;
|
||||
}
|
||||
|
||||
static SkScalar make_star_5(SkPath* path) { return make_star(path, 5); }
|
||||
static SkScalar make_star_13(SkPath* path) { return make_star(path, 13); }
|
||||
|
||||
static const MakePathProc gProcs[] = {
|
||||
make_frame,
|
||||
make_triangle,
|
||||
make_rect,
|
||||
make_oval,
|
||||
make_sawtooth,
|
||||
make_star_5,
|
||||
make_star_13
|
||||
};
|
||||
|
||||
#define N SK_ARRAY_COUNT(gProcs)
|
||||
|
||||
class PathFillView : public Sample {
|
||||
SkPath fPath[N];
|
||||
SkScalar fDY[N];
|
||||
|
||||
public:
|
||||
PathFillView() {
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
fDY[i] = gProcs[i](&fPath[i]);
|
||||
}
|
||||
this->setBGColor(0xFFDDDDDD);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool onQuery(Sample::Event* evt) {
|
||||
if (Sample::TitleQ(*evt)) {
|
||||
Sample::TitleR(evt, "PathFill");
|
||||
return true;
|
||||
}
|
||||
return this->INHERITED::onQuery(evt);
|
||||
}
|
||||
|
||||
virtual void onDrawContent(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
canvas->drawPath(fPath[i], paint);
|
||||
canvas->translate(0, fDY[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef Sample INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Sample* MyFactory() { return new PathFillView; }
|
||||
static SampleRegister reg(MyFactory);
|
Loading…
Reference in New Issue
Block a user