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

Side by Side Diff: src/image/SkSurface_Gpu.cpp

Issue 2176383002: start on apply gamma cleanup (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « src/image/SkSurface_Gpu.h ('k') | tools/viewer/sk_app/WindowContext.cpp » ('j') | 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 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "SkSurface_Gpu.h" 8 #include "SkSurface_Gpu.h"
9 9
10 #include "GrResourceProvider.h" 10 #include "GrResourceProvider.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 void SkSurface_Gpu::onDiscard() { 124 void SkSurface_Gpu::onDiscard() {
125 fDevice->accessDrawContext()->discard(); 125 fDevice->accessDrawContext()->discard();
126 } 126 }
127 127
128 void SkSurface_Gpu::onPrepareForExternalIO() { 128 void SkSurface_Gpu::onPrepareForExternalIO() {
129 fDevice->flush(); 129 fDevice->flush();
130 } 130 }
131 131
132 bool SkSurface_Gpu::onBlitWithGamma(SkImage* image, SkScalar gamma) {
133 GrRenderTarget* dst = fDevice->accessDrawContext()->accessRenderTarget();
134 if (GrTexture* src = as_IB(image)->asTextureRef(dst->getContext(),
135 GrTextureParams::ClampNoFilt er(),
136 SkSourceGammaTreatment::kRes pect)) {
137 fDevice.get()->context()->applyGamma(dst, src, gamma);
138 return true;
139 }
140 return false;
141 }
142
132 /////////////////////////////////////////////////////////////////////////////// 143 ///////////////////////////////////////////////////////////////////////////////
133 144
134 sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget* target, 145 sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget* target,
135 sk_sp<SkColorSpace> colorSpac e, 146 sk_sp<SkColorSpace> colorSpac e,
136 const SkSurfaceProps* props) { 147 const SkSurfaceProps* props) {
137 sk_sp<SkGpuDevice> device( 148 sk_sp<SkGpuDevice> device(
138 SkGpuDevice::Make(sk_ref_sp(target), std::move(colorSpace), props, 149 SkGpuDevice::Make(sk_ref_sp(target), std::move(colorSpace), props,
139 SkGpuDevice::kUninit_InitContents)); 150 SkGpuDevice::kUninit_InitContents));
140 if (!device) { 151 if (!device) {
141 return nullptr; 152 return nullptr;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 221 }
211 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), std::move(colorSp ace), props, 222 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), std::move(colorSp ace), props,
212 SkGpuDevice::kUninit_InitContent s)); 223 SkGpuDevice::kUninit_InitContent s));
213 if (!device) { 224 if (!device) {
214 return nullptr; 225 return nullptr;
215 } 226 }
216 return sk_make_sp<SkSurface_Gpu>(std::move(device)); 227 return sk_make_sp<SkSurface_Gpu>(std::move(device));
217 } 228 }
218 229
219 #endif 230 #endif
OLDNEW
« no previous file with comments | « src/image/SkSurface_Gpu.h ('k') | tools/viewer/sk_app/WindowContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698