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

Side by Side Diff: gm/bigtileimagefilter.cpp

Issue 1882113002: Update TileImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT 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 | « fuzz/FilterFuzz.cpp ('k') | gm/filterfastbounds.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 2015 Google Inc. 2 * Copyright 2015 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 "SkImageSource.h" 8 #include "SkImageSource.h"
9 #include "SkSurface.h" 9 #include "SkSurface.h"
10 #include "SkTileImageFilter.h" 10 #include "SkTileImageFilter.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 void onDraw(SkCanvas* canvas) override { 51 void onDraw(SkCanvas* canvas) override {
52 canvas->clear(SK_ColorBLACK); 52 canvas->clear(SK_ColorBLACK);
53 53
54 { 54 {
55 SkPaint p; 55 SkPaint p;
56 56
57 const SkRect bound = SkRect::MakeIWH(kWidth, kHeight); 57 const SkRect bound = SkRect::MakeIWH(kWidth, kHeight);
58 sk_sp<SkImageFilter> imageSource(SkImageSource::Make(fRedImage)); 58 sk_sp<SkImageFilter> imageSource(SkImageSource::Make(fRedImage));
59 59
60 sk_sp<SkImageFilter> tif(SkTileImageFilter::Create( 60 sk_sp<SkImageFilter> tif(SkTileImageFilter::Make(
61 SkRect::MakeIWH(kBitmapSize, kBitmapSize), 61 SkRect::MakeIWH(kBitmapSize, kBitmapSize),
62 SkRect::MakeIWH(kWidth, kHei ght), 62 SkRect::MakeIWH(kWidth, kHei ght),
63 imageSource.get())); 63 std::move(imageSource)));
64 64
65 p.setImageFilter(std::move(tif)); 65 p.setImageFilter(std::move(tif));
66 66
67 canvas->saveLayer(&bound, &p); 67 canvas->saveLayer(&bound, &p);
68 canvas->restore(); 68 canvas->restore();
69 } 69 }
70 70
71 { 71 {
72 SkPaint p2; 72 SkPaint p2;
73 73
74 const SkRect bound2 = SkRect::MakeIWH(kBitmapSize, kBitmapSize); 74 const SkRect bound2 = SkRect::MakeIWH(kBitmapSize, kBitmapSize);
75 75
76 sk_sp<SkImageFilter> tif(SkTileImageFilter::Create( 76 sk_sp<SkImageFilter> tif(SkTileImageFilter::Make(
77 SkRect::MakeIWH(kBitmapS ize, kBitmapSize), 77 SkRect::MakeIWH(kBitmapS ize, kBitmapSize),
78 SkRect::MakeIWH(kBitmapS ize, kBitmapSize), 78 SkRect::MakeIWH(kBitmapS ize, kBitmapSize),
79 nullptr)); 79 nullptr));
80 80
81 p2.setImageFilter(std::move(tif)); 81 p2.setImageFilter(std::move(tif));
82 82
83 canvas->translate(320, 320); 83 canvas->translate(320, 320);
84 canvas->saveLayer(&bound2, &p2); 84 canvas->saveLayer(&bound2, &p2);
85 canvas->setMatrix(SkMatrix::I()); 85 canvas->setMatrix(SkMatrix::I());
86 86
(...skipping 14 matching lines...) Expand all
101 sk_sp<SkImage> fRedImage; 101 sk_sp<SkImage> fRedImage;
102 sk_sp<SkImage> fGreenImage; 102 sk_sp<SkImage> fGreenImage;
103 103
104 typedef GM INHERITED; 104 typedef GM INHERITED;
105 }; 105 };
106 106
107 ////////////////////////////////////////////////////////////////////////////// 107 //////////////////////////////////////////////////////////////////////////////
108 108
109 DEF_GM(return new BigTileImageFilterGM;) 109 DEF_GM(return new BigTileImageFilterGM;)
110 } 110 }
OLDNEW
« no previous file with comments | « fuzz/FilterFuzz.cpp ('k') | gm/filterfastbounds.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698