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

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

Issue 1282363002: Use SkImageCacherator in SkImages (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix rob comments Created 5 years, 3 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 | « gyp/core.gypi ('k') | include/core/SkImage.h » ('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 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 static bool ComputeIsOpaque(const SkBitmap&); 207 static bool ComputeIsOpaque(const SkBitmap&);
208 208
209 /** 209 /**
210 * Return the bitmap's bounds [0, 0, width, height] as an SkRect 210 * Return the bitmap's bounds [0, 0, width, height] as an SkRect
211 */ 211 */
212 void getBounds(SkRect* bounds) const; 212 void getBounds(SkRect* bounds) const;
213 void getBounds(SkIRect* bounds) const; 213 void getBounds(SkIRect* bounds) const;
214 214
215 SkIRect bounds() const { return fInfo.bounds(); } 215 SkIRect bounds() const { return fInfo.bounds(); }
216 SkISize dimensions() const { return fInfo.dimensions(); } 216 SkISize dimensions() const { return fInfo.dimensions(); }
217 // Returns the bounds of this bitmap, offset by its pixelref origin.
218 SkIRect getSubset() const {
219 return SkIRect::MakeXYWH(fPixelRefOrigin.x(), fPixelRefOrigin.y(),
220 fInfo.width(), fInfo.height());
221 }
217 222
218 bool setInfo(const SkImageInfo&, size_t rowBytes = 0); 223 bool setInfo(const SkImageInfo&, size_t rowBytes = 0);
219 224
220 /** 225 /**
221 * Allocate the bitmap's pixels to match the requested image info. If the F actory 226 * Allocate the bitmap's pixels to match the requested image info. If the F actory
222 * is non-null, call it to allcoate the pixelref. If the ImageInfo requires 227 * is non-null, call it to allcoate the pixelref. If the ImageInfo requires
223 * a colortable, then ColorTable must be non-null, and will be ref'd. 228 * a colortable, then ColorTable must be non-null, and will be ref'd.
224 * On failure, the bitmap will be set to empty and return false. 229 * On failure, the bitmap will be set to empty and return false.
225 */ 230 */
226 bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo&, SkPixelRefFact ory*, SkColorTable*); 231 bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo&, SkPixelRefFact ory*, SkColorTable*);
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 806
802 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 807 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
803 SkASSERT(fPixels); 808 SkASSERT(fPixels);
804 SkASSERT(kIndex_8_SkColorType == this->colorType()); 809 SkASSERT(kIndex_8_SkColorType == this->colorType());
805 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height()); 810 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height());
806 SkASSERT(fColorTable); 811 SkASSERT(fColorTable);
807 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 812 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
808 } 813 }
809 814
810 #endif 815 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | include/core/SkImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698