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 24 matching lines...) Expand all Loading... |
35 xOffset, | 35 xOffset, |
36 yOffset, | 36 yOffset, |
37 xInvZoom, | 37 xInvZoom, |
38 yInvZoom, | 38 yInvZoom, |
39 xInvInset, | 39 xInvInset, |
40 yInvInset)); | 40 yInvInset)); |
41 } | 41 } |
42 | 42 |
43 virtual ~GrMagnifierEffect() {}; | 43 virtual ~GrMagnifierEffect() {}; |
44 | 44 |
45 const char* name() const SK_OVERRIDE { return "Magnifier"; } | 45 const char* name() const override { return "Magnifier"; } |
46 | 46 |
47 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE
RRIDE; | 47 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri
de; |
48 | 48 |
49 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 49 GrGLFragmentProcessor* createGLInstance() const override; |
50 | 50 |
51 float x_offset() const { return fXOffset; } | 51 float x_offset() const { return fXOffset; } |
52 float y_offset() const { return fYOffset; } | 52 float y_offset() const { return fYOffset; } |
53 float x_inv_zoom() const { return fXInvZoom; } | 53 float x_inv_zoom() const { return fXInvZoom; } |
54 float y_inv_zoom() const { return fYInvZoom; } | 54 float y_inv_zoom() const { return fYInvZoom; } |
55 float x_inv_inset() const { return fXInvInset; } | 55 float x_inv_inset() const { return fXInvInset; } |
56 float y_inv_inset() const { return fYInvInset; } | 56 float y_inv_inset() const { return fYInvInset; } |
57 | 57 |
58 private: | 58 private: |
59 GrMagnifierEffect(GrTexture* texture, | 59 GrMagnifierEffect(GrTexture* texture, |
60 float xOffset, | 60 float xOffset, |
61 float yOffset, | 61 float yOffset, |
62 float xInvZoom, | 62 float xInvZoom, |
63 float yInvZoom, | 63 float yInvZoom, |
64 float xInvInset, | 64 float xInvInset, |
65 float yInvInset) | 65 float yInvInset) |
66 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat
rix(texture)) | 66 : GrSingleTextureEffect(texture, GrCoordTransform::MakeDivByTextureWHMat
rix(texture)) |
67 , fXOffset(xOffset) | 67 , fXOffset(xOffset) |
68 , fYOffset(yOffset) | 68 , fYOffset(yOffset) |
69 , fXInvZoom(xInvZoom) | 69 , fXInvZoom(xInvZoom) |
70 , fYInvZoom(yInvZoom) | 70 , fYInvZoom(yInvZoom) |
71 , fXInvInset(xInvInset) | 71 , fXInvInset(xInvInset) |
72 , fYInvInset(yInvInset) { | 72 , fYInvInset(yInvInset) { |
73 this->initClassID<GrMagnifierEffect>(); | 73 this->initClassID<GrMagnifierEffect>(); |
74 } | 74 } |
75 | 75 |
76 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 76 bool onIsEqual(const GrFragmentProcessor&) const override; |
77 | 77 |
78 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; | 78 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
79 | 79 |
80 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 80 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
81 | 81 |
82 float fXOffset; | 82 float fXOffset; |
83 float fYOffset; | 83 float fYOffset; |
84 float fXInvZoom; | 84 float fXInvZoom; |
85 float fYInvZoom; | 85 float fYInvZoom; |
86 float fXInvInset; | 86 float fXInvInset; |
87 float fYInvInset; | 87 float fYInvInset; |
88 | 88 |
89 typedef GrSingleTextureEffect INHERITED; | 89 typedef GrSingleTextureEffect INHERITED; |
90 }; | 90 }; |
91 | 91 |
92 // For brevity | 92 // For brevity |
93 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 93 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
94 | 94 |
95 class GrGLMagnifierEffect : public GrGLFragmentProcessor { | 95 class GrGLMagnifierEffect : public GrGLFragmentProcessor { |
96 public: | 96 public: |
97 GrGLMagnifierEffect(const GrProcessor&); | 97 GrGLMagnifierEffect(const GrProcessor&); |
98 | 98 |
99 virtual void emitCode(GrGLFPBuilder*, | 99 virtual void emitCode(GrGLFPBuilder*, |
100 const GrFragmentProcessor&, | 100 const GrFragmentProcessor&, |
101 const char* outputColor, | 101 const char* outputColor, |
102 const char* inputColor, | 102 const char* inputColor, |
103 const TransformedCoordsArray&, | 103 const TransformedCoordsArray&, |
104 const TextureSamplerArray&) SK_OVERRIDE; | 104 const TextureSamplerArray&) override; |
105 | 105 |
106 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; | 106 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
107 | 107 |
108 private: | 108 private: |
109 UniformHandle fOffsetVar; | 109 UniformHandle fOffsetVar; |
110 UniformHandle fInvZoomVar; | 110 UniformHandle fInvZoomVar; |
111 UniformHandle fInvInsetVar; | 111 UniformHandle fInvInsetVar; |
112 | 112 |
113 typedef GrGLFragmentProcessor INHERITED; | 113 typedef GrGLFragmentProcessor INHERITED; |
114 }; | 114 }; |
115 | 115 |
116 GrGLMagnifierEffect::GrGLMagnifierEffect(const GrProcessor&) { | 116 GrGLMagnifierEffect::GrGLMagnifierEffect(const GrProcessor&) { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 #ifndef SK_IGNORE_TO_STRING | 357 #ifndef SK_IGNORE_TO_STRING |
358 void SkMagnifierImageFilter::toString(SkString* str) const { | 358 void SkMagnifierImageFilter::toString(SkString* str) const { |
359 str->appendf("SkMagnifierImageFilter: ("); | 359 str->appendf("SkMagnifierImageFilter: ("); |
360 str->appendf("src: (%f,%f,%f,%f) ", | 360 str->appendf("src: (%f,%f,%f,%f) ", |
361 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 361 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
362 str->appendf("inset: %f", fInset); | 362 str->appendf("inset: %f", fInset); |
363 str->append(")"); | 363 str->append(")"); |
364 } | 364 } |
365 #endif | 365 #endif |
OLD | NEW |