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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 bounds.fRight += fKernelSize.width() - 1; | 328 bounds.fRight += fKernelSize.width() - 1; |
329 bounds.fBottom += fKernelSize.height() - 1; | 329 bounds.fBottom += fKernelSize.height() - 1; |
330 bounds.offset(-fKernelOffset); | 330 bounds.offset(-fKernelOffset); |
331 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { | 331 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
332 return false; | 332 return false; |
333 } | 333 } |
334 *dst = bounds; | 334 *dst = bounds; |
335 return true; | 335 return true; |
336 } | 336 } |
337 | 337 |
| 338 bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const { |
| 339 // Because the kernel is applied in device-space, we have no idea what |
| 340 // pixels it will affect in object-space. |
| 341 return false; |
| 342 } |
| 343 |
338 #if SK_SUPPORT_GPU | 344 #if SK_SUPPORT_GPU |
339 | 345 |
340 static GrTextureDomain::Mode convert_tilemodes( | 346 static GrTextureDomain::Mode convert_tilemodes( |
341 SkMatrixConvolutionImageFilter::TileMode tileMode) { | 347 SkMatrixConvolutionImageFilter::TileMode tileMode) { |
342 switch (tileMode) { | 348 switch (tileMode) { |
343 case SkMatrixConvolutionImageFilter::kClamp_TileMode: | 349 case SkMatrixConvolutionImageFilter::kClamp_TileMode: |
344 return GrTextureDomain::kClamp_Mode; | 350 return GrTextureDomain::kClamp_Mode; |
345 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: | 351 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: |
346 return GrTextureDomain::kRepeat_Mode; | 352 return GrTextureDomain::kRepeat_Mode; |
347 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode: | 353 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 388 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
383 } | 389 } |
384 } | 390 } |
385 str->appendf(")"); | 391 str->appendf(")"); |
386 str->appendf("gain: %f bias: %f ", fGain, fBias); | 392 str->appendf("gain: %f bias: %f ", fGain, fBias); |
387 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 393 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
388 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 394 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
389 str->append(")"); | 395 str->append(")"); |
390 } | 396 } |
391 #endif | 397 #endif |
OLD | NEW |