| 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 "SkBlendImageFilter.h" | 8 #include "SkBlendImageFilter.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 SkBlendImageFilter::Mode fMode; | 148 SkBlendImageFilter::Mode fMode; |
| 149 | 149 |
| 150 typedef GrEffect INHERITED; | 150 typedef GrEffect INHERITED; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 bool SkBlendImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBit
map* result) { | 153 bool SkBlendImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBit
map* result) { |
| 154 SkBitmap backgroundBM; | 154 SkBitmap backgroundBM; |
| 155 if (!SkImageFilterUtils::GetInputResultGPU(getBackgroundInput(), proxy, src,
&backgroundBM)) { | 155 if (!SkImageFilterUtils::GetInputResultGPU(getBackgroundInput(), proxy, src,
&backgroundBM)) { |
| 156 return false; | 156 return false; |
| 157 } | 157 } |
| 158 GrTexture* background = (GrTexture*) backgroundBM.getTexture(); | 158 GrTexture* background = backgroundBM.getTexture(); |
| 159 SkBitmap foregroundBM; | 159 SkBitmap foregroundBM; |
| 160 if (!SkImageFilterUtils::GetInputResultGPU(getForegroundInput(), proxy, src,
&foregroundBM)) { | 160 if (!SkImageFilterUtils::GetInputResultGPU(getForegroundInput(), proxy, src,
&foregroundBM)) { |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 GrTexture* foreground = (GrTexture*) foregroundBM.getTexture(); | 163 GrTexture* foreground = foregroundBM.getTexture(); |
| 164 GrContext* context = foreground->getContext(); | 164 GrContext* context = foreground->getContext(); |
| 165 | 165 |
| 166 GrTextureDesc desc; | 166 GrTextureDesc desc; |
| 167 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 167 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
| 168 desc.fWidth = src.width(); | 168 desc.fWidth = src.width(); |
| 169 desc.fHeight = src.height(); | 169 desc.fHeight = src.height(); |
| 170 desc.fConfig = kSkia8888_GrPixelConfig; | 170 desc.fConfig = kSkia8888_GrPixelConfig; |
| 171 | 171 |
| 172 GrAutoScratchTexture ast(context, desc); | 172 GrAutoScratchTexture ast(context, desc); |
| 173 SkAutoTUnref<GrTexture> dst(ast.detach()); | 173 SkAutoTUnref<GrTexture> dst(ast.detach()); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri
x(bgTex), | 312 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri
x(bgTex), |
| 313 drawEffect, | 313 drawEffect, |
| 314 kCoordsType, | 314 kCoordsType, |
| 315 bgTex); | 315 bgTex); |
| 316 bgKey <<= GrGLEffectMatrix::kKeyBits; | 316 bgKey <<= GrGLEffectMatrix::kKeyBits; |
| 317 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits); | 317 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits); |
| 318 | 318 |
| 319 return modeKey | bgKey | fgKey; | 319 return modeKey | bgKey | fgKey; |
| 320 } | 320 } |
| 321 #endif | 321 #endif |
| OLD | NEW |