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

Unified Diff: tools/viewer/sk_app/VulkanWindowContext.cpp

Issue 1978573003: Add OpenGL context to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Android stuff Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: tools/viewer/sk_app/VulkanWindowContext.cpp
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index 2570e826a387c873afa3529bc95bb968814a4173..cee9ec73a6d6087c597de57c68ebcd0c515fcd9b 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.cpp
+++ b/tools/viewer/sk_app/VulkanWindowContext.cpp
@@ -25,8 +25,12 @@
namespace sk_app {
VulkanWindowContext::VulkanWindowContext(void* platformData, const DisplayParams& params)
- : fSurface(VK_NULL_HANDLE)
+ : WindowContext()
+ , fSurface(VK_NULL_HANDLE)
, fSwapchain(VK_NULL_HANDLE)
+ , fImages(nullptr)
+ , fImageLayouts(nullptr)
+ , fSurfaces(nullptr)
, fCommandPool(VK_NULL_HANDLE)
, fBackbuffers(nullptr) {
@@ -269,6 +273,7 @@ void VulkanWindowContext::createBuffers(VkFormat format) {
desc.fSampleCnt = 0;
desc.fStencilBits = 0;
desc.fRenderTargetHandle = (GrBackendObject) &info;
+ // TODO: base this on fSurfaceProps
SkSurfaceProps props(GrPixelConfigIsSRGB(fPixelConfig)
? SkSurfaceProps::kGammaCorrect_Flag : 0,
kUnknown_SkPixelGeometry);
@@ -398,7 +403,8 @@ void VulkanWindowContext::destroyContext() {
fSurface = VK_NULL_HANDLE;
}
- delete fContext;
+ fContext->abandonContext();
+ fContext->unref();
fBackendContext.reset(nullptr);
}
@@ -419,7 +425,7 @@ VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer
return backbuffer;
}
-SkSurface* VulkanWindowContext::getBackbufferSurface() {
+sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
BackbufferInfo* backbuffer = this->getAvailableBackbuffer();
SkASSERT(backbuffer);
@@ -510,10 +516,9 @@ SkSurface* VulkanWindowContext::getBackbufferSurface() {
QueueSubmit(fBackendContext->fQueue, 1, &submitInfo,
backbuffer->fUsageFences[0]));
- return fSurfaces[backbuffer->fImageIndex].get();
+ return sk_ref_sp(fSurfaces[backbuffer->fImageIndex].get());
}
-
void VulkanWindowContext::swapBuffers() {
BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;

Powered by Google App Engine
This is Rietveld 408576698