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

Side by Side Diff: gm/imagefiltersgraph.cpp

Issue 198003008: Implement support for expanding crop rects in image filters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix ImageFilterTest 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 | « gm/imagefilterscropexpand.cpp ('k') | gyp/gmslides.gypi » ('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 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 "gm.h" 8 #include "gm.h"
9 9
10 #include "SkArithmeticMode.h" 10 #include "SkArithmeticMode.h"
(...skipping 21 matching lines...) Expand all
32 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx, 32 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
33 SkBitmap* dst, SkIPoint* offset) const SK_OVERRID E { 33 SkBitmap* dst, SkIPoint* offset) const SK_OVERRID E {
34 SkBitmap source = src; 34 SkBitmap source = src;
35 SkImageFilter* input = getInput(0); 35 SkImageFilter* input = getInput(0);
36 SkIPoint srcOffset = SkIPoint::Make(0, 0); 36 SkIPoint srcOffset = SkIPoint::Make(0, 0);
37 if (NULL != input && !input->filterImage(proxy, src, ctx, &source, &srcO ffset)) { 37 if (NULL != input && !input->filterImage(proxy, src, ctx, &source, &srcO ffset)) {
38 return false; 38 return false;
39 } 39 }
40 40
41 SkIRect bounds; 41 SkIRect bounds;
42 source.getBounds(&bounds); 42 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc e)) {
43
44 if (!this->applyCropRect(&bounds, ctx.ctm())) {
45 return false; 43 return false;
46 } 44 }
47 45
48 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo unds.height())); 46 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo unds.height()));
49 SkCanvas canvas(device); 47 SkCanvas canvas(device);
50 SkPaint paint; 48 SkPaint paint;
51 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 49 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
52 canvas.drawBitmap(source, fDX - bounds.left(), fDY - bounds.top(), &pain t); 50 canvas.drawBitmap(source, fDX - bounds.left(), fDY - bounds.top(), &pain t);
53 *dst = device->accessBitmap(false); 51 *dst = device->accessBitmap(false);
54 offset->fX += bounds.left(); 52 offset->fX += bounds.left();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 private: 206 private:
209 typedef GM INHERITED; 207 typedef GM INHERITED;
210 SkBitmap fBitmap; 208 SkBitmap fBitmap;
211 bool fInitialized; 209 bool fInitialized;
212 }; 210 };
213 211
214 /////////////////////////////////////////////////////////////////////////////// 212 ///////////////////////////////////////////////////////////////////////////////
215 213
216 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } 214 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; }
217 static skiagm::GMRegistry reg(MyFactory); 215 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/imagefilterscropexpand.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698