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

Side by Side Diff: include/core/SkBitmap.h

Issue 646213003: Add `SkIRect bounds()` convenience method to SkImageInfo and SkBitmap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: sorted headers Created 6 years, 1 month 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 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 #ifndef SkBitmap_DEFINED 8 #ifndef SkBitmap_DEFINED
9 #define SkBitmap_DEFINED 9 #define SkBitmap_DEFINED
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 /////////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////////
78 78
79 const SkImageInfo& info() const { return fInfo; } 79 const SkImageInfo& info() const { return fInfo; }
80 80
81 int width() const { return fInfo.width(); } 81 int width() const { return fInfo.width(); }
82 int height() const { return fInfo.height(); } 82 int height() const { return fInfo.height(); }
83 SkColorType colorType() const { return fInfo.colorType(); } 83 SkColorType colorType() const { return fInfo.colorType(); }
84 SkAlphaType alphaType() const { return fInfo.alphaType(); } 84 SkAlphaType alphaType() const { return fInfo.alphaType(); }
85 85
86 SkIRect bounds() const { return fInfo.bounds(); }
reed1 2014/10/24 18:42:35 nit: lets move these next to the existing getBound
hal.canary 2014/10/24 19:04:10 Done.
87 SkISize dimensions() const { return fInfo.dimensions(); }
88
86 /** 89 /**
87 * Return the number of bytes per pixel based on the colortype. If the colo rtype is 90 * Return the number of bytes per pixel based on the colortype. If the colo rtype is
88 * kUnknown_SkColorType, then 0 is returned. 91 * kUnknown_SkColorType, then 0 is returned.
89 */ 92 */
90 int bytesPerPixel() const { return fInfo.bytesPerPixel(); } 93 int bytesPerPixel() const { return fInfo.bytesPerPixel(); }
91 94
92 /** 95 /**
93 * Return the rowbytes expressed as a number of pixels (like width and heig ht). 96 * Return the rowbytes expressed as a number of pixels (like width and heig ht).
94 * If the colortype is kUnknown_SkColorType, then 0 is returned. 97 * If the colortype is kUnknown_SkColorType, then 0 is returned.
95 */ 98 */
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 877
875 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 878 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
876 SkASSERT(fPixels); 879 SkASSERT(fPixels);
877 SkASSERT(kIndex_8_SkColorType == this->colorType()); 880 SkASSERT(kIndex_8_SkColorType == this->colorType());
878 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height()); 881 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height());
879 SkASSERT(fColorTable); 882 SkASSERT(fColorTable);
880 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 883 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
881 } 884 }
882 885
883 #endif 886 #endif
OLDNEW
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | include/core/SkImageInfo.h » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698