| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2016 Google Inc. | 2  * Copyright 2016 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 "SkPaintImageFilter.h" | 8 #include "SkPaintImageFilter.h" | 
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" | 
| 10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" | 
| 11 #include "SkSpecialImage.h" | 11 #include "SkSpecialImage.h" | 
| 12 #include "SkSpecialSurface.h" | 12 #include "SkSpecialSurface.h" | 
| 13 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" | 
| 14 | 14 | 
| 15 SkImageFilter* SkPaintImageFilter::Create(const SkPaint& paint, const CropRect* 
    cropRect) { |  | 
| 16     return new SkPaintImageFilter(paint, cropRect); |  | 
| 17 } |  | 
| 18 |  | 
| 19 SkPaintImageFilter::SkPaintImageFilter(const SkPaint& paint, const CropRect* cro
    pRect) | 15 SkPaintImageFilter::SkPaintImageFilter(const SkPaint& paint, const CropRect* cro
    pRect) | 
| 20   : INHERITED(0, nullptr, cropRect) | 16     : INHERITED(nullptr, 0, cropRect) | 
| 21   , fPaint(paint) { | 17     , fPaint(paint) { | 
| 22 } | 18 } | 
| 23 | 19 | 
| 24 SkFlattenable* SkPaintImageFilter::CreateProc(SkReadBuffer& buffer) { | 20 SkFlattenable* SkPaintImageFilter::CreateProc(SkReadBuffer& buffer) { | 
| 25     SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); | 21     SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); | 
| 26     SkPaint paint; | 22     SkPaint paint; | 
| 27     buffer.readPaint(&paint); | 23     buffer.readPaint(&paint); | 
| 28     return Create(paint, &common.cropRect()); | 24     return SkPaintImageFilter::Make(paint, &common.cropRect()).release(); | 
| 29 } | 25 } | 
| 30 | 26 | 
| 31 void SkPaintImageFilter::flatten(SkWriteBuffer& buffer) const { | 27 void SkPaintImageFilter::flatten(SkWriteBuffer& buffer) const { | 
| 32     this->INHERITED::flatten(buffer); | 28     this->INHERITED::flatten(buffer); | 
| 33     buffer.writePaint(fPaint); | 29     buffer.writePaint(fPaint); | 
| 34 } | 30 } | 
| 35 | 31 | 
| 36 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source, | 32 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source, | 
| 37                                                         const Context& ctx, | 33                                                         const Context& ctx, | 
| 38                                                         SkIPoint* offset) const 
    { | 34                                                         SkIPoint* offset) const 
    { | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 73 bool SkPaintImageFilter::canComputeFastBounds() const { | 69 bool SkPaintImageFilter::canComputeFastBounds() const { | 
| 74     // http:skbug.com/4627: "make computeFastBounds and onFilterBounds() CropRec
    t-aware" | 70     // http:skbug.com/4627: "make computeFastBounds and onFilterBounds() CropRec
    t-aware" | 
| 75     // computeFastBounds() doesn't currently take the crop rect into account, | 71     // computeFastBounds() doesn't currently take the crop rect into account, | 
| 76     // so we can't compute it. If a full crop rect is set, we should return true
     here. | 72     // so we can't compute it. If a full crop rect is set, we should return true
     here. | 
| 77     return false; | 73     return false; | 
| 78 } | 74 } | 
| 79 | 75 | 
| 80 #ifndef SK_IGNORE_TO_STRING | 76 #ifndef SK_IGNORE_TO_STRING | 
| 81 void SkPaintImageFilter::toString(SkString* str) const { | 77 void SkPaintImageFilter::toString(SkString* str) const { | 
| 82     str->appendf("SkPaintImageFilter: ("); | 78     str->appendf("SkPaintImageFilter: ("); | 
|  | 79     fPaint.toString(str); | 
| 83     str->append(")"); | 80     str->append(")"); | 
| 84 } | 81 } | 
| 85 #endif | 82 #endif | 
| OLD | NEW | 
|---|