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 | |
66 static int32_t next_image_filter_unique_id() { | 35 static int32_t next_image_filter_unique_id() { |
67 static int32_t gImageFilterUniqueID; | 36 static int32_t gImageFilterUniqueID; |
68 | 37 |
69 // Never return 0. | 38 // Never return 0. |
70 int32_t id; | 39 int32_t id; |
71 do { | 40 do { |
72 id = sk_atomic_inc(&gImageFilterUniqueID) + 1; | 41 id = sk_atomic_inc(&gImageFilterUniqueID) + 1; |
73 } while (0 == id); | 42 } while (0 == id); |
74 return id; | 43 return id; |
75 } | 44 } |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 } | 540 } |
572 return dev; | 541 return dev; |
573 } | 542 } |
574 | 543 |
575 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, | 544 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, |
576 const SkImageFilter::Context& ctx, | 545 const SkImageFilter::Context& ctx, |
577 SkBitmap* result, SkIPoint* offset) { | 546 SkBitmap* result, SkIPoint* offset) { |
578 return fDevice->filterImage(filter, src, ctx, result, offset); | 547 return fDevice->filterImage(filter, src, ctx, result, offset); |
579 } | 548 } |
580 | 549 |
OLD | NEW |