Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: src/effects/SkMagnifierImageFilter.cpp

Issue 617853003: Revert of Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 yInvZoom, 40 yInvZoom,
41 xInvInset, 41 xInvInset,
42 yInvInset)); 42 yInvInset));
43 } 43 }
44 44
45 virtual ~GrMagnifierEffect() {}; 45 virtual ~GrMagnifierEffect() {};
46 46
47 static const char* Name() { return "Magnifier"; } 47 static const char* Name() { return "Magnifier"; }
48 48
49 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 49 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
50 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
51
50 float x_offset() const { return fXOffset; } 52 float x_offset() const { return fXOffset; }
51 float y_offset() const { return fYOffset; } 53 float y_offset() const { return fYOffset; }
52 float x_inv_zoom() const { return fXInvZoom; } 54 float x_inv_zoom() const { return fXInvZoom; }
53 float y_inv_zoom() const { return fYInvZoom; } 55 float y_inv_zoom() const { return fYInvZoom; }
54 float x_inv_inset() const { return fXInvInset; } 56 float x_inv_inset() const { return fXInvInset; }
55 float y_inv_inset() const { return fYInvInset; } 57 float y_inv_inset() const { return fYInvInset; }
56 58
57 typedef GrGLMagnifierEffect GLProcessor; 59 typedef GrGLMagnifierEffect GLProcessor;
58 60
59 private: 61 private:
60 GrMagnifierEffect(GrTexture* texture, 62 GrMagnifierEffect(GrTexture* texture,
61 float xOffset, 63 float xOffset,
62 float yOffset, 64 float yOffset,
63 float xInvZoom, 65 float xInvZoom,
64 float yInvZoom, 66 float yInvZoom,
65 float xInvInset, 67 float xInvInset,
66 float yInvInset) 68 float yInvInset)
67 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat rix(texture)) 69 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat rix(texture))
68 , fXOffset(xOffset) 70 , fXOffset(xOffset)
69 , fYOffset(yOffset) 71 , fYOffset(yOffset)
70 , fXInvZoom(xInvZoom) 72 , fXInvZoom(xInvZoom)
71 , fYInvZoom(yInvZoom) 73 , fYInvZoom(yInvZoom)
72 , fXInvInset(xInvInset) 74 , fXInvInset(xInvInset)
73 , fYInvInset(yInvInset) {} 75 , fYInvInset(yInvInset) {}
74 76
75 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 77 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
76 78
77 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
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;
86 float fYInvInset; 86 float fYInvInset;
87 87
88 typedef GrSingleTextureEffect INHERITED; 88 typedef GrSingleTextureEffect INHERITED;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
230 void GrMagnifierEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 230 void GrMagnifierEffect::getConstantColorComponents(GrColor* color, uint32_t* val idFlags) const {
231 this->updateInvariantOutputForModulation(inout); 231 this->updateConstantColorComponentsForModulation(color, validFlags);
232 inout->fIsSingleComponent = false;
233 } 232 }
234 233
235 #endif 234 #endif
236 235
237 //////////////////////////////////////////////////////////////////////////////// 236 ////////////////////////////////////////////////////////////////////////////////
238 237
239 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in set, 238 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in set,
240 SkImageFilter* input) { 239 SkImageFilter* input) {
241 240
242 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) { 241 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 365
367 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 366 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1);
368 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 367 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1);
369 368
370 *dptr = sptr[y_val * width + x_val]; 369 *dptr = sptr[y_val * width + x_val];
371 dptr++; 370 dptr++;
372 } 371 }
373 } 372 }
374 return true; 373 return true;
375 } 374 }
OLDNEW
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698