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

Side by Side Diff: tests/WritePixelsTest.cpp

Issue 2187573002: Reduce usage of MakeRenderTargetDirect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 4 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
« no previous file with comments | « tests/SurfaceTest.cpp ('k') | tests/skbug5221.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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkMathPriv.h" 10 #include "SkMathPriv.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (!tightRowBytes) { 400 if (!tightRowBytes) {
401 memset(pixels, DEV_PAD, size); 401 memset(pixels, DEV_PAD, size);
402 } 402 }
403 auto surface(SkSurface::MakeRasterDirectReleaseProc(info, pixels, rowByt es, 403 auto surface(SkSurface::MakeRasterDirectReleaseProc(info, pixels, rowByt es,
404 free_pixels, nullptr )); 404 free_pixels, nullptr ));
405 test_write_pixels(reporter, surface.get()); 405 test_write_pixels(reporter, surface.get());
406 } 406 }
407 } 407 }
408 #if SK_SUPPORT_GPU 408 #if SK_SUPPORT_GPU
409 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { 409 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) {
410 const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H);
411
410 for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { 412 for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
411 GrSurfaceDesc desc; 413 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext() , SkBudgeted::kNo,
412 desc.fFlags = kRenderTarget_GrSurfaceFlag; 414 ii, 0, origin, null ptr));
413 desc.fWidth = DEV_W;
414 desc.fHeight = DEV_H;
415 desc.fConfig = kSkia8888_GrPixelConfig;
416 desc.fOrigin = origin;
417 SkAutoTUnref<GrTexture> texture(
418 ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudget ed::kNo));
419 auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget() , nullptr));
420 test_write_pixels(reporter, surface.get()); 415 test_write_pixels(reporter, surface.get());
421 } 416 }
422 } 417 }
423 #endif 418 #endif
OLDNEW
« no previous file with comments | « tests/SurfaceTest.cpp ('k') | tests/skbug5221.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698