| OLD | NEW |
| 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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
| 9 #include "GrGLProgramEffects.h" | 9 #include "GrGLProgramEffects.h" |
| 10 #include "GrDrawEffect.h" | 10 #include "GrDrawEffect.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if (GrGpu::IsPathRenderingDrawType(drawType)) { | 380 if (GrGpu::IsPathRenderingDrawType(drawType)) { |
| 381 this->setPathTransformData(gpu, programDataManager, drawEffect, e); | 381 this->setPathTransformData(gpu, programDataManager, drawEffect, e); |
| 382 } else { | 382 } else { |
| 383 this->setTransformData(gpu, programDataManager, drawEffect, e); | 383 this->setTransformData(gpu, programDataManager, drawEffect, e); |
| 384 } | 384 } |
| 385 | 385 |
| 386 this->bindTextures(gpu, drawEffect.effect(), e); | 386 this->bindTextures(gpu, drawEffect.effect(), e); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 void GrGLVertexProgramEffects::setData(GrGpuGL* gpu, |
| 391 GrGpu::DrawType drawType, |
| 392 const GrGLProgramDataManager& programData
Manager, |
| 393 const GrEffectStage* effectStage) { |
| 394 SkASSERT(1 == fTransforms.count()); |
| 395 SkASSERT(1 == fSamplers.count()); |
| 396 SkASSERT(1 == fGLEffects.count()); |
| 397 GrDrawEffect drawEffect(*effectStage, fHasExplicitLocalCoords); |
| 398 fGLEffects[0]->setData(programDataManager, drawEffect); |
| 399 if (GrGpu::IsPathRenderingDrawType(drawType)) { |
| 400 this->setPathTransformData(gpu, programDataManager, drawEffect, 0); |
| 401 } else { |
| 402 this->setTransformData(gpu, programDataManager, drawEffect, 0); |
| 403 } |
| 404 |
| 405 this->bindTextures(gpu, drawEffect.effect(), 0); |
| 406 } |
| 407 |
| 390 void GrGLVertexProgramEffects::setTransformData(GrGpuGL* gpu, | 408 void GrGLVertexProgramEffects::setTransformData(GrGpuGL* gpu, |
| 391 const GrGLProgramDataManager& pd
man, | 409 const GrGLProgramDataManager& pd
man, |
| 392 const GrDrawEffect& drawEffect, | 410 const GrDrawEffect& drawEffect, |
| 393 int effectIdx) { | 411 int effectIdx) { |
| 394 SkTArray<Transform, true>& transforms = fTransforms[effectIdx]; | 412 SkTArray<Transform, true>& transforms = fTransforms[effectIdx]; |
| 395 int numTransforms = transforms.count(); | 413 int numTransforms = transforms.count(); |
| 396 SkASSERT(numTransforms == drawEffect.effect()->numTransforms()); | 414 SkASSERT(numTransforms == drawEffect.effect()->numTransforms()); |
| 397 for (int t = 0; t < numTransforms; ++t) { | 415 for (int t = 0; t < numTransforms; ++t) { |
| 398 SkASSERT(transforms[t].fHandle.isValid()); | 416 SkASSERT(transforms[t].fHandle.isValid()); |
| 399 const SkMatrix& matrix = get_transform_matrix(drawEffect, t); | 417 const SkMatrix& matrix = get_transform_matrix(drawEffect, t); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 } | 567 } |
| 550 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, | 568 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, |
| 551 const GrEffectKey& key, | 569 const GrEffectKey& key, |
| 552 const char* outColor, | 570 const char* outColor, |
| 553 const char* inColor, | 571 const char* inColor, |
| 554 int stageIndex) { | 572 int stageIndex) { |
| 555 SkASSERT(NULL != fProgramEffects.get()); | 573 SkASSERT(NULL != fProgramEffects.get()); |
| 556 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); | 574 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); |
| 557 } | 575 } |
| 558 | 576 |
| OLD | NEW |