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

Side by Side Diff: gm/resizeimagefilter.cpp

Issue 1858353002: Update SkMatrixImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix fuzz Created 4 years, 8 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 | « gm/matriximagefilter.cpp ('k') | include/core/SkImageFilter.h » ('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 Google Inc. 2 * Copyright 2013 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 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkImageSource.h" 10 #include "SkImageSource.h"
(...skipping 21 matching lines...) Expand all
32 SkRect dstRect; 32 SkRect dstRect;
33 canvas->getTotalMatrix().mapRect(&dstRect, rect); 33 canvas->getTotalMatrix().mapRect(&dstRect, rect);
34 canvas->save(); 34 canvas->save();
35 SkScalar deviceScaleX = deviceSize.width() / dstRect.width(); 35 SkScalar deviceScaleX = deviceSize.width() / dstRect.width();
36 SkScalar deviceScaleY = deviceSize.height() / dstRect.height(); 36 SkScalar deviceScaleY = deviceSize.height() / dstRect.height();
37 canvas->translate(rect.x(), rect.y()); 37 canvas->translate(rect.x(), rect.y());
38 canvas->scale(deviceScaleX, deviceScaleY); 38 canvas->scale(deviceScaleX, deviceScaleY);
39 canvas->translate(-rect.x(), -rect.y()); 39 canvas->translate(-rect.x(), -rect.y());
40 SkMatrix matrix; 40 SkMatrix matrix;
41 matrix.setScale(SkScalarInvert(deviceScaleX), SkScalarInvert(deviceScale Y)); 41 matrix.setScale(SkScalarInvert(deviceScaleX), SkScalarInvert(deviceScale Y));
42 sk_sp<SkImageFilter> filter(SkImageFilter::CreateMatrixFilter(matrix, 42 sk_sp<SkImageFilter> filter(SkImageFilter::MakeMatrixFilter(matrix,
43 filterQual ity, 43 filterQualit y,
44 input.get( ))); 44 std::move(in put)));
45 SkPaint filteredPaint; 45 SkPaint filteredPaint;
46 filteredPaint.setImageFilter(std::move(filter)); 46 filteredPaint.setImageFilter(std::move(filter));
47 canvas->saveLayer(&rect, &filteredPaint); 47 canvas->saveLayer(&rect, &filteredPaint);
48 SkPaint paint; 48 SkPaint paint;
49 paint.setColor(0xFF00FF00); 49 paint.setColor(0xFF00FF00);
50 SkRect ovalRect = rect; 50 SkRect ovalRect = rect;
51 ovalRect.inset(SkIntToScalar(4), SkIntToScalar(4)); 51 ovalRect.inset(SkIntToScalar(4), SkIntToScalar(4));
52 canvas->drawOval(ovalRect, paint); 52 canvas->drawOval(ovalRect, paint);
53 canvas->restore(); // for saveLayer 53 canvas->restore(); // for saveLayer
54 canvas->restore(); 54 canvas->restore();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 private: 117 private:
118 typedef GM INHERITED; 118 typedef GM INHERITED;
119 }; 119 };
120 120
121 ////////////////////////////////////////////////////////////////////////////// 121 //////////////////////////////////////////////////////////////////////////////
122 122
123 DEF_GM(return new ResizeGM; ) 123 DEF_GM(return new ResizeGM; )
124 124
125 } 125 }
OLDNEW
« no previous file with comments | « gm/matriximagefilter.cpp ('k') | include/core/SkImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698