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

Unified Diff: gm/imagefiltersgraph.cpp

Issue 297273006: Remove some unnecessary uses of SkOnce. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 6 years, 7 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 | « no previous file | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersgraph.cpp
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index d19dd85e782f380ed0106759303ab85b0651fe10..ec6559ffa3dcc8125a38992f155e756143d86918 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -18,7 +18,6 @@
#include "SkWriteBuffer.h"
#include "SkMergeImageFilter.h"
#include "SkMorphologyImageFilter.h"
-#include "SkOnce.h"
#include "SkTestImageFilters.h"
#include "SkXfermodeImageFilter.h"
@@ -77,17 +76,13 @@ private:
SkScalar fDX, fDY;
};
-static void init_flattenable(int*) {
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SimpleOffsetFilter)
-}
+SkFlattenable::Registrar registrar("SimpleOffsetFilter",
+ SimpleOffsetFilter::CreateProc,
+ SimpleOffsetFilter::GetFlattenableType());
class ImageFiltersGraphGM : public skiagm::GM {
public:
- ImageFiltersGraphGM() : fInitialized(false) {
- int dummy;
- SK_DECLARE_STATIC_ONCE(once);
- SkOnce(&once, init_flattenable, &dummy);
- }
+ ImageFiltersGraphGM() {}
protected:
virtual uint32_t onGetFlags() const SK_OVERRIDE {
@@ -120,11 +115,11 @@ protected:
virtual SkISize onISize() { return SkISize::Make(500, 150); }
+ virtual void onOnceBeforeDraw() {
+ this->make_bitmap();
+ }
+
virtual void onDraw(SkCanvas* canvas) {
- if (!fInitialized) {
- this->make_bitmap();
- fInitialized = true;
- }
canvas->clear(0x00000000);
{
SkAutoTUnref<SkImageFilter> bitmapSource(SkBitmapSource::Create(fBitmap));
@@ -215,7 +210,6 @@ protected:
private:
typedef GM INHERITED;
SkBitmap fBitmap;
- bool fInitialized;
};
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « no previous file | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698