OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool SkPixmap::reset(const SkMask& src) { | 45 bool SkPixmap::reset(const SkMask& src) { |
46 if (SkMask::kA8_Format == src.fFormat) { | 46 if (SkMask::kA8_Format == src.fFormat) { |
47 this->reset(SkImageInfo::MakeA8(src.fBounds.width(), src.fBounds.height(
)), | 47 this->reset(SkImageInfo::MakeA8(src.fBounds.width(), src.fBounds.height(
)), |
48 src.fImage, src.fRowBytes, nullptr); | 48 src.fImage, src.fRowBytes, nullptr); |
49 return true; | 49 return true; |
50 } | 50 } |
51 this->reset(); | 51 this->reset(); |
52 return false; | 52 return false; |
53 } | 53 } |
54 | 54 |
| 55 void SkPixmap::setColorSpace(sk_sp<SkColorSpace> cs) { |
| 56 fInfo = fInfo.makeColorSpace(std::move(cs)); |
| 57 } |
| 58 |
55 bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const { | 59 bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const { |
56 SkIRect srcRect, r; | 60 SkIRect srcRect, r; |
57 srcRect.set(0, 0, this->width(), this->height()); | 61 srcRect.set(0, 0, this->width(), this->height()); |
58 if (!r.intersect(srcRect, subset)) { | 62 if (!r.intersect(srcRect, subset)) { |
59 return false; // r is empty (i.e. no intersection) | 63 return false; // r is empty (i.e. no intersection) |
60 } | 64 } |
61 | 65 |
62 // If the upper left of the rectangle was outside the bounds of this SkBitma
p, we should have | 66 // If the upper left of the rectangle was outside the bounds of this SkBitma
p, we should have |
63 // exited above. | 67 // exited above. |
64 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width(
))); | 68 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width(
))); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 270 |
267 SkPaint paint; | 271 SkPaint paint; |
268 paint.setFilterQuality(quality); | 272 paint.setFilterQuality(quality); |
269 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 273 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
270 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), | 274 surface->getCanvas()->drawBitmapRect(bitmap, SkRect::MakeIWH(dst.width(), ds
t.height()), |
271 &paint); | 275 &paint); |
272 return true; | 276 return true; |
273 } | 277 } |
274 | 278 |
275 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 279 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
OLD | NEW |