| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 do { | 99 do { |
| 100 id = sk_atomic_inc(&gImageFilterUniqueID) + 1; | 100 id = sk_atomic_inc(&gImageFilterUniqueID) + 1; |
| 101 } while (0 == id); | 101 } while (0 == id); |
| 102 return id; | 102 return id; |
| 103 } | 103 } |
| 104 | 104 |
| 105 struct SkImageFilter::Cache::Key { | 105 struct SkImageFilter::Cache::Key { |
| 106 Key(const uint32_t uniqueID, const SkMatrix& matrix, const SkIRect& clipBoun
ds, uint32_t srcGenID) | 106 Key(const uint32_t uniqueID, const SkMatrix& matrix, const SkIRect& clipBoun
ds, uint32_t srcGenID) |
| 107 : fUniqueID(uniqueID), fMatrix(matrix), fClipBounds(clipBounds), fSrcGenID
(srcGenID) { | 107 : fUniqueID(uniqueID), fMatrix(matrix), fClipBounds(clipBounds), fSrcGenID
(srcGenID) { |
| 108 // Assert that Key is tightly-packed, since it is hashed. | 108 // Assert that Key is tightly-packed, since it is hashed. |
| 109 SK_COMPILE_ASSERT(sizeof(Key) == sizeof(uint32_t) + sizeof(SkMatrix) + s
izeof(SkIRect) + | 109 static_assert(sizeof(Key) == sizeof(uint32_t) + sizeof(SkMatrix) + sizeo
f(SkIRect) + |
| 110 sizeof(uint32_t), image_filter_key_tigh
t_packing); | 110 sizeof(uint32_t), "image_filter_key_tight_p
acking"); |
| 111 fMatrix.getType(); // force initialization of type, so hashes match | 111 fMatrix.getType(); // force initialization of type, so hashes match |
| 112 } | 112 } |
| 113 uint32_t fUniqueID; | 113 uint32_t fUniqueID; |
| 114 SkMatrix fMatrix; | 114 SkMatrix fMatrix; |
| 115 SkIRect fClipBounds; | 115 SkIRect fClipBounds; |
| 116 uint32_t fSrcGenID; | 116 uint32_t fSrcGenID; |
| 117 bool operator==(const Key& other) const { | 117 bool operator==(const Key& other) const { |
| 118 return fUniqueID == other.fUniqueID | 118 return fUniqueID == other.fUniqueID |
| 119 && fMatrix == other.fMatrix | 119 && fMatrix == other.fMatrix |
| 120 && fClipBounds == other.fClipBounds | 120 && fClipBounds == other.fClipBounds |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 } | 578 } |
| 579 return dev; | 579 return dev; |
| 580 } | 580 } |
| 581 | 581 |
| 582 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, | 582 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, |
| 583 const SkImageFilter::Context& ctx, | 583 const SkImageFilter::Context& ctx, |
| 584 SkBitmap* result, SkIPoint* offset) { | 584 SkBitmap* result, SkIPoint* offset) { |
| 585 return fDevice->filterImage(filter, src, ctx, result, offset); | 585 return fDevice->filterImage(filter, src, ctx, result, offset); |
| 586 } | 586 } |
| 587 | 587 |
| OLD | NEW |