| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 9 |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkImageDecoder.h" | 12 #include "SkImageDecoder.h" |
| 13 #include "SkStream.h" | 13 #include "SkStream.h" |
| 14 | 14 |
| 15 namespace skiagm { | 15 namespace skiagm { |
| 16 | 16 |
| 17 /** Draw a CMYK encoded jpeg - libjpeg doesn't support CMYK->RGB | 17 /** Draw a CMYK encoded jpeg - libjpeg doesn't support CMYK->RGB |
| 18 conversion so this tests Skia's internal processing | 18 conversion so this tests Skia's internal processing |
| 19 */ | 19 */ |
| 20 class CMYKJpegGM : public GM { | 20 class CMYKJpegGM : public GM { |
| 21 public: | 21 public: |
| 22 CMYKJpegGM() {} | 22 CMYKJpegGM() {} |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 25 void onOnceBeforeDraw() SK_OVERRIDE { |
| 26 // parameters to the "decode" call | 26 // parameters to the "decode" call |
| 27 bool dither = false; | 27 bool dither = false; |
| 28 | 28 |
| 29 SkString jpgFilename = GetResourcePath("CMYK.jpg"); | 29 SkString jpgFilename = GetResourcePath("CMYK.jpg"); |
| 30 SkFILEStream stream(jpgFilename.c_str()); | 30 SkFILEStream stream(jpgFilename.c_str()); |
| 31 if (!stream.isValid()) { | 31 if (!stream.isValid()) { |
| 32 SkDebugf("Could not find CMYK.jpg, please set --resourcePath correct
ly.\n"); | 32 SkDebugf("Could not find CMYK.jpg, please set --resourcePath correct
ly.\n"); |
| 33 return; | 33 return; |
| 34 } | 34 } |
| 35 | 35 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 61 | 61 |
| 62 typedef GM INHERITED; | 62 typedef GM INHERITED; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 ////////////////////////////////////////////////////////////////////////////// | 65 ////////////////////////////////////////////////////////////////////////////// |
| 66 | 66 |
| 67 static GM* MyFactory(void*) { return new CMYKJpegGM; } | 67 static GM* MyFactory(void*) { return new CMYKJpegGM; } |
| 68 static GMRegistry reg(MyFactory); | 68 static GMRegistry reg(MyFactory); |
| 69 | 69 |
| 70 } | 70 } |
| OLD | NEW |