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

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

Issue 300263005: Revert "Revert of add colortable support to imagegenerator (https://codereview.chromium.org/3044430… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 6 months 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 | « samplecode/SampleXfermodesBlur.cpp ('k') | src/core/SkCanvas.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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 this->setPixelRef(pr)->unref(); 435 this->setPixelRef(pr)->unref();
436 436
437 // TODO: lockPixels could/should return bool or void*/NULL 437 // TODO: lockPixels could/should return bool or void*/NULL
438 this->lockPixels(); 438 this->lockPixels();
439 if (NULL == this->getPixels()) { 439 if (NULL == this->getPixels()) {
440 return reset_return_false(this); 440 return reset_return_false(this);
441 } 441 }
442 return true; 442 return true;
443 } 443 }
444 444
445 bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb, 445 bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb, S kColorTable* ct,
446 void (*releaseProc)(void* addr, void* context), 446 void (*releaseProc)(void* addr, void* context), voi d* context) {
447 void* context) {
448 if (!this->setConfig(info, rb)) { 447 if (!this->setConfig(info, rb)) {
449 this->reset(); 448 this->reset();
450 return false; 449 return false;
451 } 450 }
452 451
453 SkPixelRef* pr = SkMallocPixelRef::NewWithProc(info, rb, NULL, pixels, 452 SkPixelRef* pr = SkMallocPixelRef::NewWithProc(info, rb, ct, pixels, release Proc, context);
454 releaseProc, context);
455 if (!pr) { 453 if (!pr) {
456 this->reset(); 454 this->reset();
457 return false; 455 return false;
458 } 456 }
459 457
460 this->setPixelRef(pr)->unref(); 458 this->setPixelRef(pr)->unref();
461 459
462 // since we're already allocated, we lockPixels right away 460 // since we're already allocated, we lockPixels right away
463 this->lockPixels(); 461 this->lockPixels();
464 SkDEBUGCODE(this->validate();) 462 SkDEBUGCODE(this->validate();)
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 /////////////////////////////////////////////////////////////////////////////// 1475 ///////////////////////////////////////////////////////////////////////////////
1478 1476
1479 #ifdef SK_DEBUG 1477 #ifdef SK_DEBUG
1480 void SkImageInfo::validate() const { 1478 void SkImageInfo::validate() const {
1481 SkASSERT(fWidth >= 0); 1479 SkASSERT(fWidth >= 0);
1482 SkASSERT(fHeight >= 0); 1480 SkASSERT(fHeight >= 0);
1483 SkASSERT(SkColorTypeIsValid(fColorType)); 1481 SkASSERT(SkColorTypeIsValid(fColorType));
1484 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1482 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1485 } 1483 }
1486 #endif 1484 #endif
OLDNEW
« no previous file with comments | « samplecode/SampleXfermodesBlur.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698