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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "SkGrPixelRef.h" | 25 #include "SkGrPixelRef.h" |
26 #include "SkGr.h" | 26 #include "SkGr.h" |
27 #endif | 27 #endif |
28 | 28 |
29 #ifdef SK_BUILD_FOR_IOS | 29 #ifdef SK_BUILD_FOR_IOS |
30 enum { kDefaultCacheSize = 2 * 1024 * 1024 }; | 30 enum { kDefaultCacheSize = 2 * 1024 * 1024 }; |
31 #else | 31 #else |
32 enum { kDefaultCacheSize = 128 * 1024 * 1024 }; | 32 enum { kDefaultCacheSize = 128 * 1024 * 1024 }; |
33 #endif | 33 #endif |
34 | 34 |
| 35 #ifndef SK_IGNORE_TO_STRING |
| 36 void SkImageFilter::CropRect::toString(SkString* str) const { |
| 37 if (!fFlags) { |
| 38 return; |
| 39 } |
| 40 |
| 41 str->appendf("cropRect ("); |
| 42 if (fFlags & CropRect::kHasLeft_CropEdge) { |
| 43 str->appendf("%.2f, ", fRect.fLeft); |
| 44 } else { |
| 45 str->appendf("X, "); |
| 46 } |
| 47 if (fFlags & CropRect::kHasTop_CropEdge) { |
| 48 str->appendf("%.2f, ", fRect.fTop); |
| 49 } else { |
| 50 str->appendf("X, "); |
| 51 } |
| 52 if (fFlags & CropRect::kHasRight_CropEdge) { |
| 53 str->appendf("%.2f, ", fRect.fRight); |
| 54 } else { |
| 55 str->appendf("X, "); |
| 56 } |
| 57 if (fFlags & CropRect::kHasBottom_CropEdge) { |
| 58 str->appendf("%.2f", fRect.fBottom); |
| 59 } else { |
| 60 str->appendf("X"); |
| 61 } |
| 62 str->appendf(") "); |
| 63 } |
| 64 #endif |
| 65 |
35 static int32_t next_image_filter_unique_id() { | 66 static int32_t next_image_filter_unique_id() { |
36 static int32_t gImageFilterUniqueID; | 67 static int32_t gImageFilterUniqueID; |
37 | 68 |
38 // Never return 0. | 69 // Never return 0. |
39 int32_t id; | 70 int32_t id; |
40 do { | 71 do { |
41 id = sk_atomic_inc(&gImageFilterUniqueID) + 1; | 72 id = sk_atomic_inc(&gImageFilterUniqueID) + 1; |
42 } while (0 == id); | 73 } while (0 == id); |
43 return id; | 74 return id; |
44 } | 75 } |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 571 } |
541 return dev; | 572 return dev; |
542 } | 573 } |
543 | 574 |
544 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, | 575 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, |
545 const SkImageFilter::Context& ctx, | 576 const SkImageFilter::Context& ctx, |
546 SkBitmap* result, SkIPoint* offset) { | 577 SkBitmap* result, SkIPoint* offset) { |
547 return fDevice->filterImage(filter, src, ctx, result, offset); | 578 return fDevice->filterImage(filter, src, ctx, result, offset); |
548 } | 579 } |
549 | 580 |
OLD | NEW |