fix odd-pixel bug in mipmap downsamplers (thanks brett)
git-svn-id: http://skia.googlecode.com/svn/trunk@204 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
bbff1d507a
commit
829c83c7c9
@ -813,6 +813,7 @@ static void downsampleby2_proc32(SkBitmap* dst, int x, int y,
|
|||||||
x <<= 1;
|
x <<= 1;
|
||||||
y <<= 1;
|
y <<= 1;
|
||||||
const SkPMColor* p = src.getAddr32(x, y);
|
const SkPMColor* p = src.getAddr32(x, y);
|
||||||
|
const SkPMColor* baseP = p;
|
||||||
SkPMColor c, ag, rb;
|
SkPMColor c, ag, rb;
|
||||||
|
|
||||||
c = *p; ag = (c >> 8) & 0xFF00FF; rb = c & 0xFF00FF;
|
c = *p; ag = (c >> 8) & 0xFF00FF; rb = c & 0xFF00FF;
|
||||||
@ -821,8 +822,9 @@ static void downsampleby2_proc32(SkBitmap* dst, int x, int y,
|
|||||||
}
|
}
|
||||||
c = *p; ag += (c >> 8) & 0xFF00FF; rb += c & 0xFF00FF;
|
c = *p; ag += (c >> 8) & 0xFF00FF; rb += c & 0xFF00FF;
|
||||||
|
|
||||||
|
p = baseP;
|
||||||
if (y < src.height() - 1) {
|
if (y < src.height() - 1) {
|
||||||
p = src.getAddr32(x, y + 1);
|
p += src.rowBytes() >> 2;
|
||||||
}
|
}
|
||||||
c = *p; ag += (c >> 8) & 0xFF00FF; rb += c & 0xFF00FF;
|
c = *p; ag += (c >> 8) & 0xFF00FF; rb += c & 0xFF00FF;
|
||||||
if (x < src.width() - 1) {
|
if (x < src.width() - 1) {
|
||||||
@ -849,19 +851,21 @@ static void downsampleby2_proc16(SkBitmap* dst, int x, int y,
|
|||||||
x <<= 1;
|
x <<= 1;
|
||||||
y <<= 1;
|
y <<= 1;
|
||||||
const uint16_t* p = src.getAddr16(x, y);
|
const uint16_t* p = src.getAddr16(x, y);
|
||||||
|
const uint16_t* baseP = p;
|
||||||
SkPMColor c;
|
SkPMColor c;
|
||||||
|
|
||||||
c = expand16(*p);
|
c = expand16(*p);
|
||||||
if (x < (int)src.width() - 1) {
|
if (x < src.width() - 1) {
|
||||||
p += 1;
|
p += 1;
|
||||||
}
|
}
|
||||||
c += expand16(*p);
|
c += expand16(*p);
|
||||||
|
|
||||||
if (y < (int)src.height() - 1) {
|
p = baseP;
|
||||||
p = src.getAddr16(x, y + 1);
|
if (y < src.height() - 1) {
|
||||||
|
p += src.rowBytes() >> 1;
|
||||||
}
|
}
|
||||||
c += expand16(*p);
|
c += expand16(*p);
|
||||||
if (x < (int)src.width() - 1) {
|
if (x < src.width() - 1) {
|
||||||
p += 1;
|
p += 1;
|
||||||
}
|
}
|
||||||
c += expand16(*p);
|
c += expand16(*p);
|
||||||
@ -882,6 +886,7 @@ static void downsampleby2_proc4444(SkBitmap* dst, int x, int y,
|
|||||||
x <<= 1;
|
x <<= 1;
|
||||||
y <<= 1;
|
y <<= 1;
|
||||||
const uint16_t* p = src.getAddr16(x, y);
|
const uint16_t* p = src.getAddr16(x, y);
|
||||||
|
const uint16_t* baseP = p;
|
||||||
uint32_t c;
|
uint32_t c;
|
||||||
|
|
||||||
c = expand4444(*p);
|
c = expand4444(*p);
|
||||||
@ -890,8 +895,9 @@ static void downsampleby2_proc4444(SkBitmap* dst, int x, int y,
|
|||||||
}
|
}
|
||||||
c += expand4444(*p);
|
c += expand4444(*p);
|
||||||
|
|
||||||
|
p = baseP;
|
||||||
if (y < src.height() - 1) {
|
if (y < src.height() - 1) {
|
||||||
p = src.getAddr16(x, y + 1);
|
p += src.rowBytes() >> 1;
|
||||||
}
|
}
|
||||||
c += expand4444(*p);
|
c += expand4444(*p);
|
||||||
if (x < src.width() - 1) {
|
if (x < src.width() - 1) {
|
||||||
|
@ -95,6 +95,27 @@
|
|||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
000A99D20FDD3530007E45BD /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0096583F0FC71CA700C3AE15 /* core.xcodeproj */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = D2AAC045055464E500DB518D /* core */;
|
||||||
|
remoteInfo = core;
|
||||||
|
};
|
||||||
|
000A99D40FDD3534007E45BD /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0064EE5E0FC72C9600D71FB0 /* effects.xcodeproj */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = D2AAC045055464E500DB518D /* effects */;
|
||||||
|
remoteInfo = effects;
|
||||||
|
};
|
||||||
|
000A99D60FDD3538007E45BD /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0096585B0FC7201800C3AE15 /* maccore.xcodeproj */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = D2AAC045055464E500DB518D /* maccore */;
|
||||||
|
remoteInfo = maccore;
|
||||||
|
};
|
||||||
006DC7D80FC7475400BF5F45 /* PBXContainerItemProxy */ = {
|
006DC7D80FC7475400BF5F45 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 0064EE5E0FC72C9600D71FB0 /* effects.xcodeproj */;
|
containerPortal = 0064EE5E0FC72C9600D71FB0 /* effects.xcodeproj */;
|
||||||
@ -477,6 +498,9 @@
|
|||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
000A99D30FDD3530007E45BD /* PBXTargetDependency */,
|
||||||
|
000A99D50FDD3534007E45BD /* PBXTargetDependency */,
|
||||||
|
000A99D70FDD3538007E45BD /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = "«PROJECTNAME»";
|
name = "«PROJECTNAME»";
|
||||||
productInstallPath = "$(HOME)/Applications";
|
productInstallPath = "$(HOME)/Applications";
|
||||||
@ -637,6 +661,24 @@
|
|||||||
};
|
};
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXTargetDependency section */
|
||||||
|
000A99D30FDD3530007E45BD /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
name = core;
|
||||||
|
targetProxy = 000A99D20FDD3530007E45BD /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
000A99D50FDD3534007E45BD /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
name = effects;
|
||||||
|
targetProxy = 000A99D40FDD3534007E45BD /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
000A99D70FDD3538007E45BD /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
name = maccore;
|
||||||
|
targetProxy = 000A99D60FDD3538007E45BD /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
/* Begin PBXVariantGroup section */
|
||||||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
|
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
|
||||||
isa = PBXVariantGroup;
|
isa = PBXVariantGroup;
|
||||||
|
Loading…
Reference in New Issue
Block a user