OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 "SkAtomics.h" | 8 #include "SkAtomics.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 365 } |
366 | 366 |
367 this->setPixelRef(pr)->unref(); | 367 this->setPixelRef(pr)->unref(); |
368 | 368 |
369 // since we're already allocated, we lockPixels right away | 369 // since we're already allocated, we lockPixels right away |
370 this->lockPixels(); | 370 this->lockPixels(); |
371 SkDEBUGCODE(this->validate();) | 371 SkDEBUGCODE(this->validate();) |
372 return true; | 372 return true; |
373 } | 373 } |
374 | 374 |
| 375 bool SkBitmap::installPixels(const SkPixmap& pixmap) { |
| 376 return this->installPixels(pixmap.info(), pixmap.writable_addr(), |
| 377 pixmap.rowBytes(), pixmap.ctable(), |
| 378 nullptr, nullptr); |
| 379 } |
| 380 |
375 bool SkBitmap::installMaskPixels(const SkMask& mask) { | 381 bool SkBitmap::installMaskPixels(const SkMask& mask) { |
376 if (SkMask::kA8_Format != mask.fFormat) { | 382 if (SkMask::kA8_Format != mask.fFormat) { |
377 this->reset(); | 383 this->reset(); |
378 return false; | 384 return false; |
379 } | 385 } |
380 return this->installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), | 386 return this->installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), |
381 mask.fBounds.height()), | 387 mask.fBounds.height()), |
382 mask.fImage, mask.fRowBytes); | 388 mask.fImage, mask.fRowBytes); |
383 } | 389 } |
384 | 390 |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 /////////////////////////////////////////////////////////////////////////////// | 1327 /////////////////////////////////////////////////////////////////////////////// |
1322 | 1328 |
1323 #ifdef SK_DEBUG | 1329 #ifdef SK_DEBUG |
1324 void SkImageInfo::validate() const { | 1330 void SkImageInfo::validate() const { |
1325 SkASSERT(fWidth >= 0); | 1331 SkASSERT(fWidth >= 0); |
1326 SkASSERT(fHeight >= 0); | 1332 SkASSERT(fHeight >= 0); |
1327 SkASSERT(SkColorTypeIsValid(fColorType)); | 1333 SkASSERT(SkColorTypeIsValid(fColorType)); |
1328 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1334 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1329 } | 1335 } |
1330 #endif | 1336 #endif |
OLD | NEW |