| 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkColor.h" | 11 #include "SkColor.h" |
| 12 #include "SkColorPriv.h" | 12 #include "SkColorPriv.h" |
| 13 #include "SkData.h" | 13 #include "SkData.h" |
| 14 #include "SkDecodingImageGenerator.h" | 14 #include "SkDecodingImageGenerator.h" |
| 15 #include "SkDiscardableMemoryPool.h" | 15 #include "SkDiscardableMemoryPool.h" |
| 16 #include "SkForceLinking.h" | |
| 17 #include "SkGradientShader.h" | 16 #include "SkGradientShader.h" |
| 18 #include "SkImageDecoder.h" | 17 #include "SkImageDecoder.h" |
| 19 #include "SkImageEncoder.h" | 18 #include "SkImageEncoder.h" |
| 20 #include "SkImageGeneratorPriv.h" | 19 #include "SkImageGeneratorPriv.h" |
| 21 #include "SkImagePriv.h" | 20 #include "SkImagePriv.h" |
| 22 #include "SkOSFile.h" | 21 #include "SkOSFile.h" |
| 23 #include "SkPoint.h" | 22 #include "SkPoint.h" |
| 24 #include "SkShader.h" | 23 #include "SkShader.h" |
| 25 #include "SkStream.h" | 24 #include "SkStream.h" |
| 26 #include "SkString.h" | 25 #include "SkString.h" |
| 27 #include "Test.h" | 26 #include "Test.h" |
| 28 | 27 |
| 29 __SK_FORCE_IMAGE_DECODER_LINKING; | |
| 30 | |
| 31 /** | 28 /** |
| 32 * Interprets c as an unpremultiplied color, and returns the | 29 * Interprets c as an unpremultiplied color, and returns the |
| 33 * premultiplied equivalent. | 30 * premultiplied equivalent. |
| 34 */ | 31 */ |
| 35 static SkPMColor premultiply_unpmcolor(SkPMColor c) { | 32 static SkPMColor premultiply_unpmcolor(SkPMColor c) { |
| 36 U8CPU a = SkGetPackedA32(c); | 33 U8CPU a = SkGetPackedA32(c); |
| 37 U8CPU r = SkGetPackedR32(c); | 34 U8CPU r = SkGetPackedR32(c); |
| 38 U8CPU g = SkGetPackedG32(c); | 35 U8CPU g = SkGetPackedG32(c); |
| 39 U8CPU b = SkGetPackedB32(c); | 36 U8CPU b = SkGetPackedB32(c); |
| 40 return SkPreMultiplyARGB(a, r, g, b); | 37 return SkPreMultiplyARGB(a, r, g, b); |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); | 807 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); |
| 811 decoder->setAllocator(allocator); | 808 decoder->setAllocator(allocator); |
| 812 decoder->setSampleSize(2); | 809 decoder->setSampleSize(2); |
| 813 SkBitmap bitmap; | 810 SkBitmap bitmap; |
| 814 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, | 811 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, |
| 815 SkImageDecoder::kDecodePixels_Mode); | 812 SkImageDecoder::kDecodePixels_Mode); |
| 816 REPORTER_ASSERT(r, success); | 813 REPORTER_ASSERT(r, success); |
| 817 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory | 814 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory |
| 818 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); | 815 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); |
| 819 } | 816 } |
| OLD | NEW |