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

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

Issue 2181073003: Start measuring f16 and srgb speed. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: support f16 in SkBitmap::getAddr() Created 4 years, 4 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 | « no previous file | tools/nanobench_flags.json » ('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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 528 }
529 529
530 void* SkBitmap::getAddr(int x, int y) const { 530 void* SkBitmap::getAddr(int x, int y) const {
531 SkASSERT((unsigned)x < (unsigned)this->width()); 531 SkASSERT((unsigned)x < (unsigned)this->width());
532 SkASSERT((unsigned)y < (unsigned)this->height()); 532 SkASSERT((unsigned)y < (unsigned)this->height());
533 533
534 char* base = (char*)this->getPixels(); 534 char* base = (char*)this->getPixels();
535 if (base) { 535 if (base) {
536 base += y * this->rowBytes(); 536 base += y * this->rowBytes();
537 switch (this->colorType()) { 537 switch (this->colorType()) {
538 case kRGBA_F16_SkColorType:
539 base += x << 3;
540 break;
538 case kRGBA_8888_SkColorType: 541 case kRGBA_8888_SkColorType:
539 case kBGRA_8888_SkColorType: 542 case kBGRA_8888_SkColorType:
540 base += x << 2; 543 base += x << 2;
541 break; 544 break;
542 case kARGB_4444_SkColorType: 545 case kARGB_4444_SkColorType:
543 case kRGB_565_SkColorType: 546 case kRGB_565_SkColorType:
544 base += x << 1; 547 base += x << 1;
545 break; 548 break;
546 case kAlpha_8_SkColorType: 549 case kAlpha_8_SkColorType:
547 case kIndex_8_SkColorType: 550 case kIndex_8_SkColorType:
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 /////////////////////////////////////////////////////////////////////////////// 1302 ///////////////////////////////////////////////////////////////////////////////
1300 1303
1301 #ifdef SK_DEBUG 1304 #ifdef SK_DEBUG
1302 void SkImageInfo::validate() const { 1305 void SkImageInfo::validate() const {
1303 SkASSERT(fWidth >= 0); 1306 SkASSERT(fWidth >= 0);
1304 SkASSERT(fHeight >= 0); 1307 SkASSERT(fHeight >= 0);
1305 SkASSERT(SkColorTypeIsValid(fColorType)); 1308 SkASSERT(SkColorTypeIsValid(fColorType));
1306 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1307 } 1310 }
1308 #endif 1311 #endif
OLDNEW
« no previous file with comments | « no previous file | tools/nanobench_flags.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698