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/WindowContext.cpp

Issue 2184273002: Remove unused sk_app::WindowContext::presentRenderSurface (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 | « tools/viewer/sk_app/WindowContext.h ('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 2015 Google Inc. 3 * Copyright 2015 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 "GrContext.h" 9 #include "GrContext.h"
10 #include "SkSurface.h" 10 #include "SkSurface.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return SkSurface::MakeRenderTarget(fContext, SkBudgeted::kNo, info, 49 return SkSurface::MakeRenderTarget(fContext, SkBudgeted::kNo, info,
50 fDisplayParams.fMSAASampleCount, &fSurfaceProps); 50 fDisplayParams.fMSAASampleCount, &fSurfaceProps);
51 } else { 51 } else {
52 return SkSurface::MakeRaster(info, &fSurfaceProps); 52 return SkSurface::MakeRaster(info, &fSurfaceProps);
53 } 53 }
54 } else { 54 } else {
55 return SkSurface::MakeFromBackendRenderTarget(fContext, *rtDesc, &fSurfa ceProps); 55 return SkSurface::MakeFromBackendRenderTarget(fContext, *rtDesc, &fSurfa ceProps);
56 } 56 }
57 } 57 }
58 58
59 void WindowContext::presentRenderSurface(sk_sp<SkSurface> renderSurface, sk_sp<G rRenderTarget> rt,
60 int colorBits) {
61 if (!this->isGpuContext() || colorBits > 24 ||
62 kRGBA_F16_SkColorType == fDisplayParams.fColorType) {
63 // We made/have an off-screen surface. Get the contents as an SkImage:
64 SkImageInfo info = SkImageInfo::Make(fWidth, fHeight,
65 fDisplayParams.fColorType,
66 kUnknown_SkAlphaType,
67 fDisplayParams.fColorSpace);
68 SkBitmap bm;
69 bm.allocPixels(info);
70 renderSurface->getCanvas()->readPixels(&bm, 0, 0);
71 SkPixmap pm;
72 bm.peekPixels(&pm);
73 sk_sp<SkImage> image(SkImage::MakeTextureFromPixmap(fContext, pm,
74 SkBudgeted::kNo));
75 GrTexture* texture = as_IB(image)->peekTexture();
76 SkASSERT(texture);
77
78 // With ten-bit output, we need to manually apply the gamma of the outpu t device
79 // (unless we're in non-gamma correct mode, in which case our data is al ready
80 // fake-sRGB, like we're expected to put in the 10-bit buffer):
81 bool doGamma = (colorBits == 30) && SkImageInfoIsGammaCorrect(info);
82 fContext->applyGamma(rt.get(), texture, doGamma ? 1.0f / 2.2f : 1.0f);
83 }
84 }
85
86 } //namespace sk_app 59 } //namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/WindowContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698