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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); | 127 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); |
128 if (getInput(1) && !getInput(1)->getInputResultGPU(proxy, src, ctx, &foregro
und, | 128 if (getInput(1) && !getInput(1)->getInputResultGPU(proxy, src, ctx, &foregro
und, |
129 &foregroundOffset)) { | 129 &foregroundOffset)) { |
130 return onFilterImage(proxy, src, ctx, result, offset); | 130 return onFilterImage(proxy, src, ctx, result, offset); |
131 } | 131 } |
132 GrTexture* foregroundTex = foreground.getTexture(); | 132 GrTexture* foregroundTex = foreground.getTexture(); |
133 GrContext* context = foregroundTex->getContext(); | 133 GrContext* context = foregroundTex->getContext(); |
134 | 134 |
135 GrFragmentProcessor* xferProcessor = NULL; | 135 GrFragmentProcessor* xferProcessor = NULL; |
136 | 136 |
137 GrTextureDesc desc; | 137 GrSurfaceDesc desc; |
138 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 138 desc.fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag; |
139 desc.fWidth = src.width(); | 139 desc.fWidth = src.width(); |
140 desc.fHeight = src.height(); | 140 desc.fHeight = src.height(); |
141 desc.fConfig = kSkia8888_GrPixelConfig; | 141 desc.fConfig = kSkia8888_GrPixelConfig; |
142 SkAutoTUnref<GrTexture> dst( | 142 SkAutoTUnref<GrTexture> dst( |
143 context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); | 143 context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); |
144 if (!dst) { | 144 if (!dst) { |
145 return false; | 145 return false; |
146 } | 146 } |
147 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); | 147 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); |
148 | 148 |
(...skipping 16 matching lines...) Expand all Loading... |
165 paint.addColorProcessor(xferProcessor)->unref(); | 165 paint.addColorProcessor(xferProcessor)->unref(); |
166 context->drawRect(paint, srcRect); | 166 context->drawRect(paint, srcRect); |
167 | 167 |
168 offset->fX = backgroundOffset.fX; | 168 offset->fX = backgroundOffset.fX; |
169 offset->fY = backgroundOffset.fY; | 169 offset->fY = backgroundOffset.fY; |
170 WrapTexture(dst, src.width(), src.height(), result); | 170 WrapTexture(dst, src.width(), src.height(), result); |
171 return true; | 171 return true; |
172 } | 172 } |
173 | 173 |
174 #endif | 174 #endif |
OLD | NEW |