Chromium Code Reviews

Side by Side Diff: tests/SurfaceTest.cpp

Issue 1694943002: When a surface is backed by an external render target force a copy on image snap (Closed) Base URL: https://skia.googlesource.com/skia.git@imgcopy
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« src/image/SkSurface_Gpu.cpp ('K') | « src/image/SkSurface_Gpu.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 #include <functional> 8 #include <functional>
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 421 matching lines...)
432 GrBackendTextureDesc desc; 432 GrBackendTextureDesc desc;
433 desc.fConfig = kRGBA_8888_GrPixelConfig; 433 desc.fConfig = kRGBA_8888_GrPixelConfig;
434 desc.fWidth = 10; 434 desc.fWidth = 10;
435 desc.fHeight = 10; 435 desc.fHeight = 10;
436 desc.fFlags = kRenderTarget_GrBackendTextureFlag; 436 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
437 desc.fTextureHandle = textureObject; 437 desc.fTextureHandle = textureObject;
438 GrTexture* texture = context->textureProvider()->wrapBackendTexture(desc ); 438 GrTexture* texture = context->textureProvider()->wrapBackendTexture(desc );
439 { 439 {
440 SkAutoTUnref<SkSurface> surface( 440 SkAutoTUnref<SkSurface> surface(
441 SkSurface::NewRenderTargetDirect(texture->asRenderTarget())); 441 SkSurface::NewRenderTargetDirect(texture->asRenderTarget()));
442 // We should be able to pass true here, but disallowing copy on writ e for direct GPU 442 test_unique_image_snap(reporter, surface, true, imageBackingStore,
443 // surfaces is not yet implemented.
444 test_unique_image_snap(reporter, surface, false, imageBackingStore,
445 surfaceBackingStore); 443 surfaceBackingStore);
446 } 444 }
447 texture->unref(); 445 texture->unref();
448 context->getGpu()->deleteTestingOnlyBackendTexture(textureObject); 446 context->getGpu()->deleteTestingOnlyBackendTexture(textureObject);
449 } 447 }
450 } 448 }
451 #endif 449 #endif
452 450
453 #if SK_SUPPORT_GPU 451 #if SK_SUPPORT_GPU
454 // May we (soon) eliminate the need to keep testing this, by hiding the bloody d evice! 452 // May we (soon) eliminate the need to keep testing this, by hiding the bloody d evice!
(...skipping 451 matching lines...)
906 desc.fHeight = kHeight; 904 desc.fHeight = kHeight;
907 desc.fFlags = kRenderTarget_GrBackendTextureFlag; 905 desc.fFlags = kRenderTarget_GrBackendTextureFlag;
908 desc.fTextureHandle = textureObject; 906 desc.fTextureHandle = textureObject;
909 907
910 SkSurface* surface = SkSurface::NewFromBackendTexture(context, desc, nul lptr); 908 SkSurface* surface = SkSurface::NewFromBackendTexture(context, desc, nul lptr);
911 test_surface_clear(reporter, surface, grSurfaceGetter, 0xABABABAB); 909 test_surface_clear(reporter, surface, grSurfaceGetter, 0xABABABAB);
912 context->getGpu()->deleteTestingOnlyBackendTexture(textureObject); 910 context->getGpu()->deleteTestingOnlyBackendTexture(textureObject);
913 } 911 }
914 } 912 }
915 #endif 913 #endif
OLDNEW
« src/image/SkSurface_Gpu.cpp ('K') | « src/image/SkSurface_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine