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

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

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix isSolidWhite 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
52 float x_offset() const { return fXOffset; } 50 float x_offset() const { return fXOffset; }
53 float y_offset() const { return fYOffset; } 51 float y_offset() const { return fYOffset; }
54 float x_inv_zoom() const { return fXInvZoom; } 52 float x_inv_zoom() const { return fXInvZoom; }
55 float y_inv_zoom() const { return fYInvZoom; } 53 float y_inv_zoom() const { return fYInvZoom; }
56 float x_inv_inset() const { return fXInvInset; } 54 float x_inv_inset() const { return fXInvInset; }
57 float y_inv_inset() const { return fYInvInset; } 55 float y_inv_inset() const { return fYInvInset; }
58 56
59 typedef GrGLMagnifierEffect GLProcessor; 57 typedef GrGLMagnifierEffect GLProcessor;
60 58
61 private: 59 private:
62 GrMagnifierEffect(GrTexture* texture, 60 GrMagnifierEffect(GrTexture* texture,
63 float xOffset, 61 float xOffset,
64 float yOffset, 62 float yOffset,
65 float xInvZoom, 63 float xInvZoom,
66 float yInvZoom, 64 float yInvZoom,
67 float xInvInset, 65 float xInvInset,
68 float yInvInset) 66 float yInvInset)
69 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat rix(texture)) 67 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat rix(texture))
70 , fXOffset(xOffset) 68 , fXOffset(xOffset)
71 , fYOffset(yOffset) 69 , fYOffset(yOffset)
72 , fXInvZoom(xInvZoom) 70 , fXInvZoom(xInvZoom)
73 , fYInvZoom(yInvZoom) 71 , fYInvZoom(yInvZoom)
74 , fXInvInset(xInvInset) 72 , fXInvInset(xInvInset)
75 , fYInvInset(yInvInset) {} 73 , fYInvInset(yInvInset) {}
76 74
77 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 75 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
78 76
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::getConstantColorComponents(GrColor* color, uint32_t* val idFlags) const { 230 void GrMagnifierEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
231 this->updateConstantColorComponentsForModulation(color, validFlags); 231 this->updateInvariantOutputForModulation(inout);
232 inout->fIsSingleComponent = false;
232 } 233 }
233 234
234 #endif 235 #endif
235 236
236 //////////////////////////////////////////////////////////////////////////////// 237 ////////////////////////////////////////////////////////////////////////////////
237 238
238 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in set, 239 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in set,
239 SkImageFilter* input) { 240 SkImageFilter* input) {
240 241
241 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) { 242 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 366
366 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 367 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1);
367 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 368 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1);
368 369
369 *dptr = sptr[y_val * width + x_val]; 370 *dptr = sptr[y_val * width + x_val];
370 dptr++; 371 dptr++;
371 } 372 }
372 } 373 }
373 return true; 374 return true;
374 } 375 }
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