OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 char expectedResult[] = | 237 char expectedResult[] = |
238 "<</Value 33\n>>1 0 obj\n<</InnerValue 44\n>>\nendobj\n"; | 238 "<</Value 33\n>>1 0 obj\n<</InnerValue 44\n>>\nendobj\n"; |
239 REPORTER_ASSERT(reporter, buffer.getOffset() == strlen(expectedResult)); | 239 REPORTER_ASSERT(reporter, buffer.getOffset() == strlen(expectedResult)); |
240 REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedResult, | 240 REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedResult, |
241 buffer.getOffset())); | 241 buffer.getOffset())); |
242 } | 242 } |
243 | 243 |
244 // Create a bitmap that would be very eficiently compressed in a ZIP. | 244 // Create a bitmap that would be very eficiently compressed in a ZIP. |
245 static void setup_bitmap(SkBitmap* bitmap, int width, int height) { | 245 static void setup_bitmap(SkBitmap* bitmap, int width, int height) { |
246 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); | 246 bitmap->allocN32Pixels(width, height); |
247 bitmap->allocPixels(); | |
248 bitmap->eraseColor(SK_ColorWHITE); | 247 bitmap->eraseColor(SK_ColorWHITE); |
249 } | 248 } |
250 | 249 |
251 static void TestImage(skiatest::Reporter* reporter, const SkBitmap& bitmap, | 250 static void TestImage(skiatest::Reporter* reporter, const SkBitmap& bitmap, |
252 const char* expected, bool useDCTEncoder) { | 251 const char* expected, bool useDCTEncoder) { |
253 SkISize pageSize = SkISize::Make(bitmap.width(), bitmap.height()); | 252 SkISize pageSize = SkISize::Make(bitmap.width(), bitmap.height()); |
254 SkAutoTUnref<SkPDFDevice> dev(new SkPDFDevice(pageSize, pageSize, SkMatrix::
I())); | 253 SkAutoTUnref<SkPDFDevice> dev(new SkPDFDevice(pageSize, pageSize, SkMatrix::
I())); |
255 | 254 |
256 if (useDCTEncoder) { | 255 if (useDCTEncoder) { |
257 dev->setDCTEncoder(encode_to_dct_data); | 256 dev->setDCTEncoder(encode_to_dct_data); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 TestCatalog(reporter); | 421 TestCatalog(reporter); |
423 | 422 |
424 TestObjectRef(reporter); | 423 TestObjectRef(reporter); |
425 | 424 |
426 TestSubstitute(reporter); | 425 TestSubstitute(reporter); |
427 | 426 |
428 test_issue1083(); | 427 test_issue1083(); |
429 | 428 |
430 TestImages(reporter); | 429 TestImages(reporter); |
431 } | 430 } |
OLD | NEW |