OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorFilter.h" | 8 #include "SkColorFilter.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 411 |
412 if (!this->canHandleImageFilter(filter)) { | 412 if (!this->canHandleImageFilter(filter)) { |
413 SkImageFilter::DeviceProxy proxy(this); | 413 SkImageFilter::DeviceProxy proxy(this); |
414 SkIPoint offset = SkIPoint::Make(0, 0); | 414 SkIPoint offset = SkIPoint::Make(0, 0); |
415 SkMatrix matrix = *draw.fMatrix; | 415 SkMatrix matrix = *draw.fMatrix; |
416 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 416 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
417 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); | 417 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); |
418 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); | 418 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); |
419 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 419 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
420 | 420 |
421 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bit
map)); | 421 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bit
map, |
| 422 &this->surf
aceProps())); |
422 if (!srcImg) { | 423 if (!srcImg) { |
423 return; // something disastrous happened | 424 return; // something disastrous happened |
424 } | 425 } |
425 | 426 |
426 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &
offset)); | 427 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &
offset)); |
427 if (resultImg) { | 428 if (resultImg) { |
428 SkPaint tmpUnfiltered(paint); | 429 SkPaint tmpUnfiltered(paint); |
429 tmpUnfiltered.setImageFilter(nullptr); | 430 tmpUnfiltered.setImageFilter(nullptr); |
430 SkBitmap resultBM; | 431 SkBitmap resultBM; |
431 if (resultImg->internal_getBM(&resultBM)) { | 432 if (resultImg->internal_getBM(&resultBM)) { |
(...skipping 19 matching lines...) Expand all Loading... |
451 flags &= ~SkPaint::kLCDRenderText_Flag; | 452 flags &= ~SkPaint::kLCDRenderText_Flag; |
452 flags |= SkPaint::kGenA8FromLCD_Flag; | 453 flags |= SkPaint::kGenA8FromLCD_Flag; |
453 } | 454 } |
454 | 455 |
455 return flags; | 456 return flags; |
456 } | 457 } |
457 | 458 |
458 sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps co
nst&) { | 459 sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps co
nst&) { |
459 return nullptr; | 460 return nullptr; |
460 } | 461 } |
OLD | NEW |