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

Side by Side Diff: tests/ResourceCacheTest.cpp

Issue 585493002: use surface instead of explicitly making gpudevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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/GpuDrawPathTest.cpp ('k') | 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 * 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 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "SkCanvas.h"
10 #include "GrContextFactory.h" 11 #include "GrContextFactory.h"
11 #include "GrResourceCache.h" 12 #include "GrResourceCache.h"
12 #include "SkGpuDevice.h" 13 #include "SkSurface.h"
13 #include "Test.h" 14 #include "Test.h"
14 15
15 static const int gWidth = 640; 16 static const int gWidth = 640;
16 static const int gHeight = 480; 17 static const int gHeight = 480;
17 18
18 //////////////////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////////////////
19 static void test_cache(skiatest::Reporter* reporter, 20 static void test_cache(skiatest::Reporter* reporter,
20 GrContext* context, 21 GrContext* context,
21 SkCanvas* canvas) { 22 SkCanvas* canvas) {
22 const SkIRect size = SkIRect::MakeWH(gWidth, gHeight); 23 const SkIRect size = SkIRect::MakeWH(gWidth, gHeight);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 GrContext* context = factory->get(glType); 290 GrContext* context = factory->get(glType);
290 if (NULL == context) { 291 if (NULL == context) {
291 continue; 292 continue;
292 } 293 }
293 294
294 GrTextureDesc desc; 295 GrTextureDesc desc;
295 desc.fConfig = kSkia8888_GrPixelConfig; 296 desc.fConfig = kSkia8888_GrPixelConfig;
296 desc.fFlags = kRenderTarget_GrTextureFlagBit; 297 desc.fFlags = kRenderTarget_GrTextureFlagBit;
297 desc.fWidth = gWidth; 298 desc.fWidth = gWidth;
298 desc.fHeight = gHeight; 299 desc.fHeight = gHeight;
300 SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
301 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, info , 0));
299 302
300 SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, NUL L, 0)); 303 test_cache(reporter, context, surface->getCanvas());
301 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(texture.get()));
302 SkCanvas canvas(device.get());
303
304 test_cache(reporter, context, &canvas);
305 test_purge_invalidated(reporter, context); 304 test_purge_invalidated(reporter, context);
306 test_cache_delete_on_destruction(reporter, context); 305 test_cache_delete_on_destruction(reporter, context);
307 test_resource_size_changed(reporter, context); 306 test_resource_size_changed(reporter, context);
308 } 307 }
309 } 308 }
310 309
311 #endif 310 #endif
OLDNEW
« no previous file with comments | « tests/GpuDrawPathTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698