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 "SkRectShaderImageFilter.h" | 8 #include "SkRectShaderImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
12 #include "SkReadBuffer.h" | 12 #include "SkReadBuffer.h" |
13 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
14 #include "SkShader.h" | 14 #include "SkShader.h" |
15 | 15 |
16 SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRe
ct& rect) { | 16 SkImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRect& rect)
{ |
17 SkASSERT(s); | 17 SkASSERT(s); |
18 uint32_t flags = CropRect::kHasAll_CropEdge; | 18 uint32_t flags = CropRect::kHasAll_CropEdge; |
19 if (rect.width() == 0 || rect.height() == 0) { | 19 if (rect.width() == 0 || rect.height() == 0) { |
20 flags = 0x0; | 20 flags = 0x0; |
21 } | 21 } |
22 CropRect cropRect(rect, flags); | 22 CropRect cropRect(rect, flags); |
23 return s ? new SkRectShaderImageFilter(s, &cropRect) : nullptr; | 23 return s ? new SkRectShaderImageFilter(s, &cropRect) : nullptr; |
24 } | 24 } |
25 | 25 |
26 SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const Crop
Rect* cropRect) { | 26 SkImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const CropRect* crop
Rect) { |
27 SkASSERT(s); | 27 SkASSERT(s); |
28 return s ? new SkRectShaderImageFilter(s, cropRect) : nullptr; | 28 return s ? new SkRectShaderImageFilter(s, cropRect) : nullptr; |
29 } | 29 } |
30 | 30 |
31 SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cr
opRect) | 31 SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cr
opRect) |
32 : INHERITED(0, nullptr, cropRect) | 32 : INHERITED(0, nullptr, cropRect) |
33 , fShader(SkRef(s)) { | 33 , fShader(SkRef(s)) { |
34 } | 34 } |
35 | 35 |
36 SkFlattenable* SkRectShaderImageFilter::CreateProc(SkReadBuffer& buffer) { | 36 SkFlattenable* SkRectShaderImageFilter::CreateProc(SkReadBuffer& buffer) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool SkRectShaderImageFilter::affectsTransparentBlack() const { | 82 bool SkRectShaderImageFilter::affectsTransparentBlack() const { |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 #ifndef SK_IGNORE_TO_STRING | 86 #ifndef SK_IGNORE_TO_STRING |
87 void SkRectShaderImageFilter::toString(SkString* str) const { | 87 void SkRectShaderImageFilter::toString(SkString* str) const { |
88 str->appendf("SkRectShaderImageFilter: ("); | 88 str->appendf("SkRectShaderImageFilter: ("); |
89 str->append(")"); | 89 str->append(")"); |
90 } | 90 } |
91 #endif | 91 #endif |
OLD | NEW |