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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 dst.fRight += w; | 330 dst.fRight += w; |
331 dst.fBottom += h; | 331 dst.fBottom += h; |
332 if (kReverse_MapDirection == direction) { | 332 if (kReverse_MapDirection == direction) { |
333 dst.offset(-fKernelOffset); | 333 dst.offset(-fKernelOffset); |
334 } else { | 334 } else { |
335 dst.offset(fKernelOffset - SkIPoint::Make(w, h)); | 335 dst.offset(fKernelOffset - SkIPoint::Make(w, h)); |
336 } | 336 } |
337 return dst; | 337 return dst; |
338 } | 338 } |
339 | 339 |
340 bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const { | 340 bool SkMatrixConvolutionImageFilter::affectsTransparentBlack() const { |
341 // Because the kernel is applied in device-space, we have no idea what | 341 // Because the kernel is applied in device-space, we have no idea what |
342 // pixels it will affect in object-space. | 342 // pixels it will affect in object-space. |
343 return false; | 343 return true; |
344 } | 344 } |
345 | 345 |
346 #if SK_SUPPORT_GPU | 346 #if SK_SUPPORT_GPU |
347 | 347 |
348 static GrTextureDomain::Mode convert_tilemodes( | 348 static GrTextureDomain::Mode convert_tilemodes( |
349 SkMatrixConvolutionImageFilter::TileMode tileMode) { | 349 SkMatrixConvolutionImageFilter::TileMode tileMode) { |
350 switch (tileMode) { | 350 switch (tileMode) { |
351 case SkMatrixConvolutionImageFilter::kClamp_TileMode: | 351 case SkMatrixConvolutionImageFilter::kClamp_TileMode: |
352 return GrTextureDomain::kClamp_Mode; | 352 return GrTextureDomain::kClamp_Mode; |
353 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: | 353 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 390 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
391 } | 391 } |
392 } | 392 } |
393 str->appendf(")"); | 393 str->appendf(")"); |
394 str->appendf("gain: %f bias: %f ", fGain, fBias); | 394 str->appendf("gain: %f bias: %f ", fGain, fBias); |
395 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 395 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
396 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 396 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
397 str->append(")"); | 397 str->append(")"); |
398 } | 398 } |
399 #endif | 399 #endif |
OLD | NEW |