diff options
| author | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-07 22:10:39 +0000 |
|---|---|---|
| committer | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-07 22:10:39 +0000 |
| commit | f97593c899d01ef3587355addbe664bc8f7b2dc5 (patch) | |
| tree | a38882e6f449d1095e433ef474a474c5801aacf4 /samplecode/SamplePictFile.cpp | |
| parent | bcedc220121e36b7c6f52aadb7000de1c5aee609 (diff) | |
Revert "Added the following 3 features to sample app."
Review URL: https://codereview.appspot.com/6906054
git-svn-id: http://skia.googlecode.com/svn/trunk@6719 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SamplePictFile.cpp')
| -rw-r--r-- | samplecode/SamplePictFile.cpp | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp index 2321c042f8..22c81d1d94 100644 --- a/samplecode/SamplePictFile.cpp +++ b/samplecode/SamplePictFile.cpp @@ -13,7 +13,6 @@ #include "SkGradientShader.h" #include "SkGraphics.h" #include "SkImageDecoder.h" -#include "SkOSFile.h" #include "SkPath.h" #include "SkPicture.h" #include "SkRandom.h" @@ -32,10 +31,8 @@ class PictFileView : public SampleView { SkString fFilename; SkPicture* fPicture; - SkPicture* fBBoxPicture; - bool fUseBBox; - static SkPicture* LoadPicture(const char path[], bool useBBox) { + static SkPicture* LoadPicture(const char path[]) { SkPicture* pic = NULL; SkBitmap bm; @@ -63,30 +60,16 @@ class PictFileView : public SampleView { p2.serialize(&writer); } } - - if (useBBox) { - SkPicture* bboxPicture = SkNEW(SkPicture); - pic->draw(bboxPicture->beginRecording(pic->width(), pic->height(), - SkPicture::kOptimizeForClippedPlayback_RecordingFlag)); - bboxPicture->endRecording(); - SkDELETE(pic); - return bboxPicture; - - } else { - return pic; - } + return pic; } public: PictFileView(const char name[] = NULL) : fFilename(name) { fPicture = NULL; - fBBoxPicture = NULL; - fUseBBox = false; } virtual ~PictFileView() { SkSafeUnref(fPicture); - SkSafeUnref(fBBoxPicture); } protected: @@ -94,33 +77,19 @@ protected: virtual bool onQuery(SkEvent* evt) { if (SampleCode::TitleQ(*evt)) { SkString name("P:"); - char* basename = strrchr(fFilename.c_str(), SkPATH_SEPARATOR); - name.append(basename ? basename+1: fFilename.c_str()); - if (fUseBBox) { - name.append(" <bbox>"); - } + name.append(fFilename); SampleCode::TitleR(evt, name.c_str()); return true; } return this->INHERITED::onQuery(evt); } - virtual bool onEvent(const SkEvent& evt) { - if (evt.isType("PictFileView::toggleBBox")) { - fUseBBox = !fUseBBox; - return true; - } - return this->INHERITED::onEvent(evt); - } - virtual void onDrawContent(SkCanvas* canvas) { - SkPicture** picture = fUseBBox ? &fBBoxPicture : &fPicture; - - if (!*picture) { - *picture = LoadPicture(fFilename.c_str(), fUseBBox); + if (!fPicture) { + fPicture = LoadPicture(fFilename.c_str()); } - if (*picture) { - canvas->drawPicture(**picture); + if (fPicture) { + canvas->drawPicture(*fPicture); } } |
