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

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

Issue 148883011: Make SkImageFilter methods const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More fixes to gm/ Created 6 years, 10 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
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 40
41 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const { 41 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const {
42 this->INHERITED::flatten(buffer); 42 this->INHERITED::flatten(buffer);
43 buffer.writeFlattenable(fMode); 43 buffer.writeFlattenable(fMode);
44 } 44 }
45 45
46 bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy, 46 bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy,
47 const SkBitmap& src, 47 const SkBitmap& src,
48 const SkMatrix& ctm, 48 const SkMatrix& ctm,
49 SkBitmap* dst, 49 SkBitmap* dst,
50 SkIPoint* offset) { 50 SkIPoint* offset) const {
51 SkBitmap background = src, foreground = src; 51 SkBitmap background = src, foreground = src;
52 SkImageFilter* backgroundInput = getInput(0); 52 SkImageFilter* backgroundInput = getInput(0);
53 SkImageFilter* foregroundInput = getInput(1); 53 SkImageFilter* foregroundInput = getInput(1);
54 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); 54 SkIPoint backgroundOffset = SkIPoint::Make(0, 0);
55 if (backgroundInput && 55 if (backgroundInput &&
56 !backgroundInput->filterImage(proxy, src, ctm, &background, &backgroundO ffset)) { 56 !backgroundInput->filterImage(proxy, src, ctm, &background, &backgroundO ffset)) {
57 return false; 57 return false;
58 } 58 }
59 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); 59 SkIPoint foregroundOffset = SkIPoint::Make(0, 0);
60 if (foregroundInput && 60 if (foregroundInput &&
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 offset->fY = bounds.top(); 93 offset->fY = bounds.top();
94 return true; 94 return true;
95 } 95 }
96 96
97 #if SK_SUPPORT_GPU 97 #if SK_SUPPORT_GPU
98 98
99 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, 99 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
100 const SkBitmap& src, 100 const SkBitmap& src,
101 const SkMatrix& ctm, 101 const SkMatrix& ctm,
102 SkBitmap* result, 102 SkBitmap* result,
103 SkIPoint* offset) { 103 SkIPoint* offset) const {
104 SkBitmap background; 104 SkBitmap background;
105 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); 105 SkIPoint backgroundOffset = SkIPoint::Make(0, 0);
106 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &ba ckground, 106 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &ba ckground,
107 &backgroundOffset)) { 107 &backgroundOffset)) {
108 return false; 108 return false;
109 } 109 }
110 GrTexture* backgroundTex = background.getTexture(); 110 GrTexture* backgroundTex = background.getTexture();
111 SkBitmap foreground; 111 SkBitmap foreground;
112 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); 112 SkIPoint foregroundOffset = SkIPoint::Make(0, 0);
113 if (!SkImageFilterUtils::GetInputResultGPU(getInput(1), proxy, src, ctm, &fo reground, 113 if (!SkImageFilterUtils::GetInputResultGPU(getInput(1), proxy, src, ctm, &fo reground,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen d(dm)); 157 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen d(dm));
158 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); 158 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix);
159 context->drawRect(foregroundPaint, srcRect); 159 context->drawRect(foregroundPaint, srcRect);
160 } 160 }
161 offset->fX = backgroundOffset.fX; 161 offset->fX = backgroundOffset.fX;
162 offset->fY = backgroundOffset.fY; 162 offset->fY = backgroundOffset.fY;
163 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t); 163 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t);
164 } 164 }
165 165
166 #endif 166 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698