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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 23003035: Fix leaked SkPDFDevice in PDFPrimitivesTest.cpp (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 /* 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
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698