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

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

Issue 27521002: Remove support for SK_CROP_RECT_IS_INT, now that it is no longer used in Blink or Chrome. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add comment Created 7 years, 2 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/SkImageFilter.cpp ('k') | tests/ImageFilterTest.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"
11 #include "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkFlattenableBuffers.h" 12 #include "SkFlattenableBuffers.h"
13 #include "SkShader.h" 13 #include "SkShader.h"
14 14
15 SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRe ct& rect) { 15 SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRe ct& rect) {
16 SkASSERT(s); 16 SkASSERT(s);
17 #ifdef SK_CROP_RECT_IS_INT
18 SkIRect cropRect;
19 if (rect.width() == 0 || rect.height() == 0) {
20 cropRect = SkIRect::MakeLargest();
21 } else {
22 rect.roundOut(&cropRect);
23 }
24 #else
25 uint32_t flags = CropRect::kHasAll_CropEdge; 17 uint32_t flags = CropRect::kHasAll_CropEdge;
26 if (rect.width() == 0 || rect.height() == 0) { 18 if (rect.width() == 0 || rect.height() == 0) {
27 flags = 0x0; 19 flags = 0x0;
28 } 20 }
29 CropRect cropRect(rect, flags); 21 CropRect cropRect(rect, flags);
30 #endif
31 return SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect)); 22 return SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect));
32 } 23 }
33 24
34 SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const Crop Rect* cropRect) { 25 SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const Crop Rect* cropRect) {
35 SkASSERT(s); 26 SkASSERT(s);
36 return SkNEW_ARGS(SkRectShaderImageFilter, (s, cropRect)); 27 return SkNEW_ARGS(SkRectShaderImageFilter, (s, cropRect));
37 } 28 }
38 29
39 SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cr opRect) 30 SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cr opRect)
40 : INHERITED(NULL, cropRect) 31 : INHERITED(NULL, cropRect)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 SkMatrix matrix; 68 SkMatrix matrix;
78 matrix.setTranslate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop )); 69 matrix.setTranslate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop ));
79 fShader->setLocalMatrix(matrix); 70 fShader->setLocalMatrix(matrix);
80 SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bo unds.height())); 71 SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bo unds.height()));
81 canvas.drawRect(rect, paint); 72 canvas.drawRect(rect, paint);
82 *result = device.get()->accessBitmap(false); 73 *result = device.get()->accessBitmap(false);
83 offset->fX += bounds.fLeft; 74 offset->fX += bounds.fLeft;
84 offset->fY += bounds.fTop; 75 offset->fY += bounds.fTop;
85 return true; 76 return true;
86 } 77 }
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698