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

Side by Side Diff: tests/TextBlobCacheTest.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SurfaceTest.cpp ('k') | tests/TextureStorageAllocator.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 2015 Google Inc. 2 * Copyright 2015 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 uint32_t flags = 0; 59 uint32_t flags = 0;
60 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); 60 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
61 61
62 // configure our context for maximum stressing of cache and atlas 62 // configure our context for maximum stressing of cache and atlas
63 if (stressTest) { 63 if (stressTest) {
64 GrTest::SetupAlwaysEvictAtlas(context); 64 GrTest::SetupAlwaysEvictAtlas(context);
65 context->setTextBlobCacheLimit_ForTesting(0); 65 context->setTextBlobCacheLimit_ForTesting(0);
66 } 66 }
67 67
68 SkImageInfo info = SkImageInfo::Make(kWidth, kHeight, kN32_SkColorType, kPre mul_SkAlphaType); 68 SkImageInfo info = SkImageInfo::Make(kWidth, kHeight, kN32_SkColorType, kPre mul_SkAlphaType);
69 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkBudget ed::kNo, info, 69 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &props));
70 0, &props));
71 REPORTER_ASSERT(reporter, surface); 70 REPORTER_ASSERT(reporter, surface);
72 if (!surface) { 71 if (!surface) {
73 return; 72 return;
74 } 73 }
75 74
76 SkCanvas* canvas = surface->getCanvas(); 75 SkCanvas* canvas = surface->getCanvas();
77 76
78 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); 77 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
79 78
80 int count = SkMin32(fm->countFamilies(), maxFamilies); 79 int count = SkMin32(fm->countFamilies(), maxFamilies);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 125 }
127 } 126 }
128 } 127 }
129 blobs.emplace_back(builder.build()); 128 blobs.emplace_back(builder.build());
130 } 129 }
131 } 130 }
132 131
133 // create surface where LCD is impossible 132 // create surface where LCD is impossible
134 info = SkImageInfo::MakeN32Premul(kWidth, kHeight); 133 info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
135 SkSurfaceProps propsNoLCD(0, kUnknown_SkPixelGeometry); 134 SkSurfaceProps propsNoLCD(0, kUnknown_SkPixelGeometry);
136 SkAutoTUnref<SkSurface> surfaceNoLCD(canvas->newSurface(info, &propsNoLCD)); 135 auto surfaceNoLCD(canvas->makeSurface(info, &propsNoLCD));
137 REPORTER_ASSERT(reporter, surface); 136 REPORTER_ASSERT(reporter, surface);
138 if (!surface) { 137 if (!surface) {
139 return; 138 return;
140 } 139 }
141 140
142 SkCanvas* canvasNoLCD = surfaceNoLCD->getCanvas(); 141 SkCanvas* canvasNoLCD = surfaceNoLCD->getCanvas();
143 142
144 // test redraw 143 // test redraw
145 draw(canvas, 2, blobs); 144 draw(canvas, 2, blobs);
146 draw(canvasNoLCD, 2, blobs); 145 draw(canvasNoLCD, 2, blobs);
(...skipping 19 matching lines...) Expand all
166 } 165 }
167 166
168 DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobAbnormal, reporter, context) { 167 DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobAbnormal, reporter, context) {
169 text_blob_cache_inner(reporter, context, 256, 256, 10, false, false); 168 text_blob_cache_inner(reporter, context, 256, 256, 10, false, false);
170 } 169 }
171 170
172 DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobStressAbnormal, reporter, context) { 171 DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobStressAbnormal, reporter, context) {
173 text_blob_cache_inner(reporter, context, 256, 256, 10, false, true); 172 text_blob_cache_inner(reporter, context, 256, 256, 10, false, true);
174 } 173 }
175 #endif 174 #endif
OLDNEW
« no previous file with comments | « tests/SurfaceTest.cpp ('k') | tests/TextureStorageAllocator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698