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

Side by Side Diff: tests/PDFInvalidBitmapTest.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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
« no previous file with comments | « tests/LazyPtrTest.cpp ('k') | tests/PDFPrimitivesTest.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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDocument.h" 10 #include "SkDocument.h"
(...skipping 14 matching lines...) Expand all
25 private: 25 private:
26 bool onNewLockPixels(LockRec*) override { return false; } 26 bool onNewLockPixels(LockRec*) override { return false; }
27 void onUnlockPixels() override { 27 void onUnlockPixels() override {
28 SkDEBUGFAIL("InvalidPixelRef can't be locked"); 28 SkDEBUGFAIL("InvalidPixelRef can't be locked");
29 } 29 }
30 }; 30 };
31 31
32 SkBitmap make_invalid_bitmap(const SkImageInfo& imageInfo) { 32 SkBitmap make_invalid_bitmap(const SkImageInfo& imageInfo) {
33 SkBitmap bitmap; 33 SkBitmap bitmap;
34 bitmap.setInfo(imageInfo); 34 bitmap.setInfo(imageInfo);
35 bitmap.setPixelRef(SkNEW_ARGS(InvalidPixelRef, (imageInfo)))->unref(); 35 bitmap.setPixelRef(new InvalidPixelRef(imageInfo))->unref();
36 return bitmap; 36 return bitmap;
37 } 37 }
38 38
39 SkBitmap make_invalid_bitmap(SkColorType colorType) { 39 SkBitmap make_invalid_bitmap(SkColorType colorType) {
40 return make_invalid_bitmap( 40 return make_invalid_bitmap(
41 SkImageInfo::Make(100, 100, colorType, kPremul_SkAlphaType)); 41 SkImageInfo::Make(100, 100, colorType, kPremul_SkAlphaType));
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 DEF_TEST(PDFInvalidBitmap, reporter) { 46 DEF_TEST(PDFInvalidBitmap, reporter) {
47 SkDynamicMemoryWStream stream; 47 SkDynamicMemoryWStream stream;
48 SkAutoTUnref<SkDocument> document(SkDocument::CreatePDF(&stream)); 48 SkAutoTUnref<SkDocument> document(SkDocument::CreatePDF(&stream));
49 SkCanvas* canvas = document->beginPage(100, 100); 49 SkCanvas* canvas = document->beginPage(100, 100);
50 50
51 canvas->drawBitmap(SkBitmap(), 0, 0); 51 canvas->drawBitmap(SkBitmap(), 0, 0);
52 canvas->drawBitmap(make_invalid_bitmap(SkImageInfo()), 0, 0); 52 canvas->drawBitmap(make_invalid_bitmap(SkImageInfo()), 0, 0);
53 canvas->drawBitmap(make_invalid_bitmap(kN32_SkColorType), 0, 0); 53 canvas->drawBitmap(make_invalid_bitmap(kN32_SkColorType), 0, 0);
54 canvas->drawBitmap(make_invalid_bitmap(kIndex_8_SkColorType), 0, 0); 54 canvas->drawBitmap(make_invalid_bitmap(kIndex_8_SkColorType), 0, 0);
55 canvas->drawBitmap(make_invalid_bitmap(kARGB_4444_SkColorType), 0, 0); 55 canvas->drawBitmap(make_invalid_bitmap(kARGB_4444_SkColorType), 0, 0);
56 canvas->drawBitmap(make_invalid_bitmap(kRGB_565_SkColorType), 0, 0); 56 canvas->drawBitmap(make_invalid_bitmap(kRGB_565_SkColorType), 0, 0);
57 canvas->drawBitmap(make_invalid_bitmap(kAlpha_8_SkColorType), 0, 0); 57 canvas->drawBitmap(make_invalid_bitmap(kAlpha_8_SkColorType), 0, 0);
58 58
59 // This test passes if it does not crash. 59 // This test passes if it does not crash.
60 } 60 }
OLDNEW
« no previous file with comments | « tests/LazyPtrTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698