Now that the SkImageFilter::CropRect crop edges refer to
width & height, name them appropriately. BUG=240827 Review URL: https://codereview.chromium.org/1234873005
This commit is contained in:
parent
47d280d3b0
commit
ed7cf27322
@ -64,8 +64,12 @@ public:
|
||||
enum CropEdge {
|
||||
kHasLeft_CropEdge = 0x01,
|
||||
kHasTop_CropEdge = 0x02,
|
||||
kHasRight_CropEdge = 0x04,
|
||||
kHasBottom_CropEdge = 0x08,
|
||||
kHasWidth_CropEdge = 0x04,
|
||||
kHasHeight_CropEdge = 0x08,
|
||||
#ifdef SK_LEGACY_IMAGE_FILTER_CROP_RECT_EDGES
|
||||
kHasRight_CropEdge = kHasWidth_CropEdge,
|
||||
kHasBottom_CropEdge = kHasHeight_CropEdge,
|
||||
#endif
|
||||
kHasAll_CropEdge = 0x0F,
|
||||
};
|
||||
CropRect() {}
|
||||
|
@ -50,13 +50,13 @@ void SkImageFilter::CropRect::toString(SkString* str) const {
|
||||
} else {
|
||||
str->appendf("X, ");
|
||||
}
|
||||
if (fFlags & CropRect::kHasRight_CropEdge) {
|
||||
str->appendf("%.2f, ", fRect.fRight);
|
||||
if (fFlags & CropRect::kHasWidth_CropEdge) {
|
||||
str->appendf("%.2f, ", fRect.width());
|
||||
} else {
|
||||
str->appendf("X, ");
|
||||
}
|
||||
if (fFlags & CropRect::kHasBottom_CropEdge) {
|
||||
str->appendf("%.2f", fRect.fBottom);
|
||||
if (fFlags & CropRect::kHasHeight_CropEdge) {
|
||||
str->appendf("%.2f", fRect.height());
|
||||
} else {
|
||||
str->appendf("X");
|
||||
}
|
||||
@ -79,10 +79,10 @@ bool SkImageFilter::CropRect::applyTo(const SkIRect& imageBounds, const Context&
|
||||
if (fFlags & kHasTop_CropEdge) {
|
||||
cropped->fTop = devICropR.fTop;
|
||||
}
|
||||
if (fFlags & kHasRight_CropEdge) {
|
||||
if (fFlags & kHasWidth_CropEdge) {
|
||||
cropped->fRight = cropped->fLeft + devICropR.width();
|
||||
}
|
||||
if (fFlags & kHasBottom_CropEdge) {
|
||||
if (fFlags & kHasHeight_CropEdge) {
|
||||
cropped->fBottom = cropped->fTop + devICropR.height();
|
||||
}
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ DEF_TEST(PartialCropRect, reporter) {
|
||||
SkImageFilter::Proxy proxy(&device);
|
||||
|
||||
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30),
|
||||
SkImageFilter::CropRect::kHasRight_CropEdge | SkImageFilter::CropRect::kHasBottom_CropEdge);
|
||||
SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::kHasHeight_CropEdge);
|
||||
SkAutoTUnref<SkImageFilter> filter(make_grayscale(NULL, &cropRect));
|
||||
SkBitmap result;
|
||||
SkIPoint offset;
|
||||
|
Loading…
Reference in New Issue
Block a user