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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 m.postConcat(*matrix); | 396 m.postConcat(*matrix); |
397 } | 397 } |
398 morphpath(&tmp, *iterPath, meas, m); | 398 morphpath(&tmp, *iterPath, meas, m); |
399 this->drawPath(draw, tmp, iter.getPaint(), nullptr, true); | 399 this->drawPath(draw, tmp, iter.getPaint(), nullptr, true); |
400 } | 400 } |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 ////////////////////////////////////////////////////////////////////////////////
////////// | 404 ////////////////////////////////////////////////////////////////////////////////
////////// |
405 | 405 |
406 void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap
, int x, int y, | 406 void SkBaseDevice::drawBitmapAsSpriteWithImageFilter(const SkDraw& draw, const S
kBitmap& bitmap, |
407 const SkPaint& paint) { | 407 int x, int y, |
| 408 const SkPaint& paint) { |
408 SkImageFilter* filter = paint.getImageFilter(); | 409 SkImageFilter* filter = paint.getImageFilter(); |
409 if (filter && !this->canHandleImageFilter(filter)) { | 410 SkASSERT(filter); |
| 411 |
| 412 if (!this->canHandleImageFilter(filter)) { |
410 SkImageFilter::DeviceProxy proxy(this); | 413 SkImageFilter::DeviceProxy proxy(this); |
411 SkIPoint offset = SkIPoint::Make(0, 0); | 414 SkIPoint offset = SkIPoint::Make(0, 0); |
412 SkMatrix matrix = *draw.fMatrix; | 415 SkMatrix matrix = *draw.fMatrix; |
413 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 416 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
414 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); | 417 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); |
415 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); | 418 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); |
416 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 419 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
417 | 420 |
418 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bit
map)); | 421 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bit
map)); |
419 if (!srcImg) { | 422 if (!srcImg) { |
(...skipping 28 matching lines...) Expand all Loading... |
448 flags &= ~SkPaint::kLCDRenderText_Flag; | 451 flags &= ~SkPaint::kLCDRenderText_Flag; |
449 flags |= SkPaint::kGenA8FromLCD_Flag; | 452 flags |= SkPaint::kGenA8FromLCD_Flag; |
450 } | 453 } |
451 | 454 |
452 return flags; | 455 return flags; |
453 } | 456 } |
454 | 457 |
455 sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps co
nst&) { | 458 sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps co
nst&) { |
456 return nullptr; | 459 return nullptr; |
457 } | 460 } |
OLD | NEW |