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

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

Issue 1109863004: Use GLSLCaps for creating processor keys and GLSL-specific programs (Closed) Base URL: https://chromium.googlesource.com/skia@master
Patch Set: Created 5 years, 7 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 28 matching lines...) Expand all
39 xInvZoom, 39 xInvZoom,
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 const char* name() const override { return "Magnifier"; } 47 const char* name() const override { return "Magnifier"; }
48 48
49 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri de; 49 void getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const over ride;
50 50
51 GrGLFragmentProcessor* createGLInstance() const override; 51 GrGLFragmentProcessor* createGLInstance() const override;
52 52
53 const SkRect& bounds() const { return fBounds; } // Bounds of source imag e. 53 const SkRect& bounds() const { return fBounds; } // Bounds of source imag e.
54 // Offset to apply to zoomed pixels, (srcRect position / texture size). 54 // Offset to apply to zoomed pixels, (srcRect position / texture size).
55 float x_offset() const { return fXOffset; } 55 float x_offset() const { return fXOffset; }
56 float y_offset() const { return fYOffset; } 56 float y_offset() const { return fYOffset; }
57 57
58 // Scale to apply to zoomed pixels (srcRect size / bounds size). 58 // Scale to apply to zoomed pixels (srcRect size / bounds size).
59 float x_inv_zoom() const { return fXInvZoom; } 59 float x_inv_zoom() const { return fXInvZoom; }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 const GrMagnifierEffect& zoom = effect.cast<GrMagnifierEffect>(); 190 const GrMagnifierEffect& zoom = effect.cast<GrMagnifierEffect>();
191 pdman.set2f(fOffsetVar, zoom.x_offset(), zoom.y_offset()); 191 pdman.set2f(fOffsetVar, zoom.x_offset(), zoom.y_offset());
192 pdman.set2f(fInvZoomVar, zoom.x_inv_zoom(), zoom.y_inv_zoom()); 192 pdman.set2f(fInvZoomVar, zoom.x_inv_zoom(), zoom.y_inv_zoom());
193 pdman.set2f(fInvInsetVar, zoom.x_inv_inset(), zoom.y_inv_inset()); 193 pdman.set2f(fInvInsetVar, zoom.x_inv_inset(), zoom.y_inv_inset());
194 pdman.set4f(fBoundsVar, zoom.bounds().x(), zoom.bounds().y(), 194 pdman.set4f(fBoundsVar, zoom.bounds().x(), zoom.bounds().y(),
195 zoom.bounds().width(), zoom.bounds().height()); 195 zoom.bounds().width(), zoom.bounds().height());
196 } 196 }
197 197
198 ///////////////////////////////////////////////////////////////////// 198 /////////////////////////////////////////////////////////////////////
199 199
200 void GrMagnifierEffect::getGLProcessorKey(const GrGLCaps& caps, 200 void GrMagnifierEffect::getGLProcessorKey(const GrGLSLCaps& caps,
201 GrProcessorKeyBuilder* b) const { 201 GrProcessorKeyBuilder* b) const {
202 GrGLMagnifierEffect::GenKey(*this, caps, b); 202 GrGLMagnifierEffect::GenKey(*this, caps, b);
203 } 203 }
204 204
205 GrGLFragmentProcessor* GrMagnifierEffect::createGLInstance() const { 205 GrGLFragmentProcessor* GrMagnifierEffect::createGLInstance() const {
206 return SkNEW_ARGS(GrGLMagnifierEffect, (*this)); 206 return SkNEW_ARGS(GrGLMagnifierEffect, (*this));
207 } 207 }
208 208
209 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect); 209 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect);
210 210
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 #ifndef SK_IGNORE_TO_STRING 386 #ifndef SK_IGNORE_TO_STRING
387 void SkMagnifierImageFilter::toString(SkString* str) const { 387 void SkMagnifierImageFilter::toString(SkString* str) const {
388 str->appendf("SkMagnifierImageFilter: ("); 388 str->appendf("SkMagnifierImageFilter: (");
389 str->appendf("src: (%f,%f,%f,%f) ", 389 str->appendf("src: (%f,%f,%f,%f) ",
390 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m); 390 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m);
391 str->appendf("inset: %f", fInset); 391 str->appendf("inset: %f", fInset);
392 str->append(")"); 392 str->append(")");
393 } 393 }
394 #endif 394 #endif
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