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

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

Issue 189913021: Implement support for a Context parameter in image filters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Revert all but the Context changes. 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/effects/SkBicubicImageFilter.cpp ('k') | src/effects/SkBlurImageFilter.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 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 "SkBitmapSource.h" 8 #include "SkBitmapSource.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 24 matching lines...) Expand all
35 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect (fDstRect)); 35 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect (fDstRect));
36 } 36 }
37 37
38 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const { 38 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const {
39 this->INHERITED::flatten(buffer); 39 this->INHERITED::flatten(buffer);
40 fBitmap.flatten(buffer); 40 fBitmap.flatten(buffer);
41 buffer.writeRect(fSrcRect); 41 buffer.writeRect(fSrcRect);
42 buffer.writeRect(fDstRect); 42 buffer.writeRect(fDstRect);
43 } 43 }
44 44
45 bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const SkMatrix & matrix, 45 bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const Context& ctx,
46 SkBitmap* result, SkIPoint* offset) const { 46 SkBitmap* result, SkIPoint* offset) const {
47 SkRect bounds, dstRect; 47 SkRect bounds, dstRect;
48 fBitmap.getBounds(&bounds); 48 fBitmap.getBounds(&bounds);
49 matrix.mapRect(&dstRect, fDstRect); 49 ctx.ctm().mapRect(&dstRect, fDstRect);
50 if (fSrcRect == bounds && dstRect == bounds) { 50 if (fSrcRect == bounds && dstRect == bounds) {
51 // No regions cropped out or resized; return entire bitmap. 51 // No regions cropped out or resized; return entire bitmap.
52 *result = fBitmap; 52 *result = fBitmap;
53 offset->fX = offset->fY = 0; 53 offset->fX = offset->fY = 0;
54 return true; 54 return true;
55 } 55 }
56 SkIRect dstIRect; 56 SkIRect dstIRect;
57 dstRect.roundOut(&dstIRect); 57 dstRect.roundOut(&dstIRect);
58 58
59 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstIRect.width(), dstI Rect.height())); 59 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstIRect.width(), dstI Rect.height()));
(...skipping 22 matching lines...) Expand all
82 82
83 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { 83 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const {
84 *dst = fDstRect; 84 *dst = fDstRect;
85 } 85 }
86 86
87 bool SkBitmapSource::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, 87 bool SkBitmapSource::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
88 SkIRect* dst) const { 88 SkIRect* dst) const {
89 *dst = src; 89 *dst = src;
90 return true; 90 return true;
91 } 91 }
OLDNEW
« no previous file with comments | « src/effects/SkBicubicImageFilter.cpp ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698