| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 | 8 |
| 9 #include "gm.h" | 9 #include "gm.h" |
| 10 #include "SampleCode.h" | 10 #include "SampleCode.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 path.append("/"); | 30 path.append("/"); |
| 31 path.append(fFilename); | 31 path.append(fFilename); |
| 32 | 32 |
| 33 SkImageDecoder *codec = NULL; | 33 SkImageDecoder *codec = NULL; |
| 34 SkFILEStream stream(path.c_str()); | 34 SkFILEStream stream(path.c_str()); |
| 35 if (stream.isValid()) { | 35 if (stream.isValid()) { |
| 36 codec = SkImageDecoder::Factory(&stream); | 36 codec = SkImageDecoder::Factory(&stream); |
| 37 } | 37 } |
| 38 if (codec) { | 38 if (codec) { |
| 39 stream.rewind(); | 39 stream.rewind(); |
| 40 codec->decode(&stream, &fBM, SkBitmap::kARGB_8888_Config, | 40 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecode
Pixels_Mode); |
| 41 SkImageDecoder::kDecodePixels_Mode); | |
| 42 SkDELETE(codec); | 41 SkDELETE(codec); |
| 43 } else { | 42 } else { |
| 44 fBM.allocN32Pixels(1, 1); | 43 fBM.allocN32Pixels(1, 1); |
| 45 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad | 44 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad |
| 46 } | 45 } |
| 47 fCurPos = SkPoint::Make(0,0); | 46 fCurPos = SkPoint::Make(0,0); |
| 48 fSize = 200; | 47 fSize = 200; |
| 49 } | 48 } |
| 50 | 49 |
| 51 protected: | 50 protected: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 116 } |
| 118 | 117 |
| 119 private: | 118 private: |
| 120 typedef SampleView INHERITED; | 119 typedef SampleView INHERITED; |
| 121 }; | 120 }; |
| 122 | 121 |
| 123 ////////////////////////////////////////////////////////////////////////////// | 122 ////////////////////////////////////////////////////////////////////////////// |
| 124 | 123 |
| 125 static SkView* MyFactory() { return new SubpixelTranslateView("mandrill_256.png"
, .05f, .05f); } | 124 static SkView* MyFactory() { return new SubpixelTranslateView("mandrill_256.png"
, .05f, .05f); } |
| 126 static SkViewRegister reg(MyFactory); | 125 static SkViewRegister reg(MyFactory); |
| OLD | NEW |