OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkMagnifierImageFilter.h" | 9 #include "SkMagnifierImageFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 #endif | 240 #endif |
241 | 241 |
242 //////////////////////////////////////////////////////////////////////////////// | 242 //////////////////////////////////////////////////////////////////////////////// |
243 | 243 |
244 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in
set, | 244 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in
set, |
245 SkImageFilter* input) { | 245 SkImageFilter* input) { |
246 | 246 |
247 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) { | 247 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) { |
248 return NULL; | 248 return nullptr; |
249 } | 249 } |
250 // Negative numbers in src rect are not supported | 250 // Negative numbers in src rect are not supported |
251 if (srcRect.fLeft < 0 || srcRect.fTop < 0) { | 251 if (srcRect.fLeft < 0 || srcRect.fTop < 0) { |
252 return NULL; | 252 return nullptr; |
253 } | 253 } |
254 return new SkMagnifierImageFilter(srcRect, inset, input); | 254 return new SkMagnifierImageFilter(srcRect, inset, input); |
255 } | 255 } |
256 | 256 |
257 | 257 |
258 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i
nset, | 258 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i
nset, |
259 SkImageFilter* input) | 259 SkImageFilter* input) |
260 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) { | 260 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) { |
261 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); | 261 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); |
262 } | 262 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 #ifndef SK_IGNORE_TO_STRING | 374 #ifndef SK_IGNORE_TO_STRING |
375 void SkMagnifierImageFilter::toString(SkString* str) const { | 375 void SkMagnifierImageFilter::toString(SkString* str) const { |
376 str->appendf("SkMagnifierImageFilter: ("); | 376 str->appendf("SkMagnifierImageFilter: ("); |
377 str->appendf("src: (%f,%f,%f,%f) ", | 377 str->appendf("src: (%f,%f,%f,%f) ", |
378 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 378 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
379 str->appendf("inset: %f", fInset); | 379 str->appendf("inset: %f", fInset); |
380 str->append(")"); | 380 str->append(")"); |
381 } | 381 } |
382 #endif | 382 #endif |
OLD | NEW |