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

Side by Side Diff: src/core/SkImageFilter.cpp

Issue 1234873005: Rename right & bottom crop edges to width & height. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Update to ToT; fix tests Created 5 years, 5 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 | « include/core/SkImageFilter.h ('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 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (fFlags & CropRect::kHasLeft_CropEdge) { 43 if (fFlags & CropRect::kHasLeft_CropEdge) {
44 str->appendf("%.2f, ", fRect.fLeft); 44 str->appendf("%.2f, ", fRect.fLeft);
45 } else { 45 } else {
46 str->appendf("X, "); 46 str->appendf("X, ");
47 } 47 }
48 if (fFlags & CropRect::kHasTop_CropEdge) { 48 if (fFlags & CropRect::kHasTop_CropEdge) {
49 str->appendf("%.2f, ", fRect.fTop); 49 str->appendf("%.2f, ", fRect.fTop);
50 } else { 50 } else {
51 str->appendf("X, "); 51 str->appendf("X, ");
52 } 52 }
53 if (fFlags & CropRect::kHasRight_CropEdge) { 53 if (fFlags & CropRect::kHasWidth_CropEdge) {
54 str->appendf("%.2f, ", fRect.fRight); 54 str->appendf("%.2f, ", fRect.width());
55 } else { 55 } else {
56 str->appendf("X, "); 56 str->appendf("X, ");
57 } 57 }
58 if (fFlags & CropRect::kHasBottom_CropEdge) { 58 if (fFlags & CropRect::kHasHeight_CropEdge) {
59 str->appendf("%.2f", fRect.fBottom); 59 str->appendf("%.2f", fRect.height());
60 } else { 60 } else {
61 str->appendf("X"); 61 str->appendf("X");
62 } 62 }
63 str->appendf(") "); 63 str->appendf(") ");
64 } 64 }
65 #endif 65 #endif
66 66
67 bool SkImageFilter::CropRect::applyTo(const SkIRect& imageBounds, const Context& ctx, 67 bool SkImageFilter::CropRect::applyTo(const SkIRect& imageBounds, const Context& ctx,
68 SkIRect* cropped) const { 68 SkIRect* cropped) const {
69 *cropped = imageBounds; 69 *cropped = imageBounds;
70 if (fFlags) { 70 if (fFlags) {
71 SkRect devCropR; 71 SkRect devCropR;
72 ctx.ctm().mapRect(&devCropR, fRect); 72 ctx.ctm().mapRect(&devCropR, fRect);
73 const SkIRect devICropR = devCropR.roundOut(); 73 const SkIRect devICropR = devCropR.roundOut();
74 74
75 // Compute the left/top first, in case we have to read them to compute r ight/bottom 75 // Compute the left/top first, in case we have to read them to compute r ight/bottom
76 if (fFlags & kHasLeft_CropEdge) { 76 if (fFlags & kHasLeft_CropEdge) {
77 cropped->fLeft = devICropR.fLeft; 77 cropped->fLeft = devICropR.fLeft;
78 } 78 }
79 if (fFlags & kHasTop_CropEdge) { 79 if (fFlags & kHasTop_CropEdge) {
80 cropped->fTop = devICropR.fTop; 80 cropped->fTop = devICropR.fTop;
81 } 81 }
82 if (fFlags & kHasRight_CropEdge) { 82 if (fFlags & kHasWidth_CropEdge) {
83 cropped->fRight = cropped->fLeft + devICropR.width(); 83 cropped->fRight = cropped->fLeft + devICropR.width();
84 } 84 }
85 if (fFlags & kHasBottom_CropEdge) { 85 if (fFlags & kHasHeight_CropEdge) {
86 cropped->fBottom = cropped->fTop + devICropR.height(); 86 cropped->fBottom = cropped->fTop + devICropR.height();
87 } 87 }
88 } 88 }
89 return cropped->intersect(ctx.clipBounds()); 89 return cropped->intersect(ctx.clipBounds());
90 } 90 }
91 91
92 //////////////////////////////////////////////////////////////////////////////// /////////////////// 92 //////////////////////////////////////////////////////////////////////////////// ///////////////////
93 93
94 static int32_t next_image_filter_unique_id() { 94 static int32_t next_image_filter_unique_id() {
95 static int32_t gImageFilterUniqueID; 95 static int32_t gImageFilterUniqueID;
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 579 }
580 return dev; 580 return dev;
581 } 581 }
582 582
583 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm ap& src, 583 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm ap& src,
584 const SkImageFilter::Context& ctx, 584 const SkImageFilter::Context& ctx,
585 SkBitmap* result, SkIPoint* offset) { 585 SkBitmap* result, SkIPoint* offset) {
586 return fDevice->filterImage(filter, src, ctx, result, offset); 586 return fDevice->filterImage(filter, src, ctx, result, offset);
587 } 587 }
588 588
OLDNEW
« no previous file with comments | « include/core/SkImageFilter.h ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698