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

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

Issue 186643003: Apply the CTM to the offset in the slow SkOffsetImageFilter path. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: SK_Scalar1 is my friend 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/offsetimagefilter.cpp ('k') | no next file » | 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 "SkOffsetImageFilter.h" 8 #include "SkOffsetImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo unds.height())); 52 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo unds.height()));
53 if (NULL == device.get()) { 53 if (NULL == device.get()) {
54 return false; 54 return false;
55 } 55 }
56 SkCanvas canvas(device); 56 SkCanvas canvas(device);
57 SkPaint paint; 57 SkPaint paint;
58 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 58 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
59 canvas.translate(SkIntToScalar(srcOffset.fX - bounds.fLeft), 59 canvas.translate(SkIntToScalar(srcOffset.fX - bounds.fLeft),
60 SkIntToScalar(srcOffset.fY - bounds.fTop)); 60 SkIntToScalar(srcOffset.fY - bounds.fTop));
61 canvas.drawBitmap(src, fOffset.x(), fOffset.y(), &paint); 61 SkVector vec;
62 matrix.mapVectors(&vec, &fOffset, 1);
63 canvas.drawBitmap(src, vec.x(), vec.y(), &paint);
62 *result = device->accessBitmap(false); 64 *result = device->accessBitmap(false);
63 offset->fX = bounds.fLeft; 65 offset->fX = bounds.fLeft;
64 offset->fY = bounds.fTop; 66 offset->fY = bounds.fTop;
65 } 67 }
66 return true; 68 return true;
67 } 69 }
68 70
69 void SkOffsetImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons t { 71 void SkOffsetImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons t {
70 if (getInput(0)) { 72 if (getInput(0)) {
71 getInput(0)->computeFastBounds(src, dst); 73 getInput(0)->computeFastBounds(src, dst);
(...skipping 25 matching lines...) Expand all
97 const CropRect* cropRect) : INHERITED(i nput, cropRect) { 99 const CropRect* cropRect) : INHERITED(i nput, cropRect) {
98 fOffset.set(dx, dy); 100 fOffset.set(dx, dy);
99 } 101 }
100 102
101 SkOffsetImageFilter::SkOffsetImageFilter(SkReadBuffer& buffer) 103 SkOffsetImageFilter::SkOffsetImageFilter(SkReadBuffer& buffer)
102 : INHERITED(1, buffer) { 104 : INHERITED(1, buffer) {
103 buffer.readPoint(&fOffset); 105 buffer.readPoint(&fOffset);
104 buffer.validate(SkScalarIsFinite(fOffset.fX) && 106 buffer.validate(SkScalarIsFinite(fOffset.fX) &&
105 SkScalarIsFinite(fOffset.fY)); 107 SkScalarIsFinite(fOffset.fY));
106 } 108 }
OLDNEW
« no previous file with comments | « gm/offsetimagefilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698