| 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 "SkDisplacementMapEffect.h" | 8 #include "SkDisplacementMapEffect.h" |
| 9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
| 10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 class GrGLDisplacementMapEffect : public GrGLFragmentProcessor { | 302 class GrGLDisplacementMapEffect : public GrGLFragmentProcessor { |
| 303 public: | 303 public: |
| 304 GrGLDisplacementMapEffect(const GrProcessor&); | 304 GrGLDisplacementMapEffect(const GrProcessor&); |
| 305 virtual ~GrGLDisplacementMapEffect(); | 305 virtual ~GrGLDisplacementMapEffect(); |
| 306 | 306 |
| 307 virtual void emitCode(GrGLFPBuilder*, | 307 virtual void emitCode(GrGLFPBuilder*, |
| 308 const GrFragmentProcessor&, | 308 const GrFragmentProcessor&, |
| 309 const char* outputColor, | 309 const char* outputColor, |
| 310 const char* inputColor, | 310 const char* inputColor, |
| 311 const TransformedCoordsArray&, | 311 const TransformedCoordsArray&, |
| 312 const TextureSamplerArray&) SK_OVERRIDE; | 312 const TextureSamplerArray&) override; |
| 313 | 313 |
| 314 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 314 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
| 315 | 315 |
| 316 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; | 316 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
| 317 | 317 |
| 318 private: | 318 private: |
| 319 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; | 319 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; |
| 320 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; | 320 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; |
| 321 GrGLProgramDataManager::UniformHandle fScaleUni; | 321 GrGLProgramDataManager::UniformHandle fScaleUni; |
| 322 | 322 |
| 323 typedef GrGLFragmentProcessor INHERITED; | 323 typedef GrGLFragmentProcessor INHERITED; |
| 324 }; | 324 }; |
| 325 | 325 |
| 326 /////////////////////////////////////////////////////////////////////////////// | 326 /////////////////////////////////////////////////////////////////////////////// |
| 327 | 327 |
| 328 class GrDisplacementMapEffect : public GrFragmentProcessor { | 328 class GrDisplacementMapEffect : public GrFragmentProcessor { |
| 329 public: | 329 public: |
| 330 static GrFragmentProcessor* Create( | 330 static GrFragmentProcessor* Create( |
| 331 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, | 331 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, |
| 332 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVec
tor scale, | 332 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVec
tor scale, |
| 333 GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* co
lor) { | 333 GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* co
lor) { |
| 334 return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector, | 334 return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector, |
| 335 yChannelSelector, | 335 yChannelSelector, |
| 336 scale, | 336 scale, |
| 337 displacement, | 337 displacement, |
| 338 offsetMatrix, | 338 offsetMatrix, |
| 339 color)); | 339 color)); |
| 340 } | 340 } |
| 341 | 341 |
| 342 virtual ~GrDisplacementMapEffect(); | 342 virtual ~GrDisplacementMapEffect(); |
| 343 | 343 |
| 344 virtual void getGLProcessorKey(const GrGLCaps& caps, | 344 virtual void getGLProcessorKey(const GrGLCaps& caps, |
| 345 GrProcessorKeyBuilder* b) const SK_OVERRIDE { | 345 GrProcessorKeyBuilder* b) const override { |
| 346 GrGLDisplacementMapEffect::GenKey(*this, caps, b); | 346 GrGLDisplacementMapEffect::GenKey(*this, caps, b); |
| 347 } | 347 } |
| 348 | 348 |
| 349 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { | 349 GrGLFragmentProcessor* createGLInstance() const override { |
| 350 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this)); | 350 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this)); |
| 351 } | 351 } |
| 352 | 352 |
| 353 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const | 353 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const |
| 354 { return fXChannelSelector; } | 354 { return fXChannelSelector; } |
| 355 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const | 355 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const |
| 356 { return fYChannelSelector; } | 356 { return fYChannelSelector; } |
| 357 const SkVector& scale() const { return fScale; } | 357 const SkVector& scale() const { return fScale; } |
| 358 | 358 |
| 359 const char* name() const SK_OVERRIDE { return "DisplacementMap"; } | 359 const char* name() const override { return "DisplacementMap"; } |
| 360 | 360 |
| 361 private: | 361 private: |
| 362 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 362 bool onIsEqual(const GrFragmentProcessor&) const override; |
| 363 | 363 |
| 364 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; | 364 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
| 365 | 365 |
| 366 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, | 366 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, |
| 367 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, | 367 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, |
| 368 const SkVector& scale, | 368 const SkVector& scale, |
| 369 GrTexture* displacement, const SkMatrix& offsetMatri
x, | 369 GrTexture* displacement, const SkMatrix& offsetMatri
x, |
| 370 GrTexture* color); | 370 GrTexture* color); |
| 371 | 371 |
| 372 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 372 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 373 | 373 |
| 374 GrCoordTransform fDisplacementTransform; | 374 GrCoordTransform fDisplacementTransform; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 630 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
| 631 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 631 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 632 | 632 |
| 633 uint32_t xKey = displacementMap.xChannelSelector(); | 633 uint32_t xKey = displacementMap.xChannelSelector(); |
| 634 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 634 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 635 | 635 |
| 636 b->add32(xKey | yKey); | 636 b->add32(xKey | yKey); |
| 637 } | 637 } |
| 638 #endif | 638 #endif |
| 639 | 639 |
| OLD | NEW |