| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 SkString filename = SkOSPath::SkPathJoin( | 33 SkString filename = SkOSPath::SkPathJoin( |
| 34 INHERITED::gResourcePath.c_str(), "mandrill_512.png"); | 34 INHERITED::gResourcePath.c_str(), "mandrill_512.png"); |
| 35 if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm, | 35 if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm, |
| 36 SkBitmap::kARGB_8888_Config, | 36 SkBitmap::kARGB_8888_Config, |
| 37 SkImageDecoder::kDecodePixels_Mode)) { | 37 SkImageDecoder::kDecodePixels_Mode)) { |
| 38 SkDebugf("Could not decode the file. Did you forget to set the " | 38 SkDebugf("Could not decode the file. Did you forget to set the " |
| 39 "resourcePath?\n"); | 39 "resourcePath?\n"); |
| 40 return; | 40 return; |
| 41 } | 41 } |
| 42 canvas->drawBitmap(bm, 0, 0); | 42 canvas->drawBitmap(bm, 0, 0); |
| 43 SkAssertResult(bm.copyTo(&bm4444, SkBitmap::kARGB_4444_Config)); | 43 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType)); |
| 44 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0); | 44 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0); |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 typedef GM INHERITED; | 48 typedef GM INHERITED; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 ////////////////////////////////////////////////////////////////////////////// | 51 ////////////////////////////////////////////////////////////////////////////// |
| 52 | 52 |
| 53 static GM* MyFactory(void*) { return new CopyTo4444GM; } | 53 static GM* MyFactory(void*) { return new CopyTo4444GM; } |
| 54 static GMRegistry reg(MyFactory); | 54 static GMRegistry reg(MyFactory); |
| 55 | 55 |
| 56 } | 56 } |
| OLD | NEW |