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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 float xInvInset, | 65 float xInvInset, |
66 float yInvInset) | 66 float yInvInset) |
67 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat
rix(texture)) | 67 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat
rix(texture)) |
68 , fXOffset(xOffset) | 68 , fXOffset(xOffset) |
69 , fYOffset(yOffset) | 69 , fYOffset(yOffset) |
70 , fXInvZoom(xInvZoom) | 70 , fXInvZoom(xInvZoom) |
71 , fYInvZoom(yInvZoom) | 71 , fYInvZoom(yInvZoom) |
72 , fXInvInset(xInvInset) | 72 , fXInvInset(xInvInset) |
73 , fYInvInset(yInvInset) {} | 73 , fYInvInset(yInvInset) {} |
74 | 74 |
75 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 75 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
76 | 76 |
77 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 77 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
78 | 78 |
79 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 79 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
80 | 80 |
81 float fXOffset; | 81 float fXOffset; |
82 float fYOffset; | 82 float fYOffset; |
83 float fXInvZoom; | 83 float fXInvZoom; |
84 float fYInvZoom; | 84 float fYInvZoom; |
85 float fXInvInset; | 85 float fXInvInset; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 SkASSERT(effect); | 209 SkASSERT(effect); |
210 return effect; | 210 return effect; |
211 } | 211 } |
212 | 212 |
213 /////////////////////////////////////////////////////////////////////////////// | 213 /////////////////////////////////////////////////////////////////////////////// |
214 | 214 |
215 const GrBackendFragmentProcessorFactory& GrMagnifierEffect::getFactory() const { | 215 const GrBackendFragmentProcessorFactory& GrMagnifierEffect::getFactory() const { |
216 return GrTBackendFragmentProcessorFactory<GrMagnifierEffect>::getInstance(); | 216 return GrTBackendFragmentProcessorFactory<GrMagnifierEffect>::getInstance(); |
217 } | 217 } |
218 | 218 |
219 bool GrMagnifierEffect::onIsEqual(const GrProcessor& sBase) const { | 219 bool GrMagnifierEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
220 const GrMagnifierEffect& s = sBase.cast<GrMagnifierEffect>(); | 220 const GrMagnifierEffect& s = sBase.cast<GrMagnifierEffect>(); |
221 return (this->texture(0) == s.texture(0) && | 221 return (this->texture(0) == s.texture(0) && |
222 this->fXOffset == s.fXOffset && | 222 this->fXOffset == s.fXOffset && |
223 this->fYOffset == s.fYOffset && | 223 this->fYOffset == s.fYOffset && |
224 this->fXInvZoom == s.fXInvZoom && | 224 this->fXInvZoom == s.fXInvZoom && |
225 this->fYInvZoom == s.fYInvZoom && | 225 this->fYInvZoom == s.fYInvZoom && |
226 this->fXInvInset == s.fXInvInset && | 226 this->fXInvInset == s.fXInvInset && |
227 this->fYInvInset == s.fYInvInset); | 227 this->fYInvInset == s.fYInvInset); |
228 } | 228 } |
229 | 229 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); | 366 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); |
367 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); | 367 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); |
368 | 368 |
369 *dptr = sptr[y_val * width + x_val]; | 369 *dptr = sptr[y_val * width + x_val]; |
370 dptr++; | 370 dptr++; |
371 } | 371 } |
372 } | 372 } |
373 return true; | 373 return true; |
374 } | 374 } |
OLD | NEW |