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

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

Issue 1128823010: Revert of antialias matrix-image-filter to get smooth diagonals (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/core/SkMatrixImageFilter.h ('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 2014 The Android Open Source Project 2 * Copyright 2014 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 "SkMatrixImageFilter.h" 8 #include "SkMatrixImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 matrix.postConcat(fTransform); 69 matrix.postConcat(fTransform);
70 matrix.postConcat(ctx.ctm()); 70 matrix.postConcat(ctx.ctm());
71 matrix.mapRect(&dstRect, srcRect); 71 matrix.mapRect(&dstRect, srcRect);
72 dstRect.roundOut(&dstBounds); 72 dstRect.roundOut(&dstBounds);
73 73
74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstBounds.width(), dst Bounds.height())); 74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstBounds.width(), dst Bounds.height()));
75 if (NULL == device.get()) { 75 if (NULL == device.get()) {
76 return false; 76 return false;
77 } 77 }
78 78
79 SkPaint paint;
80 paint.setFilterQuality(fFilterQuality);
81 paint.setAntiAlias(true); // since we may be rotated, we definitely want a smooth edge
82
83 SkCanvas canvas(device.get()); 79 SkCanvas canvas(device.get());
84 canvas.translate(-SkIntToScalar(dstBounds.x()), -SkIntToScalar(dstBounds.y() )); 80 canvas.translate(-SkIntToScalar(dstBounds.x()), -SkIntToScalar(dstBounds.y() ));
85 canvas.concat(matrix); 81 canvas.concat(matrix);
82 SkPaint paint;
83
84 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
85 paint.setFilterQuality(fFilterQuality);
86 canvas.drawBitmap(src, srcRect.x(), srcRect.y(), &paint); 86 canvas.drawBitmap(src, srcRect.x(), srcRect.y(), &paint);
87 87
88 *result = device.get()->accessBitmap(false); 88 *result = device.get()->accessBitmap(false);
89 offset->fX = dstBounds.fLeft; 89 offset->fX = dstBounds.fLeft;
90 offset->fY = dstBounds.fTop; 90 offset->fY = dstBounds.fTop;
91 return true; 91 return true;
92 } 92 }
93 93
94 void SkMatrixImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons t { 94 void SkMatrixImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons t {
95 SkRect bounds = src; 95 SkRect bounds = src;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 fTransform[SkMatrix::kMPersp2]); 139 fTransform[SkMatrix::kMPersp2]);
140 140
141 str->append("<dt>FilterLevel:</dt><dd>"); 141 str->append("<dt>FilterLevel:</dt><dd>");
142 static const char* gFilterLevelStrings[] = { "None", "Low", "Medium", "High" }; 142 static const char* gFilterLevelStrings[] = { "None", "Low", "Medium", "High" };
143 str->append(gFilterLevelStrings[fFilterQuality]); 143 str->append(gFilterLevelStrings[fFilterQuality]);
144 str->append("</dd>"); 144 str->append("</dd>");
145 145
146 str->appendf(")"); 146 str->appendf(")");
147 } 147 }
148 #endif 148 #endif
OLDNEW
« no previous file with comments | « src/core/SkMatrixImageFilter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698