OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
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 #include "Test.h" | 9 #include "Test.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // Create a bitmap that would be very eficiently compressed in a ZIP. | 243 // Create a bitmap that would be very eficiently compressed in a ZIP. |
244 static void setup_bitmap(SkBitmap* bitmap, int width, int height) { | 244 static void setup_bitmap(SkBitmap* bitmap, int width, int height) { |
245 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); | 245 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); |
246 bitmap->allocPixels(); | 246 bitmap->allocPixels(); |
247 bitmap->eraseColor(SK_ColorWHITE); | 247 bitmap->eraseColor(SK_ColorWHITE); |
248 } | 248 } |
249 | 249 |
250 static void TestImage(skiatest::Reporter* reporter, const SkBitmap& bitmap, | 250 static void TestImage(skiatest::Reporter* reporter, const SkBitmap& bitmap, |
251 const char* expected, bool useDCTEncoder) { | 251 const char* expected, bool useDCTEncoder) { |
252 SkISize pageSize = SkISize::Make(bitmap.width(), bitmap.height()); | 252 SkISize pageSize = SkISize::Make(bitmap.width(), bitmap.height()); |
253 SkPDFDevice* dev = new SkPDFDevice(pageSize, pageSize, SkMatrix::I()); | 253 SkAutoTUnref<SkPDFDevice> dev(new SkPDFDevice(pageSize, pageSize, SkMatrix::
I())); |
254 | 254 |
255 if (useDCTEncoder) { | 255 if (useDCTEncoder) { |
256 dev->setDCTEncoder(encode_to_dct_stream); | 256 dev->setDCTEncoder(encode_to_dct_stream); |
257 } | 257 } |
258 | 258 |
259 SkCanvas c(dev); | 259 SkCanvas c(dev); |
260 c.drawBitmap(bitmap, 0, 0, NULL); | 260 c.drawBitmap(bitmap, 0, 0, NULL); |
261 | 261 |
262 SkPDFDocument doc; | 262 SkPDFDocument doc; |
263 doc.appendPage(dev); | 263 doc.appendPage(dev); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 TestSubstitute(reporter); | 427 TestSubstitute(reporter); |
428 | 428 |
429 test_issue1083(); | 429 test_issue1083(); |
430 | 430 |
431 TestImages(reporter); | 431 TestImages(reporter); |
432 } | 432 } |
433 | 433 |
434 #include "TestClassDef.h" | 434 #include "TestClassDef.h" |
435 DEFINE_TESTCLASS("PDFPrimitives", PDFPrimitivesTestClass, TestPDFPrimitives) | 435 DEFINE_TESTCLASS("PDFPrimitives", PDFPrimitivesTestClass, TestPDFPrimitives) |
OLD | NEW |