| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkLightingImageFilter.h" | 8 #include "SkLightingImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
| 12 #include "SkPoint3.h" | 12 #include "SkPoint3.h" |
| 13 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
| 14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
| 15 #include "SkWriteBuffer.h" | 15 #include "SkWriteBuffer.h" |
| 16 | 16 |
| 17 #if SK_SUPPORT_GPU | 17 #if SK_SUPPORT_GPU |
| 18 #include "GrContext.h" | 18 #include "GrContext.h" |
| 19 #include "GrDrawContext.h" | 19 #include "GrDrawContext.h" |
| 20 #include "GrFragmentProcessor.h" | 20 #include "GrFragmentProcessor.h" |
| 21 #include "GrInvariantOutput.h" | 21 #include "GrInvariantOutput.h" |
| 22 #include "GrPaint.h" | 22 #include "GrPaint.h" |
| 23 #include "SkGr.h" |
| 23 #include "effects/GrSingleTextureEffect.h" | 24 #include "effects/GrSingleTextureEffect.h" |
| 24 #include "glsl/GrGLSLFragmentProcessor.h" | 25 #include "glsl/GrGLSLFragmentProcessor.h" |
| 25 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 26 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 26 #include "glsl/GrGLSLProgramDataManager.h" | 27 #include "glsl/GrGLSLProgramDataManager.h" |
| 27 #include "glsl/GrGLSLUniformHandler.h" | 28 #include "glsl/GrGLSLUniformHandler.h" |
| 28 | 29 |
| 29 class GrGLDiffuseLightingEffect; | 30 class GrGLDiffuseLightingEffect; |
| 30 class GrGLSpecularLightingEffect; | 31 class GrGLSpecularLightingEffect; |
| 31 | 32 |
| 32 // For brevity | 33 // For brevity |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 bounds); | 418 bounds); |
| 418 this->drawRect(drawContext, srcTexture, matrix, clip, left, kLeft_BoundaryMo
de, bounds); | 419 this->drawRect(drawContext, srcTexture, matrix, clip, left, kLeft_BoundaryMo
de, bounds); |
| 419 this->drawRect(drawContext, srcTexture, matrix, clip, interior, kInterior_Bo
undaryMode, | 420 this->drawRect(drawContext, srcTexture, matrix, clip, interior, kInterior_Bo
undaryMode, |
| 420 bounds); | 421 bounds); |
| 421 this->drawRect(drawContext, srcTexture, matrix, clip, right, kRight_Boundary
Mode, bounds); | 422 this->drawRect(drawContext, srcTexture, matrix, clip, right, kRight_Boundary
Mode, bounds); |
| 422 this->drawRect(drawContext, srcTexture, matrix, clip, bottomLeft, kBottomLef
t_BoundaryMode, | 423 this->drawRect(drawContext, srcTexture, matrix, clip, bottomLeft, kBottomLef
t_BoundaryMode, |
| 423 bounds); | 424 bounds); |
| 424 this->drawRect(drawContext, srcTexture, matrix, clip, bottom, kBottom_Bounda
ryMode, bounds); | 425 this->drawRect(drawContext, srcTexture, matrix, clip, bottom, kBottom_Bounda
ryMode, bounds); |
| 425 this->drawRect(drawContext, srcTexture, matrix, clip, bottomRight, | 426 this->drawRect(drawContext, srcTexture, matrix, clip, bottomRight, |
| 426 kBottomRight_BoundaryMode, bounds); | 427 kBottomRight_BoundaryMode, bounds); |
| 427 WrapTexture(dst, bounds.width(), bounds.height(), result); | 428 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); |
| 428 return true; | 429 return true; |
| 429 } | 430 } |
| 430 #endif | 431 #endif |
| 431 | 432 |
| 432 class SkDiffuseLightingImageFilter : public SkLightingImageFilterInternal { | 433 class SkDiffuseLightingImageFilter : public SkLightingImageFilterInternal { |
| 433 public: | 434 public: |
| 434 static SkImageFilter* Create(SkImageFilterLight* light, SkScalar surfaceScal
e, | 435 static SkImageFilter* Create(SkImageFilterLight* light, SkScalar surfaceScal
e, |
| 435 SkScalar kd, SkImageFilter*, | 436 SkScalar kd, SkImageFilter*, |
| 436 const CropRect*); | 437 const CropRect*); |
| 437 | 438 |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 | 2034 |
| 2034 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2035 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 2035 } | 2036 } |
| 2036 | 2037 |
| 2037 #endif | 2038 #endif |
| 2038 | 2039 |
| 2039 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2040 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 2040 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2041 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 2041 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2042 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 2042 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2043 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |