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 "SkMatrixConvolutionImageFilter.h" | 8 #include "SkMatrixConvolutionImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return GrTextureDomain::kDecal_Mode; | 348 return GrTextureDomain::kDecal_Mode; |
349 default: | 349 default: |
350 SkASSERT(false); | 350 SkASSERT(false); |
351 } | 351 } |
352 return GrTextureDomain::kIgnore_Mode; | 352 return GrTextureDomain::kIgnore_Mode; |
353 } | 353 } |
354 | 354 |
355 bool SkMatrixConvolutionImageFilter::asFragmentProcessor(GrFragmentProcessor** f
p, | 355 bool SkMatrixConvolutionImageFilter::asFragmentProcessor(GrFragmentProcessor** f
p, |
356 GrTexture* texture, | 356 GrTexture* texture, |
357 const SkMatrix&, | 357 const SkMatrix&, |
358 const SkIRect& bounds)
const { | 358 const SkIRect& bounds,
GrRenderTarget* dst) const { |
359 if (!fp) { | 359 if (!fp) { |
360 return fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE; | 360 return fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE; |
361 } | 361 } |
362 SkASSERT(fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE); | 362 SkASSERT(fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE); |
363 *fp = GrMatrixConvolutionEffect::Create(texture, | 363 *fp = GrMatrixConvolutionEffect::Create(texture, |
364 bounds, | 364 bounds, |
365 fKernelSize, | 365 fKernelSize, |
366 fKernel, | 366 fKernel, |
367 fGain, | 367 fGain, |
368 fBias, | 368 fBias, |
369 fKernelOffset, | 369 fKernelOffset, |
370 convert_tilemodes(fTileMode), | 370 convert_tilemodes(fTileMode), |
371 fConvolveAlpha); | 371 fConvolveAlpha, dst); |
372 return true; | 372 return true; |
373 } | 373 } |
374 #endif | 374 #endif |
375 | 375 |
376 #ifndef SK_IGNORE_TO_STRING | 376 #ifndef SK_IGNORE_TO_STRING |
377 void SkMatrixConvolutionImageFilter::toString(SkString* str) const { | 377 void SkMatrixConvolutionImageFilter::toString(SkString* str) const { |
378 str->appendf("SkMatrixConvolutionImageFilter: ("); | 378 str->appendf("SkMatrixConvolutionImageFilter: ("); |
379 str->appendf("size: (%d,%d) kernel: (", fKernelSize.width(), fKernelSize.hei
ght()); | 379 str->appendf("size: (%d,%d) kernel: (", fKernelSize.width(), fKernelSize.hei
ght()); |
380 for (int y = 0; y < fKernelSize.height(); y++) { | 380 for (int y = 0; y < fKernelSize.height(); y++) { |
381 for (int x = 0; x < fKernelSize.width(); x++) { | 381 for (int x = 0; x < fKernelSize.width(); x++) { |
382 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 382 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
383 } | 383 } |
384 } | 384 } |
385 str->appendf(")"); | 385 str->appendf(")"); |
386 str->appendf("gain: %f bias: %f ", fGain, fBias); | 386 str->appendf("gain: %f bias: %f ", fGain, fBias); |
387 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 387 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
388 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 388 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
389 str->append(")"); | 389 str->append(")"); |
390 } | 390 } |
391 #endif | 391 #endif |
OLD | NEW |