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 | |
344 #if SK_SUPPORT_GPU | 338 #if SK_SUPPORT_GPU |
345 | 339 |
346 static GrTextureDomain::Mode convert_tilemodes( | 340 static GrTextureDomain::Mode convert_tilemodes( |
347 SkMatrixConvolutionImageFilter::TileMode tileMode) { | 341 SkMatrixConvolutionImageFilter::TileMode tileMode) { |
348 switch (tileMode) { | 342 switch (tileMode) { |
349 case SkMatrixConvolutionImageFilter::kClamp_TileMode: | 343 case SkMatrixConvolutionImageFilter::kClamp_TileMode: |
350 return GrTextureDomain::kClamp_Mode; | 344 return GrTextureDomain::kClamp_Mode; |
351 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: | 345 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: |
352 return GrTextureDomain::kRepeat_Mode; | 346 return GrTextureDomain::kRepeat_Mode; |
353 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode: | 347 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 382 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
389 } | 383 } |
390 } | 384 } |
391 str->appendf(")"); | 385 str->appendf(")"); |
392 str->appendf("gain: %f bias: %f ", fGain, fBias); | 386 str->appendf("gain: %f bias: %f ", fGain, fBias); |
393 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 387 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
394 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 388 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
395 str->append(")"); | 389 str->append(")"); |
396 } | 390 } |
397 #endif | 391 #endif |
OLD | NEW |