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

Side by Side Diff: src/core/SkLightingShader.cpp

Issue 1347943003: Replace GrExtractAlphaFragmentProcessor with DstIn compose processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update comment Created 5 years, 3 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 | « src/core/SkBitmapProcShader.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | 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 "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 typedef SkShader INHERITED; 124 typedef SkShader INHERITED;
125 }; 125 };
126 126
127 //////////////////////////////////////////////////////////////////////////// 127 ////////////////////////////////////////////////////////////////////////////
128 128
129 #if SK_SUPPORT_GPU 129 #if SK_SUPPORT_GPU
130 130
131 #include "GrCoordTransform.h" 131 #include "GrCoordTransform.h"
132 #include "GrFragmentProcessor.h" 132 #include "GrFragmentProcessor.h"
133 #include "GrTextureAccess.h" 133 #include "GrTextureAccess.h"
134 #include "effects/GrExtractAlphaFragmentProcessor.h"
135 #include "gl/GrGLProcessor.h" 134 #include "gl/GrGLProcessor.h"
136 #include "gl/builders/GrGLProgramBuilder.h" 135 #include "gl/builders/GrGLProgramBuilder.h"
137 #include "SkGr.h" 136 #include "SkGr.h"
138 137
139 class LightingFP : public GrFragmentProcessor { 138 class LightingFP : public GrFragmentProcessor {
140 public: 139 public:
141 LightingFP(GrProcessorDataManager* pdm, GrTexture* diffuse, GrTexture* norma l, 140 LightingFP(GrProcessorDataManager* pdm, GrTexture* diffuse, GrTexture* norma l,
142 const SkMatrix& diffMatrix, const SkMatrix& normMatrix, 141 const SkMatrix& diffMatrix, const SkMatrix& normMatrix,
143 const GrTextureParams& diffParams, const GrTextureParams& normPar ams, 142 const GrTextureParams& diffParams, const GrTextureParams& normPar ams,
144 const SkLightingShader::Lights* lights, const SkVector& invNormRo tation) 143 const SkLightingShader::Lights* lights, const SkVector& invNormRo tation)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 SkAutoTUnref<GrTexture> normalTexture(GrRefCachedBitmapTexture(context, 393 SkAutoTUnref<GrTexture> normalTexture(GrRefCachedBitmapTexture(context,
395 fNormalMap, & normParams)); 394 fNormalMap, & normParams));
396 if (!normalTexture) { 395 if (!normalTexture) {
397 SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bit map to texture."); 396 SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bit map to texture.");
398 return nullptr; 397 return nullptr;
399 } 398 }
400 399
401 SkAutoTUnref<const GrFragmentProcessor> inner ( 400 SkAutoTUnref<const GrFragmentProcessor> inner (
402 new LightingFP(pdm, diffuseTexture, normalTexture, diffM, normM, diffPar ams, normParams, 401 new LightingFP(pdm, diffuseTexture, normalTexture, diffM, normM, diffPar ams, normParams,
403 fLights, fInvNormRotation)); 402 fLights, fInvNormRotation));
404 return GrExtractAlphaFragmentProcessor::Create(inner); 403 return GrFragmentProcessor::MulOuputByInputAlpha(inner);
405 } 404 }
406 405
407 #endif 406 #endif
408 407
409 //////////////////////////////////////////////////////////////////////////// 408 ////////////////////////////////////////////////////////////////////////////
410 409
411 bool SkLightingShaderImpl::isOpaque() const { 410 bool SkLightingShaderImpl::isOpaque() const {
412 return fDiffuseMap.isOpaque(); 411 return fDiffuseMap.isOpaque();
413 } 412 }
414 413
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 normLocalM); 713 normLocalM);
715 } 714 }
716 715
717 /////////////////////////////////////////////////////////////////////////////// 716 ///////////////////////////////////////////////////////////////////////////////
718 717
719 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) 718 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader)
720 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) 719 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl)
721 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 720 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
722 721
723 /////////////////////////////////////////////////////////////////////////////// 722 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcShader.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698