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

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

Issue 1772463002: use Make instead of Create to return a shared shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: partial update of skia call-sites Created 4 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
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 "SkTileImageFilter.h" 8 #include "SkTileImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SkASSERT(subset.width() == srcIRect.width()); 89 SkASSERT(subset.width() == srcIRect.width());
90 SkASSERT(subset.height() == srcIRect.height()); 90 SkASSERT(subset.height() == srcIRect.height());
91 91
92 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(w, h)); 92 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(w, h));
93 if (nullptr == device.get()) { 93 if (nullptr == device.get()) {
94 return false; 94 return false;
95 } 95 }
96 SkCanvas canvas(device); 96 SkCanvas canvas(device);
97 SkPaint paint; 97 SkPaint paint;
98 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 98 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
99 99 paint.setShader(SkShader::MakeBitmapShader(subset, SkShader::kRepeat_TileMod e,
100 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(subset, 100 SkShader::kRepeat_TileMode));
101 SkShader::kRepeat_TileMode, SkShader::kRepeat_ TileMode));
102 paint.setShader(shader);
103 canvas.translate(-dstRect.fLeft, -dstRect.fTop); 101 canvas.translate(-dstRect.fLeft, -dstRect.fTop);
104 canvas.drawRect(dstRect, paint); 102 canvas.drawRect(dstRect, paint);
105 *dst = device->accessBitmap(false); 103 *dst = device->accessBitmap(false);
106 offset->fX = dstIRect.fLeft; 104 offset->fX = dstIRect.fLeft;
107 offset->fY = dstIRect.fTop; 105 offset->fY = dstIRect.fTop;
108 return true; 106 return true;
109 } 107 }
110 108
111 void SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& c tm, 109 void SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& c tm,
112 SkIRect* dst, MapDirection direction) const { 110 SkIRect* dst, MapDirection direction) const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 str->appendf(" dst: %.2f %.2f %.2f %.2f", 146 str->appendf(" dst: %.2f %.2f %.2f %.2f",
149 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m); 147 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m);
150 if (this->getInput(0)) { 148 if (this->getInput(0)) {
151 str->appendf("input: ("); 149 str->appendf("input: (");
152 this->getInput(0)->toString(str); 150 this->getInput(0)->toString(str);
153 str->appendf(")"); 151 str->appendf(")");
154 } 152 }
155 str->append(")"); 153 str->append(")");
156 } 154 }
157 #endif 155 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698