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

Side by Side Diff: tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « tools/sk_tool_utils.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 /* 2 /*
3 * Copyright 2016 Google Inc. 3 * Copyright 2016 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "../GLWindowContext.h" 9 #include "../GLWindowContext.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // We made/have an off-screen surface. Get the contents as an SkImage: 114 // We made/have an off-screen surface. Get the contents as an SkImage:
115 sk_sp<SkImage> snapshot = fBackbufferSurface->makeImageSnapshot(); 115 sk_sp<SkImage> snapshot = fBackbufferSurface->makeImageSnapshot();
116 116
117 // With ten-bit output, we need to manually apply the gamma of the outpu t device 117 // With ten-bit output, we need to manually apply the gamma of the outpu t device
118 // (unless we're in non-gamma correct mode, in which case our data is al ready 118 // (unless we're in non-gamma correct mode, in which case our data is al ready
119 // fake-sRGB, like we're expected to put in the 10-bit buffer): 119 // fake-sRGB, like we're expected to put in the 10-bit buffer):
120 bool doGamma = (fActualColorBits == 30) && 120 bool doGamma = (fActualColorBits == 30) &&
121 (fDisplayParams.fColorSpace != nullptr || 121 (fDisplayParams.fColorSpace != nullptr ||
122 kRGBA_F16_SkColorType == fDisplayParams.fColorType); 122 kRGBA_F16_SkColorType == fDisplayParams.fColorType);
123 SkPaint gammaPaint; 123 SkPaint gammaPaint;
124 gammaPaint.setXfermodeMode(SkXfermode::kSrc_Mode); 124 gammaPaint.setBlendMode(SkBlendMode::kSrc);
125 if (doGamma) { 125 if (doGamma) {
126 gammaPaint.setColorFilter(SkGammaColorFilter::Make(1.0f / 2.2f)); 126 gammaPaint.setColorFilter(SkGammaColorFilter::Make(1.0f / 2.2f));
127 } 127 }
128 128
129 sk_sp<SkSurface> gpuSurface = INHERITED::getBackbufferSurface(); 129 sk_sp<SkSurface> gpuSurface = INHERITED::getBackbufferSurface();
130 SkCanvas* gpuCanvas = gpuSurface->getCanvas(); 130 SkCanvas* gpuCanvas = gpuSurface->getCanvas();
131 gpuCanvas->drawImage(snapshot, 0, 0, &gammaPaint); 131 gpuCanvas->drawImage(snapshot, 0, 0, &gammaPaint);
132 gpuCanvas->flush(); 132 gpuCanvas->flush();
133 133
134 SDL_GL_SwapWindow(fWindow); 134 SDL_GL_SwapWindow(fWindow);
135 } 135 }
136 } 136 }
137 137
138 } // anonymous namespace 138 } // anonymous namespace
139 139
140 namespace sk_app { 140 namespace sk_app {
141 namespace window_context_factory { 141 namespace window_context_factory {
142 142
143 WindowContext* NewRasterForMac(const MacWindowInfo& info, const DisplayParams& p arams) { 143 WindowContext* NewRasterForMac(const MacWindowInfo& info, const DisplayParams& p arams) {
144 WindowContext* ctx = new RasterWindowContext_mac(info, params); 144 WindowContext* ctx = new RasterWindowContext_mac(info, params);
145 if (!ctx->isValid()) { 145 if (!ctx->isValid()) {
146 delete ctx; 146 delete ctx;
147 return nullptr; 147 return nullptr;
148 } 148 }
149 return ctx; 149 return ctx;
150 } 150 }
151 151
152 } // namespace window_context_factory 152 } // namespace window_context_factory
153 } // namespace sk_app 153 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/sk_tool_utils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698