| 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 "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkDecodingImageGenerator.h" | 10 #include "SkDecodingImageGenerator.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "gm.h" | 33 #include "gm.h" |
| 34 | 34 |
| 35 /////////////////////////////////////////////////////////////////////////////// | 35 /////////////////////////////////////////////////////////////////////////////// |
| 36 | 36 |
| 37 static SkBitmap load_bitmap() { | 37 static SkBitmap load_bitmap() { |
| 38 SkBitmap bm; | 38 SkBitmap bm; |
| 39 SkString directory = skiagm::GM::GetResourcePath(); | 39 SkString directory = skiagm::GM::GetResourcePath(); |
| 40 SkString path = SkOSPath::SkPathJoin(directory.c_str(), "mandrill_512.png"); | 40 SkString path = SkOSPath::SkPathJoin(directory.c_str(), "mandrill_512.png"); |
| 41 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str())); | 41 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str())); |
| 42 if (data.get() != NULL) { | 42 if (data.get() != NULL) { |
| 43 SkInstallDiscardablePixelRef(SkDecodingImageGenerator::Create( | 43 SkDecodingImageGenerator::Install(data.get(), &bm); |
| 44 data, SkDecodingImageGenerator::Options()), &bm, NULL); | |
| 45 } | 44 } |
| 46 return bm; | 45 return bm; |
| 47 } | 46 } |
| 48 | 47 |
| 49 static void drawCircle(SkCanvas* canvas, int r, SkColor color) { | 48 static void drawCircle(SkCanvas* canvas, int r, SkColor color) { |
| 50 SkPaint paint; | 49 SkPaint paint; |
| 51 paint.setAntiAlias(true); | 50 paint.setAntiAlias(true); |
| 52 paint.setColor(color); | 51 paint.setColor(color); |
| 53 | 52 |
| 54 canvas->drawCircle(SkIntToScalar(r), SkIntToScalar(r), SkIntToScalar(r), | 53 canvas->drawCircle(SkIntToScalar(r), SkIntToScalar(r), SkIntToScalar(r), |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 SkPicture* fPicture; | 188 SkPicture* fPicture; |
| 190 SkPicture* fSubPicture; | 189 SkPicture* fSubPicture; |
| 191 | 190 |
| 192 typedef SampleView INHERITED; | 191 typedef SampleView INHERITED; |
| 193 }; | 192 }; |
| 194 | 193 |
| 195 ////////////////////////////////////////////////////////////////////////////// | 194 ////////////////////////////////////////////////////////////////////////////// |
| 196 | 195 |
| 197 static SkView* MyFactory() { return new PictureView; } | 196 static SkView* MyFactory() { return new PictureView; } |
| 198 static SkViewRegister reg(MyFactory); | 197 static SkViewRegister reg(MyFactory); |
| OLD | NEW |