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 "SkMatrixConvolutionImageFilter.h" | 8 #include "SkMatrixConvolutionImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 class UncheckedPixelFetcher { | 119 class UncheckedPixelFetcher { |
120 public: | 120 public: |
121 static inline SkPMColor fetch(const SkBitmap& src, int x, int y, const SkIRe
ct& bounds) { | 121 static inline SkPMColor fetch(const SkBitmap& src, int x, int y, const SkIRe
ct& bounds) { |
122 return *src.getAddr32(x, y); | 122 return *src.getAddr32(x, y); |
123 } | 123 } |
124 }; | 124 }; |
125 | 125 |
126 class ClampPixelFetcher { | 126 class ClampPixelFetcher { |
127 public: | 127 public: |
128 static inline SkPMColor fetch(const SkBitmap& src, int x, int y, const SkIRe
ct& bounds) { | 128 static inline SkPMColor fetch(const SkBitmap& src, int x, int y, const SkIRe
ct& bounds) { |
129 x = SkPin32(x, bounds.fLeft, bounds.fRight - 1); | 129 x = SkTPin(x, bounds.fLeft, bounds.fRight - 1); |
130 y = SkPin32(y, bounds.fTop, bounds.fBottom - 1); | 130 y = SkTPin(y, bounds.fTop, bounds.fBottom - 1); |
131 return *src.getAddr32(x, y); | 131 return *src.getAddr32(x, y); |
132 } | 132 } |
133 }; | 133 }; |
134 | 134 |
135 class RepeatPixelFetcher { | 135 class RepeatPixelFetcher { |
136 public: | 136 public: |
137 static inline SkPMColor fetch(const SkBitmap& src, int x, int y, const SkIRe
ct& bounds) { | 137 static inline SkPMColor fetch(const SkBitmap& src, int x, int y, const SkIRe
ct& bounds) { |
138 x = (x - bounds.left()) % bounds.width() + bounds.left(); | 138 x = (x - bounds.left()) % bounds.width() + bounds.left(); |
139 y = (y - bounds.top()) % bounds.height() + bounds.top(); | 139 y = (y - bounds.top()) % bounds.height() + bounds.top(); |
140 if (x < bounds.left()) { | 140 if (x < bounds.left()) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 378 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
379 } | 379 } |
380 } | 380 } |
381 str->appendf(")"); | 381 str->appendf(")"); |
382 str->appendf("gain: %f bias: %f ", fGain, fBias); | 382 str->appendf("gain: %f bias: %f ", fGain, fBias); |
383 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 383 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
384 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 384 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
385 str->append(")"); | 385 str->append(")"); |
386 } | 386 } |
387 #endif | 387 #endif |
OLD | NEW |