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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 GrAutoScratchTexture dst(context, desc); | 120 GrAutoScratchTexture dst(context, desc); |
121 GrContext::AutoMatrix am; | 121 GrContext::AutoMatrix am; |
122 am.setIdentity(context); | 122 am.setIdentity(context); |
123 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget()); | 123 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget()); |
124 GrContext::AutoClip acs(context, rect); | 124 GrContext::AutoClip acs(context, rect); |
125 GrEffectRef* effect; | 125 GrEffectRef* effect; |
126 this->asNewEffect(&effect, srcTexture); | 126 this->asNewEffect(&effect, srcTexture); |
127 SkASSERT(effect); | 127 SkASSERT(effect); |
128 SkAutoUnref effectRef(effect); | 128 SkAutoUnref effectRef(effect); |
129 GrPaint paint; | 129 GrPaint paint; |
130 paint.colorStage(0)->setEffect(effect); | 130 paint.addColorEffect(effect); |
131 context->drawRect(paint, rect); | 131 context->drawRect(paint, rect); |
132 SkAutoTUnref<GrTexture> resultTex(dst.detach()); | 132 SkAutoTUnref<GrTexture> resultTex(dst.detach()); |
133 SkImageFilterUtils::WrapTexture(resultTex, input.width(), input.height(), re
sult); | 133 SkImageFilterUtils::WrapTexture(resultTex, input.width(), input.height(), re
sult); |
134 return true; | 134 return true; |
135 #else | 135 #else |
136 return false; | 136 return false; |
137 #endif | 137 #endif |
138 } | 138 } |
139 | 139 |
140 bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, | 140 bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
141 SkIRect* dst) { | 141 SkIRect* dst) { |
142 *dst = src; | 142 *dst = src; |
143 return true; | 143 return true; |
144 } | 144 } |
145 | 145 |
146 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*) const { | 146 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*) const { |
147 return false; | 147 return false; |
148 } | 148 } |
149 | 149 |
150 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 150 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
151 return false; | 151 return false; |
152 } | 152 } |
OLD | NEW |