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 "SkImageEncoder.h" | 8 #include "SkImageEncoder.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkStream.h" | 12 #include "SkStream.h" |
13 #include "Test.h" | 13 #include "Test.h" |
14 #include "TestClassDef.h" | |
15 | 14 |
16 static SkBitmap::Config configs[] = { | 15 static SkBitmap::Config configs[] = { |
17 SkBitmap::kRGB_565_Config, | 16 SkBitmap::kRGB_565_Config, |
18 SkBitmap::kARGB_8888_Config, | 17 SkBitmap::kARGB_8888_Config, |
19 }; | 18 }; |
20 | 19 |
21 DEF_TEST(ARGBImageEncoder, reporter) { | 20 DEF_TEST(ARGBImageEncoder, reporter) { |
22 // Bytes we expect to get: | 21 // Bytes we expect to get: |
23 const int kWidth = 3; | 22 const int kWidth = 3; |
24 const int kHeight = 5; | 23 const int kHeight = 5; |
(...skipping 29 matching lines...) Expand all Loading... |
54 SkAutoMalloc pixelBufferManager(bufferSize); | 53 SkAutoMalloc pixelBufferManager(bufferSize); |
55 char *pixelBuffer = static_cast<char *>(pixelBufferManager.get()); | 54 char *pixelBuffer = static_cast<char *>(pixelBufferManager.get()); |
56 SkMemoryWStream out(pixelBuffer, bufferSize); | 55 SkMemoryWStream out(pixelBuffer, bufferSize); |
57 REPORTER_ASSERT(reporter, enc->encodeStream(&out, bitmap, SkImageEncoder
::kDefaultQuality)); | 56 REPORTER_ASSERT(reporter, enc->encodeStream(&out, bitmap, SkImageEncoder
::kDefaultQuality)); |
58 | 57 |
59 // Confirm we got the expected results. | 58 // Confirm we got the expected results. |
60 REPORTER_ASSERT(reporter, bufferSize == sizeof(comparisonBuffer)); | 59 REPORTER_ASSERT(reporter, bufferSize == sizeof(comparisonBuffer)); |
61 REPORTER_ASSERT(reporter, memcmp(pixelBuffer, comparisonBuffer, bufferSi
ze) == 0); | 60 REPORTER_ASSERT(reporter, memcmp(pixelBuffer, comparisonBuffer, bufferSi
ze) == 0); |
62 } | 61 } |
63 } | 62 } |
OLD | NEW |