| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 SkImageInfo yinfo = SkImageInfo::MakeA8(kBmpSize, kBmpSize); | 52 SkImageInfo yinfo = SkImageInfo::MakeA8(kBmpSize, kBmpSize); |
| 53 fYUVBmps[0].allocPixels(yinfo); | 53 fYUVBmps[0].allocPixels(yinfo); |
| 54 SkImageInfo uinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2); | 54 SkImageInfo uinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2); |
| 55 fYUVBmps[1].allocPixels(uinfo); | 55 fYUVBmps[1].allocPixels(uinfo); |
| 56 SkImageInfo vinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2); | 56 SkImageInfo vinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2); |
| 57 fYUVBmps[2].allocPixels(vinfo); | 57 fYUVBmps[2].allocPixels(vinfo); |
| 58 unsigned char* yPixels; | 58 unsigned char* yPixels; |
| 59 signed char* uvPixels[2]; | 59 signed char* uvPixels[2]; |
| 60 yPixels = static_cast<unsigned char*>(fYUVBmps[0].getPixels()); | 60 yPixels = static_cast<unsigned char*>(fYUVBmps[0].getPixels()); |
| 61 uvPixels[0] = static_cast<signed char*>(fYUVBmps[1].getPixels()); | 61 uvPixels[0] = static_cast<signed char*>(fYUVBmps[1].getPixels()); |
| 62 uvPixels[1] = static_cast<signed char*>(fYUVBmps[2 | 62 uvPixels[1] = static_cast<signed char*>(fYUVBmps[2].getPixels()); |
| 63 ].getPixels()); | |
| 64 | 63 |
| 65 // Here we encode using the NTC encoding (even though we will draw it wi
th all the supported | 64 // Here we encode using the NTC encoding (even though we will draw it wi
th all the supported |
| 66 // yuv color spaces when converted back to RGB) | 65 // yuv color spaces when converted back to RGB) |
| 67 for (int i = 0; i < kBmpSize * kBmpSize; ++i) { | 66 for (int i = 0; i < kBmpSize * kBmpSize; ++i) { |
| 68 yPixels[i] = static_cast<unsigned char>(0.299f * SkGetPackedR32(rgbC
olors[i]) + | 67 yPixels[i] = static_cast<unsigned char>(0.299f * SkGetPackedR32(rgbC
olors[i]) + |
| 69 0.587f * SkGetPackedG32(rgbC
olors[i]) + | 68 0.587f * SkGetPackedG32(rgbC
olors[i]) + |
| 70 0.114f * SkGetPackedB32(rgbC
olors[i])); | 69 0.114f * SkGetPackedB32(rgbC
olors[i])); |
| 71 } | 70 } |
| 72 for (int j = 0; j < kBmpSize / 2; ++j) { | 71 for (int j = 0; j < kBmpSize / 2; ++j) { |
| 73 for (int i = 0; i < kBmpSize / 2; ++i) { | 72 for (int i = 0; i < kBmpSize / 2; ++i) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 166 |
| 168 static const int kBmpSize = 32; | 167 static const int kBmpSize = 32; |
| 169 | 168 |
| 170 typedef GM INHERITED; | 169 typedef GM INHERITED; |
| 171 }; | 170 }; |
| 172 | 171 |
| 173 DEF_GM( return SkNEW(ImageFromYUVTextures); ) | 172 DEF_GM( return SkNEW(ImageFromYUVTextures); ) |
| 174 } | 173 } |
| 175 | 174 |
| 176 #endif | 175 #endif |
| OLD | NEW |