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

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

Issue 185973003: Cleanup patch to move all of SkImageFilterUtils into SkImageFilter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Oh, the Rietveld suckage Created 6 years, 9 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
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
19 result->setConfig(info);
20 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
21 return true;
22 }
23
24 bool SkImageFilterUtils::GetInputResultGPU(const SkImageFilter* filter, SkImageF ilter::Proxy* proxy,
25 const SkBitmap& src, const SkMatrix& ctm,
26 SkBitmap* result, SkIPoint* offset) {
27 // Ensure that GrContext calls under filterImage and filterImageGPU below wi ll see an identity
28 // matrix with no clip and that the matrix, clip, and render target set befo re this function was
29 // called are restored before we return to the caller.
30 GrContext* context = src.getTexture()->getContext();
31 GrContext::AutoWideOpenIdentityDraw awoid(context, NULL);
32 if (!filter) {
33 offset->fX = offset->fY = 0;
34 *result = src;
35 return true;
36 } else if (filter->canFilterImageGPU()) {
37 return filter->filterImageGPU(proxy, src, ctm, result, offset);
38 } else {
39 if (filter->filterImage(proxy, src, ctm, result, offset)) {
40 if (!result->getTexture()) {
41 SkImageInfo info;
42 if (!result->asImageInfo(&info)) {
43 return false;
44 }
45 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, *result, NULL);
46 result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref();
47 GrUnlockAndUnrefCachedBitmapTexture(resultTex);
48 }
49 return true;
50 } else {
51 return false;
52 }
53 }
54 }
55 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698