Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: samplecode/SampleLayers.cpp

Issue 1565203002: Revert of add backdrop option to SaveLayerRec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleLayers.cpp
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp
index f8ebd7c94f5077e88feb92edb13d1b249a228ff9..52bf5b357b2b7e308f8819c0c24d5cc31d01177a 100644
--- a/samplecode/SampleLayers.cpp
+++ b/samplecode/SampleLayers.cpp
@@ -232,80 +232,8 @@
private:
typedef SkView INHERITED;
};
-DEF_SAMPLE( return new LayersView; )
//////////////////////////////////////////////////////////////////////////////
-#include "SkBlurImageFilter.h"
-#include "SkMatrixConvolutionImageFilter.h"
-#include "SkMorphologyImageFilter.h"
-
-#include "Resources.h"
-#include "SkAnimTimer.h"
-
-class BackdropView : public SampleView {
- SkPoint fCenter;
- SkScalar fAngle;
- SkAutoTUnref<SkImage> fImage;
- SkAutoTUnref<SkImageFilter> fFilter;
-public:
- BackdropView() {
- fCenter.set(200, 150);
- fAngle = 0;
- fImage.reset(GetResourceAsImage("mandrill_512.png"));
- fFilter.reset(SkDilateImageFilter::Create(8, 8));
- }
-
-protected:
- // overrides from SkEventSink
- bool onQuery(SkEvent* evt) override {
- if (SampleCode::TitleQ(*evt)) {
- SampleCode::TitleR(evt, "Backdrop");
- return true;
- }
- return this->INHERITED::onQuery(evt);
- }
-
- void onDrawContent(SkCanvas* canvas) override {
- canvas->drawImage(fImage, 0, 0, nullptr);
-
- const SkScalar w = 250;
- const SkScalar h = 150;
- SkPath path;
- path.addOval(SkRect::MakeXYWH(-w/2, -h/2, w, h));
- SkMatrix m;
- m.setRotate(fAngle);
- m.postTranslate(fCenter.x(), fCenter.y());
- path.transform(m);
-
- canvas->clipPath(path, SkRegion::kIntersect_Op, true);
- const SkRect bounds = path.getBounds();
-
- SkPaint paint;
- paint.setAlpha(0xCC);
- canvas->saveLayer({ &bounds, &paint, fFilter, 0 });
-
- canvas->restore();
- }
-
- bool onAnimate(const SkAnimTimer& timer) override {
- fAngle = SkDoubleToScalar(fmod(timer.secs() * 360 / 5, 360));
- return true;
- }
-
- SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
- this->inval(nullptr);
- return new Click(this);
- }
-
- bool onClick(Click* click) override {
- this->inval(nullptr);
- fCenter = click->fCurr;
- return this->INHERITED::onClick(click);
- }
-
-private:
- typedef SampleView INHERITED;
-};
-DEF_SAMPLE( return new BackdropView; )
-
+static SkView* MyFactory() { return new LayersView; }
+static SkViewRegister reg(MyFactory);
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698