| OLD | NEW | 
|---|
| 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 "SkColorSpace_Base.h" | 10 #include "SkColorSpace_Base.h" | 
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 303     GrContext* context = ctxInfo.grContext(); | 303     GrContext* context = ctxInfo.grContext(); | 
| 304     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface
       }) { | 304     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface
       }) { | 
| 305         auto surface(surface_func(context, kOpaque_SkAlphaType, nullptr)); | 305         auto surface(surface_func(context, kOpaque_SkAlphaType, nullptr)); | 
| 306 | 306 | 
| 307         auto imageBackingStore = [reporter](SkImage* image) { | 307         auto imageBackingStore = [reporter](SkImage* image) { | 
| 308             GrTexture* texture = as_IB(image)->peekTexture(); | 308             GrTexture* texture = as_IB(image)->peekTexture(); | 
| 309             if (!texture) { | 309             if (!texture) { | 
| 310                 ERRORF(reporter, "Not texture backed."); | 310                 ERRORF(reporter, "Not texture backed."); | 
| 311                 return static_cast<intptr_t>(0); | 311                 return static_cast<intptr_t>(0); | 
| 312             } | 312             } | 
| 313             return static_cast<intptr_t>(texture->getUniqueID()); | 313             return static_cast<intptr_t>(texture->uniqueID()); | 
| 314         }; | 314         }; | 
| 315 | 315 | 
| 316         auto surfaceBackingStore = [reporter](SkSurface* surface) { | 316         auto surfaceBackingStore = [reporter](SkSurface* surface) { | 
| 317             GrDrawContext* dc = surface->getCanvas()->internal_private_accessTop
      LayerDrawContext(); | 317             GrDrawContext* dc = surface->getCanvas()->internal_private_accessTop
      LayerDrawContext(); | 
| 318             GrRenderTarget* rt = dc->accessRenderTarget(); | 318             GrRenderTarget* rt = dc->accessRenderTarget(); | 
| 319             if (!rt) { | 319             if (!rt) { | 
| 320                 ERRORF(reporter, "Not render target backed."); | 320                 ERRORF(reporter, "Not render target backed."); | 
| 321                 return static_cast<intptr_t>(0); | 321                 return static_cast<intptr_t>(0); | 
| 322             } | 322             } | 
| 323             return static_cast<intptr_t>(rt->getUniqueID()); | 323             return static_cast<intptr_t>(rt->uniqueID()); | 
| 324         }; | 324         }; | 
| 325 | 325 | 
| 326         test_unique_image_snap(reporter, surface.get(), false, imageBackingStore
      , | 326         test_unique_image_snap(reporter, surface.get(), false, imageBackingStore
      , | 
| 327                                surfaceBackingStore); | 327                                surfaceBackingStore); | 
| 328 | 328 | 
| 329         // Test again with a "direct" render target; | 329         // Test again with a "direct" render target; | 
| 330         GrBackendObject textureObject = context->getGpu()->createTestingOnlyBack
      endTexture(nullptr, | 330         GrBackendObject textureObject = context->getGpu()->createTestingOnlyBack
      endTexture(nullptr, | 
| 331             10, 10, kRGBA_8888_GrPixelConfig, true); | 331             10, 10, kRGBA_8888_GrPixelConfig, true); | 
| 332         GrBackendTextureDesc desc; | 332         GrBackendTextureDesc desc; | 
| 333         desc.fConfig = kRGBA_8888_GrPixelConfig; | 333         desc.fConfig = kRGBA_8888_GrPixelConfig; | 
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1007     }; | 1007     }; | 
| 1008 | 1008 | 
| 1009     test_surface_creation_and_snapshot_with_color_space(reporter, "wrapped", f16
      Support, | 1009     test_surface_creation_and_snapshot_with_color_space(reporter, "wrapped", f16
      Support, | 
| 1010                                                         wrappedSurfaceMaker); | 1010                                                         wrappedSurfaceMaker); | 
| 1011 | 1011 | 
| 1012     for (auto textureHandle : textureHandles) { | 1012     for (auto textureHandle : textureHandles) { | 
| 1013         context->getGpu()->deleteTestingOnlyBackendTexture(textureHandle); | 1013         context->getGpu()->deleteTestingOnlyBackendTexture(textureHandle); | 
| 1014     } | 1014     } | 
| 1015 } | 1015 } | 
| 1016 #endif | 1016 #endif | 
| OLD | NEW | 
|---|