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

Unified Diff: samplecode/SampleApp.cpp

Issue 1890923003: Several fixes for fp 16 rendering: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Nicer looking clamp Created 4 years, 8 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
« no previous file with comments | « dm/DM.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index d4cf1cccb911dd6b9af34e1e4c5d924b1f8511cc..b7ba6f9580f85745e5b678399cd2eea24264a9b2 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -294,7 +294,14 @@ public:
#if SK_SUPPORT_GPU
if (IsGpuDeviceType(dType) && fCurContext) {
SkSurfaceProps props(win->getSurfaceProps());
- return SkSurface::MakeRenderTargetDirect(fCurRenderTarget, &props).release();
+ if (kRGBA_F16_SkColorType == win->info().colorType()) {
+ // Need to make an off-screen F16 surface - the current render target is
+ // (probably) the wrong format.
+ return SkSurface::MakeRenderTarget(fCurContext, SkBudgeted::kNo, win->info(),
+ fMSAASampleCount, &props).release();
+ } else {
+ return SkSurface::MakeRenderTargetDirect(fCurRenderTarget, &props).release();
+ }
}
#endif
return nullptr;
@@ -318,6 +325,16 @@ public:
bm.getPixels(),
bm.rowBytes(),
GrContext::kFlushWrites_PixelOp);
+ } else if (kRGBA_F16_SkColorType == win->info().colorType()) {
+ SkBitmap bm;
+ bm.allocPixels(win->info());
+ canvas->readPixels(&bm, 0, 0);
+ fCurRenderTarget->writePixels(0, 0, bm.width(), bm.height(),
+ SkImageInfo2GrPixelConfig(bm.info(),
+ *fCurContext->caps()),
+ bm.getPixels(),
+ bm.rowBytes(),
+ GrContext::kFlushWrites_PixelOp);
}
}
#endif
« no previous file with comments | « dm/DM.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698