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

Side by Side Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture( desc)); 424 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture( desc));
425 425
426 if (!dst) { 426 if (!dst) {
427 return false; 427 return false;
428 } 428 }
429 429
430 SkVector scale = SkVector::Make(fScale, fScale); 430 SkVector scale = SkVector::Make(fScale, fScale);
431 ctx.ctm().mapVectors(&scale, 1); 431 ctx.ctm().mapVectors(&scale, 1);
432 432
433 GrPaint paint; 433 GrPaint paint;
434 // SRGBTODO: AllowSRGBInputs?
434 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem ent); 435 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem ent);
435 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset. fX), 436 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset. fX),
436 SkIntToScalar(colorOffset.fY - displacementOffset. fY)); 437 SkIntToScalar(colorOffset.fY - displacementOffset. fY));
437 438
438 paint.addColorFragmentProcessor( 439 paint.addColorFragmentProcessor(
439 GrDisplacementMapEffect::Create(fXChannelSelector, 440 GrDisplacementMapEffect::Create(fXChannelSelector,
440 fYChannelSelector, 441 fYChannelSelector,
441 scale, 442 scale,
442 displacement, 443 displacement,
443 offsetMatrix, 444 offsetMatrix,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 626 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
626 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 627 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
627 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 628 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
628 629
629 uint32_t xKey = displacementMap.xChannelSelector(); 630 uint32_t xKey = displacementMap.xChannelSelector();
630 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 631 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
631 632
632 b->add32(xKey | yKey); 633 b->add32(xKey | yKey);
633 } 634 }
634 #endif 635 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698