| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkDumpCanvas.h" | 9 #include "SkDumpCanvas.h" |
| 10 #include "SkView.h" | 10 #include "SkView.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 virtual bool onEvent(const SkEvent& evt) SK_OVERRIDE { | 88 virtual bool onEvent(const SkEvent& evt) SK_OVERRIDE { |
| 89 if (evt.isType("PictFileView::toggleBBox")) { | 89 if (evt.isType("PictFileView::toggleBBox")) { |
| 90 fBBox = (BBoxType)((fBBox + 1) % kBBoxTypeCount); | 90 fBBox = (BBoxType)((fBBox + 1) % kBBoxTypeCount); |
| 91 return true; | 91 return true; |
| 92 } | 92 } |
| 93 return this->INHERITED::onEvent(evt); | 93 return this->INHERITED::onEvent(evt); |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { | 96 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { |
| 97 SkASSERT(fBBox < kBBoxTypeCount); | 97 SkASSERT(static_cast<int>(fBBox) < kBBoxTypeCount); |
| 98 SkPicture** picture = fPictures + fBBox; | 98 SkPicture** picture = fPictures + fBBox; |
| 99 | 99 |
| 100 if (!*picture) { | 100 if (!*picture) { |
| 101 *picture = LoadPicture(fFilename.c_str(), fBBox); | 101 *picture = LoadPicture(fFilename.c_str(), fBBox); |
| 102 } | 102 } |
| 103 if (*picture) { | 103 if (*picture) { |
| 104 canvas->drawPicture(**picture); | 104 canvas->drawPicture(**picture); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 SampleView* CreateSamplePictFileView(const char filename[]) { | 202 SampleView* CreateSamplePictFileView(const char filename[]) { |
| 203 return new PictFileView(filename); | 203 return new PictFileView(filename); |
| 204 } | 204 } |
| 205 | 205 |
| 206 ////////////////////////////////////////////////////////////////////////////// | 206 ////////////////////////////////////////////////////////////////////////////// |
| 207 | 207 |
| 208 #if 0 | 208 #if 0 |
| 209 static SkView* MyFactory() { return new PictFileView; } | 209 static SkView* MyFactory() { return new PictFileView; } |
| 210 static SkViewRegister reg(MyFactory); | 210 static SkViewRegister reg(MyFactory); |
| 211 #endif | 211 #endif |
| OLD | NEW |