aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-27 16:28:43 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-27 16:28:43 +0000
commit60c8d24f84105dd341e36a7fc97e25f88ceef309 (patch)
tree06021ce951a82d9bfb5711df1e2b7c50ddf03b13 /gm
parent64f6d154511fc840e9a2db1f17699fd5799f7917 (diff)
Remove some unnecessary uses of SkOnce.
- gm/imagefiltersgraph.cpp can just use a global registrar - SkScaledImageCache always accesses its global under a lock BUG=skia: R=bungeman@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/297273006 git-svn-id: http://skia.googlecode.com/svn/trunk@14897 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r--gm/imagefiltersgraph.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index d19dd85e78..ec6559ffa3 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;
};
///////////////////////////////////////////////////////////////////////////////