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

Unified Diff: samplecode/SampleApp.cpp

Issue 2191323002: Remove GrContext::applyGamma (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 4 years, 5 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 | « include/gpu/GrContext.h ('k') | src/gpu/GrContext.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 0c9c3f0276d6005cfb4345051b77f845c00f2f68..804cf7a35484d9ecdbb9cbdd4ad9808896780ed6 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -15,6 +15,7 @@
#include "SkCommandLineFlags.h"
#include "SkData.h"
#include "SkDocument.h"
+#include "SkGammaColorFilter.h"
#include "SkGraphics.h"
#include "SkImage_Base.h"
#include "SkImageEncoder.h"
@@ -36,8 +37,6 @@
#if SK_SUPPORT_GPU
# include "gl/GrGLInterface.h"
# include "gl/GrGLUtil.h"
-# include "GrDrawContext.h"
-# include "GrRenderTarget.h"
# include "GrContext.h"
# include "SkGr.h"
# if SK_ANGLE
@@ -335,17 +334,19 @@ public:
SkCanvas* canvas = fGpuSurface->getCanvas();
- // Temporary code until applyGamma is replaced
- GrDrawContext* dc = canvas->internal_private_accessTopLayerDrawContext();
- GrRenderTarget* rt = dc->accessRenderTarget();
- GrTexture* texture = image->getTexture();
- SkASSERT(texture);
-
// With ten-bit output, we need to manually apply the gamma of the output device
// (unless we're in non-gamma correct mode, in which case our data is already
// fake-sRGB, like we're expected to put in the 10-bit buffer):
bool doGamma = (fActualColorBits == 30) && SkImageInfoIsGammaCorrect(win->info());
- fCurContext->applyGamma(rt, texture, doGamma ? 1.0f / 2.2f : 1.0f);
+
+ SkPaint gammaPaint;
+ gammaPaint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ if (doGamma) {
+ gammaPaint.setColorFilter(SkGammaColorFilter::Make(1.0f / 2.2f));
+ }
+
+ canvas->drawImage(image, 0, 0, &gammaPaint);
+ canvas->flush();
bsalomon 2016/07/29 14:15:07 Move this canvas->flush() above win->present() at
robertphillips 2016/07/29 14:39:28 Done.
}
#endif
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698