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 "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 GrMorphologyEffect::MorphologyType morphType, | 394 GrMorphologyEffect::MorphologyType morphType, |
395 float bounds[2], | 395 float bounds[2], |
396 Gr1DKernelEffect::Direction direction) { | 396 Gr1DKernelEffect::Direction direction) { |
397 GrPaint paint; | 397 GrPaint paint; |
398 paint.setGammaCorrect(drawContext->isGammaCorrect()); | 398 paint.setGammaCorrect(drawContext->isGammaCorrect()); |
399 paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture, | 399 paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture, |
400 direction, | 400 direction, |
401 radius, | 401 radius, |
402 morphType, | 402 morphType, |
403 bounds)); | 403 bounds)); |
404 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 404 paint.setPorterDuffXPFactory(SkBlendMode::kSrc); |
405 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), | 405 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), |
406 SkRect::Make(srcRect)); | 406 SkRect::Make(srcRect)); |
407 } | 407 } |
408 | 408 |
409 static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext, | 409 static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext, |
410 const GrClip& clip, | 410 const GrClip& clip, |
411 GrTexture* texture, | 411 GrTexture* texture, |
412 const SkIRect& srcRect, | 412 const SkIRect& srcRect, |
413 const SkIRect& dstRect, | 413 const SkIRect& dstRect, |
414 int radius, | 414 int radius, |
415 GrMorphologyEffect::MorphologyType m
orphType, | 415 GrMorphologyEffect::MorphologyType m
orphType, |
416 Gr1DKernelEffect::Direction directio
n) { | 416 Gr1DKernelEffect::Direction directio
n) { |
417 GrPaint paint; | 417 GrPaint paint; |
418 paint.setGammaCorrect(drawContext->isGammaCorrect()); | 418 paint.setGammaCorrect(drawContext->isGammaCorrect()); |
419 paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture, direction,
radius, | 419 paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture, direction,
radius, |
420 morphType)); | 420 morphType)); |
421 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 421 paint.setPorterDuffXPFactory(SkBlendMode::kSrc); |
422 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), | 422 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), |
423 SkRect::Make(srcRect)); | 423 SkRect::Make(srcRect)); |
424 } | 424 } |
425 | 425 |
426 static void apply_morphology_pass(GrDrawContext* drawContext, | 426 static void apply_morphology_pass(GrDrawContext* drawContext, |
427 const GrClip& clip, | 427 const GrClip& clip, |
428 GrTexture* texture, | 428 GrTexture* texture, |
429 const SkIRect& srcRect, | 429 const SkIRect& srcRect, |
430 const SkIRect& dstRect, | 430 const SkIRect& dstRect, |
431 int radius, | 431 int radius, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 inputBM.getAddr32(srcBounds.left(), srcBounds.top()), | 633 inputBM.getAddr32(srcBounds.left(), srcBounds.top()), |
634 inputBM.rowBytesAsPixels(), | 634 inputBM.rowBytesAsPixels(), |
635 &dst, height, srcBounds); | 635 &dst, height, srcBounds); |
636 } | 636 } |
637 offset->fX = bounds.left(); | 637 offset->fX = bounds.left(); |
638 offset->fY = bounds.top(); | 638 offset->fY = bounds.top(); |
639 | 639 |
640 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), | 640 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), |
641 dst, &source->props()); | 641 dst, &source->props()); |
642 } | 642 } |
OLD | NEW |