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

Unified Diff: tests/ApplyGammaTest.cpp

Issue 2191323002: Remove GrContext::applyGamma (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix flushing in publishCanvas 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 | « src/gpu/GrContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ApplyGammaTest.cpp
diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp
index 8db8fe09f65f4a6de7f7e6fc241a6e638a211f47..6e6e23a9aeed47baa082259cd7baca50c1714760 100644
--- a/tests/ApplyGammaTest.cpp
+++ b/tests/ApplyGammaTest.cpp
@@ -10,11 +10,9 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
-#include "GrTexture.h"
-#include "GrTextureProvider.h"
#include "SkCanvas.h"
+#include "SkGammaColorFilter.h"
#include "SkPixmap.h"
#include "SkSurface.h"
#include "SkUtils.h"
@@ -113,20 +111,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) {
dstCanvas->clear(SK_ColorRED);
dstCanvas->flush();
- // Temporary code until applyGamma is replaced
- GrDrawContext* dc = dstCanvas->internal_private_accessTopLayerDrawContext();
- GrRenderTarget* rt = dc->accessRenderTarget();
- GrTexture* texture = src->getTexture();
- SkASSERT(texture);
+ SkPaint gammaPaint;
+ gammaPaint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ gammaPaint.setColorFilter(SkGammaColorFilter::Make(gamma));
- bool result = context->applyGamma(rt, texture, gamma);
-
- // To make the copied src rect correct we would apply any dst clipping
- // back to the src rect, but we don't use it again so don't bother.
- if (!result) {
- ERRORF(reporter, "Unexpected failure from applyGamma.");
- continue;
- }
+ dstCanvas->drawImage(src, 0, 0, &gammaPaint);
+ dstCanvas->flush();
sk_memset32(read.get(), 0, kW * kH);
if (!dstCanvas->readPixels(ii, read.get(), kRowBytes, 0, 0)) {
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698