Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/core/SkBitmap.cpp

Issue 1505333002: SkBitmap::installPixels(const SkPixmap&); (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-12-09 (Wednesday) 13:58:05 EST Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkPictureImageGenerator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkPictureImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698