Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: src/effects/SkImageFilterUtils.cpp

Issue 13602013: Allow single-pass filters (which use asNewEffect()) to participate in the image filter DAG. This w… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix return value of SkImageFilter::asNewEffect(). Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkMatrix.h"
9
10 #if SK_SUPPORT_GPU
11 #include "GrTexture.h"
12 #include "SkImageFilterUtils.h"
13 #include "SkBitmap.h"
14 #include "SkGrPixelRef.h"
15 #include "SkGr.h"
16
17 bool SkImageFilterUtils::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) {
18 SkASSERT(texture->config() == kSkia8888_GrPixelConfig);
19 result->setConfig(SkBitmap::kARGB_8888_Config, width, height);
20 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (texture)))->unref();
21 return true;
22 }
23
24 bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter: :Proxy* proxy, const SkBitmap& src, SkBitmap* result) {
25 if (!filter) {
26 *result = src;
27 return true;
28 } else if (filter->canFilterImageGPU()) {
29 return filter->filterImageGPU(proxy, src, result);
30 } else {
31 SkIPoint offset;
32 if (filter->filterImage(proxy, src, SkMatrix(), result, &offset)) {
33 if (!result->getTexture()) {
34 GrContext* context = ((GrTexture *) src.getTexture())->getContex t();
35 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context,
36 *result, NULL);
37 result->setPixelRef(new SkGrPixelRef(resultTex))->unref();
38 GrUnlockAndUnrefCachedBitmapTexture(resultTex);
39 }
40 return true;
41 } else {
42 return false;
43 }
44 }
45 }
46 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698