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

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

Issue 1950983007: Add sRGB mode toggle to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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.h
diff --git a/tools/viewer/sk_app/VulkanWindowContext.h b/tools/viewer/sk_app/VulkanWindowContext.h
index 48f8ed536ba12a183c786abbd003678c2cb06141..4fc66d15976917f54e3c946cdf2e233a00dcb1a2 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.h
+++ b/tools/viewer/sk_app/VulkanWindowContext.h
@@ -26,8 +26,8 @@ public:
static VkSurfaceKHR createVkSurface(VkInstance, void* platformData);
static bool canPresent(VkInstance, VkPhysicalDevice, uint32_t queueFamilyIndex);
- static VulkanWindowContext* Create(void* platformData, int msaaSampleCount) {
- VulkanWindowContext* ctx = new VulkanWindowContext(platformData, msaaSampleCount);
+ static VulkanWindowContext* Create(void* platformData, int msaaSampleCount, bool srgb) {
+ VulkanWindowContext* ctx = new VulkanWindowContext(platformData, msaaSampleCount, srgb);
if (!ctx->isValid()) {
delete ctx;
return nullptr;
@@ -43,7 +43,12 @@ public:
bool isValid() override { return SkToBool(fBackendContext.get()); }
void resize(uint32_t w, uint32_t h) override {
- this->createSwapchain(w, h);
+ this->createSwapchain(w, h, fSRGB);
+ }
+
+ bool getSRGB() override { return fSRGB; }
+ void setSRGB(bool srgb) override {
+ this->createSwapchain(fWidth, fHeight, srgb);
}
GrBackendContext getBackendContext() override {
@@ -51,9 +56,8 @@ public:
}
private:
- VulkanWindowContext();
- VulkanWindowContext(void*, int msaaSampleCount);
- void initializeContext(void*);
+ VulkanWindowContext(void*, int msaaSampleCount, bool srgb);
+ void initializeContext(void*, bool srgb);
void destroyContext();
struct BackbufferInfo {
@@ -65,7 +69,7 @@ private:
};
BackbufferInfo* getAvailableBackbuffer();
- bool createSwapchain(uint32_t width, uint32_t height);
+ bool createSwapchain(uint32_t width, uint32_t height, bool srgb);
bsalomon 2016/05/06 18:30:15 Should we take a config here or something more gen
Brian Osman 2016/05/06 18:42:06 Did you mean GrPixelConfig? That would invert some
bsalomon 2016/05/06 18:48:32 What about (SkColorType, SkProfileType)? I think
void createBuffers(VkFormat format);
void destroyBuffers();
@@ -102,6 +106,7 @@ private:
VkQueue fPresentQueue;
int fWidth;
int fHeight;
+ bool fSRGB;
GrPixelConfig fPixelConfig;
uint32_t fImageCount;

Powered by Google App Engine
This is Rietveld 408576698