aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-06-16 11:41:44 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-16 11:41:44 -0700
commitab8241880d09eb1774b4993ca6df048a27b7020c (patch)
treef3c7e4c1873771ee818e0a1c86515a3ea5250d75 /tools/viewer
parent6a61a875467646f8dbc37cfecf49e12d1f475170 (diff)
Revert of Lots of progress switching to SkColorSpace rather than SkColorProfileType (patchset #10 id:180001 of https://codereview.chromium.org/2069173002/ )
Reason for revert: Mac crashes in GrUploadPixmapToTexture Original issue's description: > Lots of progress on switching to SkColorSpace rather than SkColorProfileType > > Fixed a bunch of code in Ganesh, as well as usage of SkColorProfileType in most of our tools (DM, SampleApp, Viewer, nanobench, skiaserve, HelloWorld). > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2069173002 > > Committed: https://skia.googlesource.com/skia/+/6a61a875467646f8dbc37cfecf49e12d1f475170 TBR=reed@google.com,herb@google.com,msarett@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2072813002
Diffstat (limited to 'tools/viewer')
-rw-r--r--tools/viewer/Viewer.cpp8
-rw-r--r--tools/viewer/sk_app/DisplayParams.h10
-rw-r--r--tools/viewer/sk_app/GLWindowContext.cpp4
-rw-r--r--tools/viewer/sk_app/VulkanWindowContext.cpp3
-rwxr-xr-xtools/viewer/sk_app/WindowContext.cpp4
-rw-r--r--tools/viewer/sk_app/android/GLWindowContext_android.cpp3
-rw-r--r--tools/viewer/sk_app/android/RasterWindowContext_android.cpp2
7 files changed, 15 insertions, 19 deletions
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 9aec01f3ec..43697f88b8 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -122,8 +122,8 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
});
fCommands.addCommand('c', "Modes", "Toggle sRGB color mode", [this]() {
DisplayParams params = fWindow->getDisplayParams();
- params.fColorSpace = (nullptr == params.fColorSpace)
- ? SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr;
+ params.fProfileType = (kLinear_SkColorProfileType == params.fProfileType)
+ ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType;
fWindow->setDisplayParams(params);
this->updateTitle();
fWindow->inval();
@@ -266,9 +266,7 @@ Viewer::~Viewer() {
void Viewer::updateTitle() {
SkString title("Viewer: ");
title.append(fSlides[fCurrentSlide]->getName());
-
- // TODO: For now, any color-space on the window means sRGB
- if (fWindow->getDisplayParams().fColorSpace) {
+ if (kSRGB_SkColorProfileType == fWindow->getDisplayParams().fProfileType) {
title.append(" sRGB");
}
title.append(kBackendTypeStrings[fBackendType]);
diff --git a/tools/viewer/sk_app/DisplayParams.h b/tools/viewer/sk_app/DisplayParams.h
index b9a23f322d..8756ff0aac 100644
--- a/tools/viewer/sk_app/DisplayParams.h
+++ b/tools/viewer/sk_app/DisplayParams.h
@@ -14,14 +14,14 @@ namespace sk_app {
struct DisplayParams {
DisplayParams()
: fColorType(kN32_SkColorType)
- , fColorSpace(nullptr)
+ , fProfileType(kLinear_SkColorProfileType)
, fMSAASampleCount(0)
, fDeepColor(false) {}
- SkColorType fColorType;
- sk_sp<SkColorSpace> fColorSpace;
- int fMSAASampleCount;
- bool fDeepColor;
+ SkColorType fColorType;
+ SkColorProfileType fProfileType;
+ int fMSAASampleCount;
+ bool fDeepColor;
};
} // namespace sk_app
diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp
index b960da4824..a491321a2a 100644
--- a/tools/viewer/sk_app/GLWindowContext.cpp
+++ b/tools/viewer/sk_app/GLWindowContext.cpp
@@ -47,8 +47,8 @@ void GLWindowContext::initializeContext(void* platformData, const DisplayParams&
// ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversion on write,
// so pretend that it's non-sRGB 8888:
fPixelConfig = fContext->caps()->srgbSupport() &&
- SkColorAndColorSpaceAreGammaCorrect(fDisplayParams.fColorType,
- fDisplayParams.fColorSpace.get()) &&
+ SkColorAndProfileAreGammaCorrect(fDisplayParams.fColorType,
+ fDisplayParams.fProfileType) &&
(fColorBits != 30) ? kSkiaGamma8888_GrPixelConfig : kSkia8888_GrPixelConfig;
}
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index d892cd4783..9bcf6ca25d 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.cpp
+++ b/tools/viewer/sk_app/VulkanWindowContext.cpp
@@ -173,8 +173,7 @@ bool VulkanWindowContext::createSwapchain(uint32_t width, uint32_t height,
// Pick our surface format. For now, just make sure it matches our sRGB request:
VkFormat surfaceFormat = VK_FORMAT_UNDEFINED;
VkColorSpaceKHR colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
- auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
- bool wantSRGB = srgbColorSpace == params.fColorSpace;
+ bool wantSRGB = kSRGB_SkColorProfileType == params.fProfileType;
for (uint32_t i = 0; i < surfaceFormatCount; ++i) {
GrPixelConfig config;
if (GrVkFormatToPixelConfig(surfaceFormats[i].format, &config) &&
diff --git a/tools/viewer/sk_app/WindowContext.cpp b/tools/viewer/sk_app/WindowContext.cpp
index ecac2cc004..41bbd14576 100755
--- a/tools/viewer/sk_app/WindowContext.cpp
+++ b/tools/viewer/sk_app/WindowContext.cpp
@@ -36,7 +36,7 @@ sk_sp<SkSurface> WindowContext::createRenderSurface(sk_sp<GrRenderTarget> rt, in
SkImageInfo info = SkImageInfo::Make(fWidth, fHeight,
fDisplayParams.fColorType,
kUnknown_SkAlphaType,
- fDisplayParams.fColorSpace);
+ fDisplayParams.fProfileType);
return SkSurface::MakeRenderTarget(fContext, SkBudgeted::kNo, info,
fDisplayParams.fMSAASampleCount, &props);
} else {
@@ -52,7 +52,7 @@ void WindowContext::presentRenderSurface(sk_sp<SkSurface> renderSurface, sk_sp<G
SkImageInfo info = SkImageInfo::Make(fWidth, fHeight,
fDisplayParams.fColorType,
kUnknown_SkAlphaType,
- fDisplayParams.fColorSpace);
+ fDisplayParams.fProfileType);
SkBitmap bm;
bm.allocPixels(info);
renderSurface->getCanvas()->readPixels(&bm, 0, 0);
diff --git a/tools/viewer/sk_app/android/GLWindowContext_android.cpp b/tools/viewer/sk_app/android/GLWindowContext_android.cpp
index be62ab2b68..79425b4115 100644
--- a/tools/viewer/sk_app/android/GLWindowContext_android.cpp
+++ b/tools/viewer/sk_app/android/GLWindowContext_android.cpp
@@ -99,8 +99,7 @@ void GLWindowContext_android::onInitializeContext(void* platformData, const Disp
EGL_NONE,
};
const EGLint* windowAttribs = nullptr;
- auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
- if (srgbColorSpace == params.fColorSpace && majorVersion == 1 && minorVersion >= 2) {
+ if (kSRGB_SkColorProfileType == params.fProfileType && majorVersion == 1 && minorVersion >= 2) {
windowAttribs = srgbWindowAttribs;
}
diff --git a/tools/viewer/sk_app/android/RasterWindowContext_android.cpp b/tools/viewer/sk_app/android/RasterWindowContext_android.cpp
index a5f9a657fe..5e1e351b9a 100644
--- a/tools/viewer/sk_app/android/RasterWindowContext_android.cpp
+++ b/tools/viewer/sk_app/android/RasterWindowContext_android.cpp
@@ -68,7 +68,7 @@ sk_sp<SkSurface> RasterWindowContext_android::getBackbufferSurface() {
SkImageInfo info = SkImageInfo::Make(fWidth, fHeight,
fDisplayParams.fColorType,
kOpaque_SkAlphaType,
- fDisplayParams.fColorSpace);
+ fDisplayParams.fProfileType);
fBackbufferSurface = SkSurface::MakeRasterDirect(
info, fBuffer.bits, fBuffer.stride * bytePerPixel, nullptr);
}