OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 390 |
391 SkImageFilter* filter = paint.getImageFilter(); | 391 SkImageFilter* filter = paint.getImageFilter(); |
392 if (filter) { | 392 if (filter) { |
393 SkIPoint offset = SkIPoint::Make(0, 0); | 393 SkIPoint offset = SkIPoint::Make(0, 0); |
394 SkMatrix matrix = *draw.fMatrix; | 394 SkMatrix matrix = *draw.fMatrix; |
395 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 395 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
396 const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y); | 396 const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y); |
397 SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache()); | 397 SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache()); |
398 SkImageFilter::OutputProperties outputProperties(fBitmap.colorSpace()); | 398 SkImageFilter::OutputProperties outputProperties(fBitmap.colorSpace()); |
399 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), outputProper
ties); | 399 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), outputProper
ties); |
400 | 400 |
401 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg, ctx, &offset
)); | 401 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg, ctx, &offset
)); |
402 if (resultImg) { | 402 if (resultImg) { |
403 SkPaint tmpUnfiltered(paint); | 403 SkPaint tmpUnfiltered(paint); |
404 tmpUnfiltered.setImageFilter(nullptr); | 404 tmpUnfiltered.setImageFilter(nullptr); |
405 if (resultImg->getROPixels(&resultBM)) { | 405 if (resultImg->getROPixels(&resultBM)) { |
406 this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(),
tmpUnfiltered); | 406 this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(),
tmpUnfiltered); |
407 } | 407 } |
408 } | 408 } |
409 } else { | 409 } else { |
410 if (srcImg->getROPixels(&resultBM)) { | 410 if (srcImg->getROPixels(&resultBM)) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 paint.getRasterizer() || | 445 paint.getRasterizer() || |
446 paint.getPathEffect() || | 446 paint.getPathEffect() || |
447 paint.isFakeBoldText() || | 447 paint.isFakeBoldText() || |
448 paint.getStyle() != SkPaint::kFill_Style || | 448 paint.getStyle() != SkPaint::kFill_Style || |
449 !paint.isSrcOver()) | 449 !paint.isSrcOver()) |
450 { | 450 { |
451 return true; | 451 return true; |
452 } | 452 } |
453 return false; | 453 return false; |
454 } | 454 } |
OLD | NEW |