SkPixmap::setColorSpace
Landed for reed@ with bug fix: Use default copy constructor for SkDraw BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2057563002 patch from issue 2057563002 at patchset 1 (http://crrev.com/2057563002#ps1) Review-Url: https://codereview.chromium.org/2052943002
This commit is contained in:
parent
96e4e1ca5a
commit
804b461bc4
@ -30,7 +30,6 @@ class SkRRect;
|
|||||||
class SkDraw {
|
class SkDraw {
|
||||||
public:
|
public:
|
||||||
SkDraw();
|
SkDraw();
|
||||||
SkDraw(const SkDraw& src);
|
|
||||||
|
|
||||||
void drawPaint(const SkPaint&) const;
|
void drawPaint(const SkPaint&) const;
|
||||||
void drawPoints(SkCanvas::PointMode, size_t count, const SkPoint[],
|
void drawPoints(SkCanvas::PointMode, size_t count, const SkPoint[],
|
||||||
|
@ -285,6 +285,10 @@ public:
|
|||||||
return SkImageInfo(fWidth, fHeight, newColorType, fAlphaType, fProfileType, fColorSpace);
|
return SkImageInfo(fWidth, fHeight, newColorType, fAlphaType, fProfileType, fColorSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkImageInfo makeColorSpace(sk_sp<SkColorSpace> cs) const {
|
||||||
|
return SkImageInfo::Make(fWidth, fHeight, fColorType, fAlphaType, std::move(cs));
|
||||||
|
}
|
||||||
|
|
||||||
int bytesPerPixel() const { return SkColorTypeBytesPerPixel(fColorType); }
|
int bytesPerPixel() const { return SkColorTypeBytesPerPixel(fColorType); }
|
||||||
|
|
||||||
int shiftPerPixel() const { return SkColorTypeShiftPerPixel(fColorType); }
|
int shiftPerPixel() const { return SkColorTypeShiftPerPixel(fColorType); }
|
||||||
|
@ -44,6 +44,9 @@ public:
|
|||||||
this->reset(info, NULL, 0, NULL);
|
this->reset(info, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// overrides the colorspace in the SkImageInfo of the pixmap
|
||||||
|
void setColorSpace(sk_sp<SkColorSpace>);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If supported, set this pixmap to point to the pixels in the specified mask and return true.
|
* If supported, set this pixmap to point to the pixels in the specified mask and return true.
|
||||||
* On failure, return false and set this pixmap to empty.
|
* On failure, return false and set this pixmap to empty.
|
||||||
|
@ -114,10 +114,6 @@ SkDraw::SkDraw() {
|
|||||||
sk_bzero(this, sizeof(*this));
|
sk_bzero(this, sizeof(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
SkDraw::SkDraw(const SkDraw& src) {
|
|
||||||
memcpy(this, &src, sizeof(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SkDraw::computeConservativeLocalClipBounds(SkRect* localBounds) const {
|
bool SkDraw::computeConservativeLocalClipBounds(SkRect* localBounds) const {
|
||||||
if (fRC->isEmpty()) {
|
if (fRC->isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -32,7 +32,13 @@ static bool color_type_is_valid(SkColorType colorType) {
|
|||||||
|
|
||||||
SkImageInfo SkImageInfo::Make(int width, int height, SkColorType ct, SkAlphaType at,
|
SkImageInfo SkImageInfo::Make(int width, int height, SkColorType ct, SkAlphaType at,
|
||||||
sk_sp<SkColorSpace> cs) {
|
sk_sp<SkColorSpace> cs) {
|
||||||
return SkImageInfo(width, height, ct, at, SkDefaultColorProfile(), std::move(cs));
|
SkColorProfileType pt = SkDefaultColorProfile();
|
||||||
|
// try to keep the enum and the colorspace in sync.
|
||||||
|
// TODO: eliminate the enum entirely, now that we have colorspace objects
|
||||||
|
if (cs && (SkColorSpace::kLinear_GammaNamed != cs->gammaNamed())) {
|
||||||
|
pt = kSRGB_SkColorProfileType;
|
||||||
|
}
|
||||||
|
return SkImageInfo(width, height, ct, at, pt, std::move(cs));
|
||||||
}
|
}
|
||||||
|
|
||||||
SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
|
SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
|
||||||
|
@ -52,6 +52,10 @@ bool SkPixmap::reset(const SkMask& src) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkPixmap::setColorSpace(sk_sp<SkColorSpace> cs) {
|
||||||
|
fInfo = fInfo.makeColorSpace(std::move(cs));
|
||||||
|
}
|
||||||
|
|
||||||
bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const {
|
bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const {
|
||||||
SkIRect srcRect, r;
|
SkIRect srcRect, r;
|
||||||
srcRect.set(0, 0, this->width(), this->height());
|
srcRect.set(0, 0, this->width(), this->height());
|
||||||
|
Loading…
Reference in New Issue
Block a user