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

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

Issue 279563002: hide get/setLocalMatrix (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/pdf/SkPDFDeviceFlattener.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 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 "SkRectShaderImageFilter.h" 8 #include "SkRectShaderImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (!this->applyCropRect(ctx, source, SkIPoint::Make(0, 0), &bounds)) { 59 if (!this->applyCropRect(ctx, source, SkIPoint::Make(0, 0), &bounds)) {
60 return false; 60 return false;
61 } 61 }
62 62
63 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), 63 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(),
64 bounds.height())); 64 bounds.height()));
65 if (NULL == device.get()) { 65 if (NULL == device.get()) {
66 return false; 66 return false;
67 } 67 }
68 SkCanvas canvas(device.get()); 68 SkCanvas canvas(device.get());
69
69 SkPaint paint; 70 SkPaint paint;
70 paint.setShader(fShader);
71 SkMatrix matrix(ctx.ctm()); 71 SkMatrix matrix(ctx.ctm());
72 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to p())); 72 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to p()));
73 fShader->setLocalMatrix(matrix); 73 paint.setShader(SkShader::CreateLocalMatrixShader(fShader, matrix))->unref() ;
74
74 SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bo unds.height())); 75 SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bo unds.height()));
75 canvas.drawRect(rect, paint); 76 canvas.drawRect(rect, paint);
77
76 *result = device.get()->accessBitmap(false); 78 *result = device.get()->accessBitmap(false);
77 offset->fX = bounds.fLeft; 79 offset->fX = bounds.fLeft;
78 offset->fY = bounds.fTop; 80 offset->fY = bounds.fTop;
79 return true; 81 return true;
80 } 82 }
OLDNEW
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/pdf/SkPDFDeviceFlattener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698