Avoid copies in SkMasks constructor
Also mark const methods as const.
Review URL: https://codereview.chromium.org/1364463005
diff --git a/src/codec/SkMasks.cpp b/src/codec/SkMasks.cpp
index b860314..3126672 100644
--- a/src/codec/SkMasks.cpp
+++ b/src/codec/SkMasks.cpp
@@ -68,16 +68,16 @@
* Get a color component
*
*/
-uint8_t SkMasks::getRed(uint32_t pixel) {
+uint8_t SkMasks::getRed(uint32_t pixel) const {
return get_comp(pixel, fRed.mask, fRed.shift, fRed.size);
}
-uint8_t SkMasks::getGreen(uint32_t pixel) {
+uint8_t SkMasks::getGreen(uint32_t pixel) const {
return get_comp(pixel, fGreen.mask, fGreen.shift, fGreen.size);
}
-uint8_t SkMasks::getBlue(uint32_t pixel) {
+uint8_t SkMasks::getBlue(uint32_t pixel) const {
return get_comp(pixel, fBlue.mask, fBlue.shift, fBlue.size);
}
-uint8_t SkMasks::getAlpha(uint32_t pixel) {
+uint8_t SkMasks::getAlpha(uint32_t pixel) const {
return get_comp(pixel, fAlpha.mask, fAlpha.shift, fAlpha.size);
}
@@ -152,8 +152,8 @@
}
-SkMasks::SkMasks(const MaskInfo red, const MaskInfo green,
- const MaskInfo blue, const MaskInfo alpha)
+SkMasks::SkMasks(const MaskInfo& red, const MaskInfo& green,
+ const MaskInfo& blue, const MaskInfo& alpha)
: fRed(red)
, fGreen(green)
, fBlue(blue)