OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 "SkXfermodeImageFilter.h" | 8 #include "SkXfermodeImageFilter.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, | 129 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, |
130 const SkBitmap& src, | 130 const SkBitmap& src, |
131 const Context& ctx, | 131 const Context& ctx, |
132 SkBitmap* result, | 132 SkBitmap* result, |
133 SkIPoint* offset) const { | 133 SkIPoint* offset) const { |
134 SkBitmap background = src; | 134 SkBitmap background = src; |
135 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); | 135 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); |
136 if (this->getInput(0) && | 136 if (this->getInput(0) && |
137 !this->getInput(0)->getInputResultGPU(proxy, src, ctx, &background, &bac
kgroundOffset)) { | 137 !this->getInput(0)->getInputResultGPU(proxy, src, ctx, &background, &bac
kgroundOffset)) { |
138 return this->onFilterImage(proxy, src, ctx, result, offset); | 138 return false; |
139 } | 139 } |
140 | 140 |
141 GrTexture* backgroundTex = background.getTexture(); | 141 GrTexture* backgroundTex = background.getTexture(); |
142 if (NULL == backgroundTex) { | 142 if (NULL == backgroundTex) { |
143 SkASSERT(false); | 143 SkASSERT(false); |
144 return false; | 144 return false; |
145 } | 145 } |
146 | 146 |
147 SkBitmap foreground = src; | 147 SkBitmap foreground = src; |
148 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); | 148 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); |
149 if (this->getInput(1) && | 149 if (this->getInput(1) && |
150 !this->getInput(1)->getInputResultGPU(proxy, src, ctx, &foreground, &for
egroundOffset)) { | 150 !this->getInput(1)->getInputResultGPU(proxy, src, ctx, &foreground, &for
egroundOffset)) { |
151 return this->onFilterImage(proxy, src, ctx, result, offset); | 151 return false; |
152 } | 152 } |
153 GrTexture* foregroundTex = foreground.getTexture(); | 153 GrTexture* foregroundTex = foreground.getTexture(); |
154 GrContext* context = foregroundTex->getContext(); | 154 GrContext* context = foregroundTex->getContext(); |
155 | 155 |
156 GrFragmentProcessor* xferProcessor = NULL; | 156 GrFragmentProcessor* xferProcessor = NULL; |
157 | 157 |
158 GrSurfaceDesc desc; | 158 GrSurfaceDesc desc; |
159 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 159 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
160 desc.fWidth = src.width(); | 160 desc.fWidth = src.width(); |
161 desc.fHeight = src.height(); | 161 desc.fHeight = src.height(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 SkMatrix::I(), srcRect); | 201 SkMatrix::I(), srcRect); |
202 | 202 |
203 offset->fX = backgroundOffset.fX; | 203 offset->fX = backgroundOffset.fX; |
204 offset->fY = backgroundOffset.fY; | 204 offset->fY = backgroundOffset.fY; |
205 WrapTexture(dst, src.width(), src.height(), result); | 205 WrapTexture(dst, src.width(), src.height(), result); |
206 return true; | 206 return true; |
207 } | 207 } |
208 | 208 |
209 #endif | 209 #endif |
210 | 210 |
OLD | NEW |