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

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

Issue 580863004: Adding 3D lut color filter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: As color filter instead of image filter Created 6 years, 2 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
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 void SkBitmap::setIsVolatile(bool isVolatile) { 493 void SkBitmap::setIsVolatile(bool isVolatile) {
494 if (isVolatile) { 494 if (isVolatile) {
495 fFlags |= kImageIsVolatile_Flag; 495 fFlags |= kImageIsVolatile_Flag;
496 } else { 496 } else {
497 fFlags &= ~kImageIsVolatile_Flag; 497 fFlags &= ~kImageIsVolatile_Flag;
498 } 498 }
499 } 499 }
500 500
501 bool SkBitmap::is3DLut() const {
502 return (fFlags & kIs3DLut_Flag) != 0;
503 }
504
505 void SkBitmap::setIs3DLut(bool is3DLut) {
506 if (is3DLut && ((width() * width()) == height())) {
507 fFlags |= kIs3DLut_Flag;
508 } else {
509 fFlags &= ~kIs3DLut_Flag;
510 }
511 }
512
501 void* SkBitmap::getAddr(int x, int y) const { 513 void* SkBitmap::getAddr(int x, int y) const {
502 SkASSERT((unsigned)x < (unsigned)this->width()); 514 SkASSERT((unsigned)x < (unsigned)this->width());
503 SkASSERT((unsigned)y < (unsigned)this->height()); 515 SkASSERT((unsigned)y < (unsigned)this->height());
504 516
505 char* base = (char*)this->getPixels(); 517 char* base = (char*)this->getPixels();
506 if (base) { 518 if (base) {
507 base += y * this->rowBytes(); 519 base += y * this->rowBytes();
508 switch (this->colorType()) { 520 switch (this->colorType()) {
509 case kRGBA_8888_SkColorType: 521 case kRGBA_8888_SkColorType:
510 case kBGRA_8888_SkColorType: 522 case kBGRA_8888_SkColorType:
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 // colorTypes report opaque for their alphatype 1323 // colorTypes report opaque for their alphatype
1312 if (kRGB_565_SkColorType == fInfo.colorType()) { 1324 if (kRGB_565_SkColorType == fInfo.colorType()) {
1313 SkASSERT(kOpaque_SkAlphaType == fInfo.alphaType()); 1325 SkASSERT(kOpaque_SkAlphaType == fInfo.alphaType());
1314 } 1326 }
1315 1327
1316 SkASSERT(fInfo.validRowBytes(fRowBytes)); 1328 SkASSERT(fInfo.validRowBytes(fRowBytes));
1317 uint8_t allFlags = kImageIsVolatile_Flag; 1329 uint8_t allFlags = kImageIsVolatile_Flag;
1318 #ifdef SK_BUILD_FOR_ANDROID 1330 #ifdef SK_BUILD_FOR_ANDROID
1319 allFlags |= kHasHardwareMipMap_Flag; 1331 allFlags |= kHasHardwareMipMap_Flag;
1320 #endif 1332 #endif
1333 allFlags |= kIs3DLut_Flag;
1321 SkASSERT((~allFlags & fFlags) == 0); 1334 SkASSERT((~allFlags & fFlags) == 0);
1322 SkASSERT(fPixelLockCount >= 0); 1335 SkASSERT(fPixelLockCount >= 0);
1323 1336
1324 if (fPixels) { 1337 if (fPixels) {
1325 SkASSERT(fPixelRef); 1338 SkASSERT(fPixelRef);
1326 SkASSERT(fPixelLockCount > 0); 1339 SkASSERT(fPixelLockCount > 0);
1327 SkASSERT(fPixelRef->isLocked()); 1340 SkASSERT(fPixelRef->isLocked());
1328 SkASSERT(fPixelRef->rowBytes() == fRowBytes); 1341 SkASSERT(fPixelRef->rowBytes() == fRowBytes);
1329 SkASSERT(fPixelRefOrigin.fX >= 0); 1342 SkASSERT(fPixelRefOrigin.fX >= 0);
1330 SkASSERT(fPixelRefOrigin.fY >= 0); 1343 SkASSERT(fPixelRefOrigin.fY >= 0);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 /////////////////////////////////////////////////////////////////////////////// 1393 ///////////////////////////////////////////////////////////////////////////////
1381 1394
1382 #ifdef SK_DEBUG 1395 #ifdef SK_DEBUG
1383 void SkImageInfo::validate() const { 1396 void SkImageInfo::validate() const {
1384 SkASSERT(fWidth >= 0); 1397 SkASSERT(fWidth >= 0);
1385 SkASSERT(fHeight >= 0); 1398 SkASSERT(fHeight >= 0);
1386 SkASSERT(SkColorTypeIsValid(fColorType)); 1399 SkASSERT(SkColorTypeIsValid(fColorType));
1387 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1400 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1388 } 1401 }
1389 #endif 1402 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698