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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 virtual void emitCode(GrGLFPBuilder*, | 308 virtual void emitCode(GrGLFPBuilder*, |
309 const GrFragmentProcessor&, | 309 const GrFragmentProcessor&, |
310 const char* outputColor, | 310 const char* outputColor, |
311 const char* inputColor, | 311 const char* inputColor, |
312 const TransformedCoordsArray&, | 312 const TransformedCoordsArray&, |
313 const TextureSamplerArray&) SK_OVERRIDE; | 313 const TextureSamplerArray&) SK_OVERRIDE; |
314 | 314 |
315 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 315 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
316 | 316 |
317 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 317 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; |
318 | 318 |
319 private: | 319 private: |
320 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; | 320 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; |
321 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; | 321 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; |
322 GrGLProgramDataManager::UniformHandle fScaleUni; | 322 GrGLProgramDataManager::UniformHandle fScaleUni; |
323 | 323 |
324 typedef GrGLFragmentProcessor INHERITED; | 324 typedef GrGLFragmentProcessor INHERITED; |
325 }; | 325 }; |
326 | 326 |
327 /////////////////////////////////////////////////////////////////////////////// | 327 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 12 matching lines...) Expand all Loading... |
340 color)); | 340 color)); |
341 } | 341 } |
342 | 342 |
343 virtual ~GrDisplacementMapEffect(); | 343 virtual ~GrDisplacementMapEffect(); |
344 | 344 |
345 virtual void getGLProcessorKey(const GrGLCaps& caps, | 345 virtual void getGLProcessorKey(const GrGLCaps& caps, |
346 GrProcessorKeyBuilder* b) const SK_OVERRIDE { | 346 GrProcessorKeyBuilder* b) const SK_OVERRIDE { |
347 GrGLDisplacementMapEffect::GenKey(*this, caps, b); | 347 GrGLDisplacementMapEffect::GenKey(*this, caps, b); |
348 } | 348 } |
349 | 349 |
350 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { | 350 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { |
351 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this)); | 351 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this)); |
352 } | 352 } |
353 | 353 |
354 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const | 354 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const |
355 { return fXChannelSelector; } | 355 { return fXChannelSelector; } |
356 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const | 356 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const |
357 { return fYChannelSelector; } | 357 { return fYChannelSelector; } |
358 const SkVector& scale() const { return fScale; } | 358 const SkVector& scale() const { return fScale; } |
359 | 359 |
360 virtual const char* name() const SK_OVERRIDE { return "DisplacementMap"; } | 360 const char* name() const SK_OVERRIDE { return "DisplacementMap"; } |
361 | 361 |
362 private: | 362 private: |
363 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 363 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
364 | 364 |
365 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; | 365 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; |
366 | 366 |
367 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, | 367 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, |
368 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, | 368 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, |
369 const SkVector& scale, | 369 const SkVector& scale, |
370 GrTexture* displacement, const SkMatrix& offsetMatri
x, | 370 GrTexture* displacement, const SkMatrix& offsetMatri
x, |
371 GrTexture* color); | 371 GrTexture* color); |
372 | 372 |
373 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 373 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
374 | 374 |
375 GrCoordTransform fDisplacementTransform; | 375 GrCoordTransform fDisplacementTransform; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 632 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
633 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 633 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
634 | 634 |
635 uint32_t xKey = displacementMap.xChannelSelector(); | 635 uint32_t xKey = displacementMap.xChannelSelector(); |
636 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 636 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
637 | 637 |
638 b->add32(xKey | yKey); | 638 b->add32(xKey | yKey); |
639 } | 639 } |
640 #endif | 640 #endif |
641 | 641 |
OLD | NEW |