Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: tests/ImageDecodingTest.cpp

Issue 670453002: Remove image decoder and encoder autoregistration (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-decoder-01-skpicture
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/GifTest.cpp ('k') | tests/JpegTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) != SkImag eDecoder::kFailure; 812 SkImageDecoder::kDecodePixels_Mode) != SkImag eDecoder::kFailure;
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 }
OLDNEW
« no previous file with comments | « tests/GifTest.cpp ('k') | tests/JpegTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698