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

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

Issue 648463003: FPs now use the correct builder types(just a rename) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 typedef Gr1DKernelEffect INHERITED; 326 typedef Gr1DKernelEffect INHERITED;
327 }; 327 };
328 328
329 /////////////////////////////////////////////////////////////////////////////// 329 ///////////////////////////////////////////////////////////////////////////////
330 330
331 class GrGLMorphologyEffect : public GrGLFragmentProcessor { 331 class GrGLMorphologyEffect : public GrGLFragmentProcessor {
332 public: 332 public:
333 GrGLMorphologyEffect (const GrBackendProcessorFactory&, const GrProcessor&); 333 GrGLMorphologyEffect (const GrBackendProcessorFactory&, const GrProcessor&);
334 334
335 virtual void emitCode(GrGLProgramBuilder*, 335 virtual void emitCode(GrGLFPBuilder*,
336 const GrFragmentProcessor&, 336 const GrFragmentProcessor&,
337 const GrProcessorKey&, 337 const GrProcessorKey&,
338 const char* outputColor, 338 const char* outputColor,
339 const char* inputColor, 339 const char* inputColor,
340 const TransformedCoordsArray&, 340 const TransformedCoordsArray&,
341 const TextureSamplerArray&) SK_OVERRIDE; 341 const TextureSamplerArray&) SK_OVERRIDE;
342 342
343 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe yBuilder* b); 343 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe yBuilder* b);
344 344
345 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE; 345 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE;
346 346
347 private: 347 private:
348 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } 348 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); }
349 349
350 int fRadius; 350 int fRadius;
351 GrMorphologyEffect::MorphologyType fType; 351 GrMorphologyEffect::MorphologyType fType;
352 GrGLProgramDataManager::UniformHandle fImageIncrementUni; 352 GrGLProgramDataManager::UniformHandle fImageIncrementUni;
353 353
354 typedef GrGLFragmentProcessor INHERITED; 354 typedef GrGLFragmentProcessor INHERITED;
355 }; 355 };
356 356
357 GrGLMorphologyEffect::GrGLMorphologyEffect(const GrBackendProcessorFactory& fact ory, 357 GrGLMorphologyEffect::GrGLMorphologyEffect(const GrBackendProcessorFactory& fact ory,
358 const GrProcessor& proc) 358 const GrProcessor& proc)
359 : INHERITED(factory) { 359 : INHERITED(factory) {
360 const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>(); 360 const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
361 fRadius = m.radius(); 361 fRadius = m.radius();
362 fType = m.type(); 362 fType = m.type();
363 } 363 }
364 364
365 void GrGLMorphologyEffect::emitCode(GrGLProgramBuilder* builder, 365 void GrGLMorphologyEffect::emitCode(GrGLFPBuilder* builder,
366 const GrFragmentProcessor&, 366 const GrFragmentProcessor&,
367 const GrProcessorKey& key, 367 const GrProcessorKey& key,
368 const char* outputColor, 368 const char* outputColor,
369 const char* inputColor, 369 const char* inputColor,
370 const TransformedCoordsArray& coords, 370 const TransformedCoordsArray& coords,
371 const TextureSamplerArray& samplers) { 371 const TextureSamplerArray& samplers) {
372 fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility, 372 fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility,
373 kVec2f_GrSLType, "ImageIncrement"); 373 kVec2f_GrSLType, "ImageIncrement");
374 374
375 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 375 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
376 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 376 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
377 const char* func; 377 const char* func;
378 switch (fType) { 378 switch (fType) {
379 case GrMorphologyEffect::kErode_MorphologyType: 379 case GrMorphologyEffect::kErode_MorphologyType:
380 fsBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", outputColor); 380 fsBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", outputColor);
381 func = "min"; 381 func = "min";
382 break; 382 break;
383 case GrMorphologyEffect::kDilate_MorphologyType: 383 case GrMorphologyEffect::kDilate_MorphologyType:
384 fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor); 384 fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor);
385 func = "max"; 385 func = "max";
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 SkBitmap* result, SkIPoint* offset) con st { 604 SkBitmap* result, SkIPoint* offset) con st {
605 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 605 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
606 } 606 }
607 607
608 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 608 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
609 SkBitmap* result, SkIPoint* offset) cons t { 609 SkBitmap* result, SkIPoint* offset) cons t {
610 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 610 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
611 } 611 }
612 612
613 #endif 613 #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