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

Side by Side Diff: src/effects/SkMorphologyImageFilter.cpp

Issue 365853002: Rename GrGLUniformManager to GrGLProgramResourceManager (Closed) Base URL: https://skia.googlesource.com/skia.git@02-path-program-fragment
Patch Set: rebase Created 6 years, 4 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/effects/SkMagnifierImageFilter.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 * 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 "SkMorphologyImageFilter.h" 8 #include "SkMorphologyImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 virtual void emitCode(GrGLShaderBuilder*, 317 virtual void emitCode(GrGLShaderBuilder*,
318 const GrDrawEffect&, 318 const GrDrawEffect&,
319 const GrEffectKey&, 319 const GrEffectKey&,
320 const char* outputColor, 320 const char* outputColor,
321 const char* inputColor, 321 const char* inputColor,
322 const TransformedCoordsArray&, 322 const TransformedCoordsArray&,
323 const TextureSamplerArray&) SK_OVERRIDE; 323 const TextureSamplerArray&) SK_OVERRIDE;
324 324
325 static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyB uilder* b); 325 static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyB uilder* b);
326 326
327 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE; 327 virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_ OVERRIDE;
328 328
329 private: 329 private:
330 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } 330 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); }
331 331
332 int fRadius; 332 int fRadius;
333 GrMorphologyEffect::MorphologyType fType; 333 GrMorphologyEffect::MorphologyType fType;
334 GrGLUniformManager::UniformHandle fImageIncrementUni; 334 GrGLProgramDataManager::UniformHandle fImageIncrementUni;
335 335
336 typedef GrGLEffect INHERITED; 336 typedef GrGLEffect INHERITED;
337 }; 337 };
338 338
339 GrGLMorphologyEffect::GrGLMorphologyEffect(const GrBackendEffectFactory& factory , 339 GrGLMorphologyEffect::GrGLMorphologyEffect(const GrBackendEffectFactory& factory ,
340 const GrDrawEffect& drawEffect) 340 const GrDrawEffect& drawEffect)
341 : INHERITED(factory) { 341 : INHERITED(factory) {
342 const GrMorphologyEffect& m = drawEffect.castEffect<GrMorphologyEffect>(); 342 const GrMorphologyEffect& m = drawEffect.castEffect<GrMorphologyEffect>();
343 fRadius = m.radius(); 343 fRadius = m.radius();
344 fType = m.type(); 344 fType = m.type();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 385 }
386 386
387 void GrGLMorphologyEffect::GenKey(const GrDrawEffect& drawEffect, 387 void GrGLMorphologyEffect::GenKey(const GrDrawEffect& drawEffect,
388 const GrGLCaps&, GrEffectKeyBuilder* b) { 388 const GrGLCaps&, GrEffectKeyBuilder* b) {
389 const GrMorphologyEffect& m = drawEffect.castEffect<GrMorphologyEffect>(); 389 const GrMorphologyEffect& m = drawEffect.castEffect<GrMorphologyEffect>();
390 uint32_t key = static_cast<uint32_t>(m.radius()); 390 uint32_t key = static_cast<uint32_t>(m.radius());
391 key |= (m.type() << 8); 391 key |= (m.type() << 8);
392 b->add32(key); 392 b->add32(key);
393 } 393 }
394 394
395 void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman, 395 void GrGLMorphologyEffect::setData(const GrGLProgramDataManager& pdman,
396 const GrDrawEffect& drawEffect) { 396 const GrDrawEffect& drawEffect) {
397 const Gr1DKernelEffect& kern = drawEffect.castEffect<Gr1DKernelEffect>(); 397 const Gr1DKernelEffect& kern = drawEffect.castEffect<Gr1DKernelEffect>();
398 GrTexture& texture = *kern.texture(0); 398 GrTexture& texture = *kern.texture(0);
399 // the code we generated was for a specific kernel radius 399 // the code we generated was for a specific kernel radius
400 SkASSERT(kern.radius() == fRadius); 400 SkASSERT(kern.radius() == fRadius);
401 float imageIncrement[2] = { 0 }; 401 float imageIncrement[2] = { 0 };
402 switch (kern.direction()) { 402 switch (kern.direction()) {
403 case Gr1DKernelEffect::kX_Direction: 403 case Gr1DKernelEffect::kX_Direction:
404 imageIncrement[0] = 1.0f / texture.width(); 404 imageIncrement[0] = 1.0f / texture.width();
405 break; 405 break;
406 case Gr1DKernelEffect::kY_Direction: 406 case Gr1DKernelEffect::kY_Direction:
407 imageIncrement[1] = 1.0f / texture.height(); 407 imageIncrement[1] = 1.0f / texture.height();
408 break; 408 break;
409 default: 409 default:
410 SkFAIL("Unknown filter direction."); 410 SkFAIL("Unknown filter direction.");
411 } 411 }
412 uman.set2fv(fImageIncrementUni, 1, imageIncrement); 412 pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
413 } 413 }
414 414
415 /////////////////////////////////////////////////////////////////////////////// 415 ///////////////////////////////////////////////////////////////////////////////
416 416
417 GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture, 417 GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture,
418 Direction direction, 418 Direction direction,
419 int radius, 419 int radius,
420 MorphologyType type) 420 MorphologyType type)
421 : Gr1DKernelEffect(texture, direction, radius) 421 : Gr1DKernelEffect(texture, direction, radius)
422 , fType(type) { 422 , fType(type) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 SkBitmap* result, SkIPoint* offset) con st { 578 SkBitmap* result, SkIPoint* offset) con st {
579 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 579 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
580 } 580 }
581 581
582 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 582 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
583 SkBitmap* result, SkIPoint* offset) cons t { 583 SkBitmap* result, SkIPoint* offset) cons t {
584 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 584 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
585 } 585 }
586 586
587 #endif 587 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698