OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 * Remove the imagefilter and the xfermode from the paint that
we (AutoDrawLooper) | 474 * Remove the imagefilter and the xfermode from the paint that
we (AutoDrawLooper) |
475 * return (fPaint). We then draw the primitive (using srcover)
into a cleared | 475 * return (fPaint). We then draw the primitive (using srcover)
into a cleared |
476 * buffer/surface. | 476 * buffer/surface. |
477 * 3. Restore the layer created in #1 | 477 * 3. Restore the layer created in #1 |
478 * The imagefilter is passed the buffer/surface from the layer
(now filled with the | 478 * The imagefilter is passed the buffer/surface from the layer
(now filled with the |
479 * src pixels of the primitive). It returns a new "filtered" bu
ffer, which we | 479 * src pixels of the primitive). It returns a new "filtered" bu
ffer, which we |
480 * draw onto the previous layer using the xfermode from the ori
ginal paint. | 480 * draw onto the previous layer using the xfermode from the ori
ginal paint. |
481 */ | 481 */ |
482 SkPaint tmp; | 482 SkPaint tmp; |
483 tmp.setImageFilter(fPaint->getImageFilter()); | 483 tmp.setImageFilter(fPaint->getImageFilter()); |
484 tmp.setXfermode(fPaint->getXfermode()); | 484 tmp.setXfermode(sk_ref_sp(fPaint->getXfermode())); |
485 SkRect storage; | 485 SkRect storage; |
486 if (rawBounds) { | 486 if (rawBounds) { |
487 // Make rawBounds include all paint outsets except for those due
to image filters. | 487 // Make rawBounds include all paint outsets except for those due
to image filters. |
488 rawBounds = &apply_paint_to_bounds_sans_imagefilter(*fPaint, *ra
wBounds, &storage); | 488 rawBounds = &apply_paint_to_bounds_sans_imagefilter(*fPaint, *ra
wBounds, &storage); |
489 } | 489 } |
490 (void)canvas->internalSaveLayer(SkCanvas::SaveLayerRec(rawBounds, &t
mp), | 490 (void)canvas->internalSaveLayer(SkCanvas::SaveLayerRec(rawBounds, &t
mp), |
491 SkCanvas::kFullLayer_SaveLayerStrate
gy); | 491 SkCanvas::kFullLayer_SaveLayerStrate
gy); |
492 fTempLayerForImageFilter = true; | 492 fTempLayerForImageFilter = true; |
493 // we remove the imagefilter/xfermode inside doNext() | 493 // we remove the imagefilter/xfermode inside doNext() |
494 } | 494 } |
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 | 3041 |
3042 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3042 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3043 fCanvas->restoreToCount(fSaveCount); | 3043 fCanvas->restoreToCount(fSaveCount); |
3044 } | 3044 } |
3045 | 3045 |
3046 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3046 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3047 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3047 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3048 return this->makeSurface(info, props).release(); | 3048 return this->makeSurface(info, props).release(); |
3049 } | 3049 } |
3050 #endif | 3050 #endif |
OLD | NEW |