| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 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 19 matching lines...) Expand all Loading... |
| 30 #include "SkStream.h" | 30 #include "SkStream.h" |
| 31 #include "SkSurface.h" | 31 #include "SkSurface.h" |
| 32 #include "SkXMLParser.h" | 32 #include "SkXMLParser.h" |
| 33 | 33 |
| 34 class PictFileView : public SampleView { | 34 class PictFileView : public SampleView { |
| 35 public: | 35 public: |
| 36 PictFileView(const char name[] = NULL) | 36 PictFileView(const char name[] = NULL) |
| 37 : fFilename(name) | 37 : fFilename(name) |
| 38 , fBBox(kNo_BBoxType) | 38 , fBBox(kNo_BBoxType) |
| 39 , fTileSize(SkSize::Make(0, 0)) { | 39 , fTileSize(SkSize::Make(0, 0)) { |
| 40 for (unsigned i = 0; i < kBBoxTypeCount; ++i) { | 40 for (int i = 0; i < kBBoxTypeCount; ++i) { |
| 41 fPictures[i] = NULL; | 41 fPictures[i] = NULL; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual ~PictFileView() { | 45 virtual ~PictFileView() { |
| 46 for (unsigned i = 0; i < kBBoxTypeCount; ++i) { | 46 for (int i = 0; i < kBBoxTypeCount; ++i) { |
| 47 SkSafeUnref(fPictures[i]); | 47 SkSafeUnref(fPictures[i]); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void onTileSizeChanged(const SkSize &tileSize) SK_OVERRIDE { | 51 virtual void onTileSizeChanged(const SkSize &tileSize) SK_OVERRIDE { |
| 52 if (tileSize != fTileSize) { | 52 if (tileSize != fTileSize) { |
| 53 fTileSize = tileSize; | 53 fTileSize = tileSize; |
| 54 SkSafeSetNull(fPictures[kTileGrid_BBoxType]); | 54 SkSafeSetNull(fPictures[kTileGrid_BBoxType]); |
| 55 } | 55 } |
| 56 } | 56 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 SampleView* CreateSamplePictFileView(const char filename[]) { | 183 SampleView* CreateSamplePictFileView(const char filename[]) { |
| 184 return new PictFileView(filename); | 184 return new PictFileView(filename); |
| 185 } | 185 } |
| 186 | 186 |
| 187 ////////////////////////////////////////////////////////////////////////////// | 187 ////////////////////////////////////////////////////////////////////////////// |
| 188 | 188 |
| 189 #if 0 | 189 #if 0 |
| 190 static SkView* MyFactory() { return new PictFileView; } | 190 static SkView* MyFactory() { return new PictFileView; } |
| 191 static SkViewRegister reg(MyFactory); | 191 static SkViewRegister reg(MyFactory); |
| 192 #endif | 192 #endif |
| OLD | NEW |