| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 , fBounds(bounds) | 67 , fBounds(bounds) |
| 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 this->initClassID<GrMagnifierEffect>(); | 74 this->initClassID<GrMagnifierEffect>(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 GrGLSLFragmentProcessor* onCreateGLInstance() const override; | 77 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 78 | 78 |
| 79 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov
erride; | 79 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; |
| 80 | 80 |
| 81 bool onIsEqual(const GrFragmentProcessor&) const override; | 81 bool onIsEqual(const GrFragmentProcessor&) const override; |
| 82 | 82 |
| 83 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 83 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
| 84 | 84 |
| 85 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 85 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 86 | 86 |
| 87 SkRect fBounds; | 87 SkRect fBounds; |
| 88 float fXOffset; | 88 float fXOffset; |
| 89 float fYOffset; | 89 float fYOffset; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 const GrMagnifierEffect& zoom = effect.cast<GrMagnifierEffect>(); | 173 const GrMagnifierEffect& zoom = effect.cast<GrMagnifierEffect>(); |
| 174 pdman.set2f(fOffsetVar, zoom.x_offset(), zoom.y_offset()); | 174 pdman.set2f(fOffsetVar, zoom.x_offset(), zoom.y_offset()); |
| 175 pdman.set2f(fInvZoomVar, zoom.x_inv_zoom(), zoom.y_inv_zoom()); | 175 pdman.set2f(fInvZoomVar, zoom.x_inv_zoom(), zoom.y_inv_zoom()); |
| 176 pdman.set2f(fInvInsetVar, zoom.x_inv_inset(), zoom.y_inv_inset()); | 176 pdman.set2f(fInvInsetVar, zoom.x_inv_inset(), zoom.y_inv_inset()); |
| 177 pdman.set4f(fBoundsVar, zoom.bounds().x(), zoom.bounds().y(), | 177 pdman.set4f(fBoundsVar, zoom.bounds().x(), zoom.bounds().y(), |
| 178 zoom.bounds().width(), zoom.bounds().height()); | 178 zoom.bounds().width(), zoom.bounds().height()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 ///////////////////////////////////////////////////////////////////// | 181 ///////////////////////////////////////////////////////////////////// |
| 182 | 182 |
| 183 void GrMagnifierEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, | 183 void GrMagnifierEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
| 184 GrProcessorKeyBuilder* b) const { | 184 GrProcessorKeyBuilder* b) const { |
| 185 GrGLMagnifierEffect::GenKey(*this, caps, b); | 185 GrGLMagnifierEffect::GenKey(*this, caps, b); |
| 186 } | 186 } |
| 187 | 187 |
| 188 GrGLSLFragmentProcessor* GrMagnifierEffect::onCreateGLInstance() const { | 188 GrGLSLFragmentProcessor* GrMagnifierEffect::onCreateGLSLInstance() const { |
| 189 return new GrGLMagnifierEffect(*this); | 189 return new GrGLMagnifierEffect(*this); |
| 190 } | 190 } |
| 191 | 191 |
| 192 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect); | 192 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect); |
| 193 | 193 |
| 194 const GrFragmentProcessor* GrMagnifierEffect::TestCreate(GrProcessorTestData* d)
{ | 194 const GrFragmentProcessor* GrMagnifierEffect::TestCreate(GrProcessorTestData* d)
{ |
| 195 GrTexture* texture = d->fTextures[0]; | 195 GrTexture* texture = d->fTextures[0]; |
| 196 const int kMaxWidth = 200; | 196 const int kMaxWidth = 200; |
| 197 const int kMaxHeight = 200; | 197 const int kMaxHeight = 200; |
| 198 const int kMaxInset = 20; | 198 const int kMaxInset = 20; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 #ifndef SK_IGNORE_TO_STRING | 370 #ifndef SK_IGNORE_TO_STRING |
| 371 void SkMagnifierImageFilter::toString(SkString* str) const { | 371 void SkMagnifierImageFilter::toString(SkString* str) const { |
| 372 str->appendf("SkMagnifierImageFilter: ("); | 372 str->appendf("SkMagnifierImageFilter: ("); |
| 373 str->appendf("src: (%f,%f,%f,%f) ", | 373 str->appendf("src: (%f,%f,%f,%f) ", |
| 374 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 374 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
| 375 str->appendf("inset: %f", fInset); | 375 str->appendf("inset: %f", fInset); |
| 376 str->append(")"); | 376 str->append(")"); |
| 377 } | 377 } |
| 378 #endif | 378 #endif |
| OLD | NEW |