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

Side by Side Diff: tests/ImageIsOpaqueTest.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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/ImageFrom565Bitmap.cpp ('k') | tests/ImageNewShaderTest.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 2014 Google Inc. 2 * Copyright 2014 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 "SkTypes.h" 8 #include "SkTypes.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 static_cast<SkColorType>(ct ), 42 static_cast<SkColorType>(ct ),
43 static_cast<SkAlphaType>(at ), 43 static_cast<SkAlphaType>(at ),
44 static_cast<SkColorProfileT ype>(pt)); 44 static_cast<SkColorProfileT ype>(pt));
45 test_flatten(reporter, info); 45 test_flatten(reporter, info);
46 } 46 }
47 } 47 }
48 } 48 }
49 } 49 }
50 50
51 static void check_isopaque(skiatest::Reporter* reporter, SkSurface* surface, boo l expectedOpaque) { 51 static void check_isopaque(skiatest::Reporter* reporter, SkSurface* surface, boo l expectedOpaque) {
52 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); 52 sk_sp<SkImage> image(surface->makeImageSnapshot());
53 REPORTER_ASSERT(reporter, image->isOpaque() == expectedOpaque); 53 REPORTER_ASSERT(reporter, image->isOpaque() == expectedOpaque);
54 } 54 }
55 55
56 DEF_TEST(ImageIsOpaqueTest, reporter) { 56 DEF_TEST(ImageIsOpaqueTest, reporter) {
57 SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5); 57 SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
58 SkAutoTUnref<SkSurface> surfaceTransparent(SkSurface::NewRaster(infoTranspar ent)); 58 SkAutoTUnref<SkSurface> surfaceTransparent(SkSurface::NewRaster(infoTranspar ent));
59 check_isopaque(reporter, surfaceTransparent, false); 59 check_isopaque(reporter, surfaceTransparent, false);
60 60
61 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType); 61 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
62 SkAutoTUnref<SkSurface> surfaceOpaque(SkSurface::NewRaster(infoOpaque)); 62 SkAutoTUnref<SkSurface> surfaceOpaque(SkSurface::NewRaster(infoOpaque));
63 check_isopaque(reporter, surfaceOpaque, true); 63 check_isopaque(reporter, surfaceOpaque, true);
64 } 64 }
65 65
66 #if SK_SUPPORT_GPU 66 #if SK_SUPPORT_GPU
67 67
68 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, context) { 68 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, context) {
69 SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5); 69 SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
70 SkAutoTUnref<SkSurface> surfaceTransparent( 70 SkAutoTUnref<SkSurface> surfaceTransparent(
71 SkSurface::NewRenderTarget(context, SkBudgeted::kNo, infoTransparent)); 71 SkSurface::NewRenderTarget(context, SkBudgeted::kNo, infoTransparent));
72 check_isopaque(reporter, surfaceTransparent, false); 72 check_isopaque(reporter, surfaceTransparent, false);
73 73
74 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType); 74 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
75 SkAutoTUnref<SkSurface> surfaceOpaque( 75 SkAutoTUnref<SkSurface> surfaceOpaque(
76 SkSurface::NewRenderTarget(context,SkBudgeted::kNo, infoOpaque)); 76 SkSurface::NewRenderTarget(context,SkBudgeted::kNo, infoOpaque));
77 77
78 check_isopaque(reporter, surfaceOpaque, true); 78 check_isopaque(reporter, surfaceOpaque, true);
79 } 79 }
80 80
81 #endif 81 #endif
OLDNEW
« no previous file with comments | « tests/ImageFrom565Bitmap.cpp ('k') | tests/ImageNewShaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698