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

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

Issue 68973005: Expand pixelref to return SkImageInfo and rowbytes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkImageInfo.h » ('j') | include/core/SkImageInfo.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 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 #ifndef SkBitmap_DEFINED 10 #ifndef SkBitmap_DEFINED
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 */ 249 */
250 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); 250 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType);
251 251
252 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { 252 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) {
253 return this->setConfig(config, width, height, rowBytes, 253 return this->setConfig(config, width, height, rowBytes,
254 kPremul_SkAlphaType); 254 kPremul_SkAlphaType);
255 } 255 }
256 256
257 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); 257 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0);
258 258
259 /**
260 * If the bitmap's config can be represented as SkImageInfo, return true,
261 * and if info is not-null, set it to the bitmap's info. If it cannot be
262 * represented as SkImageInfo, return false and ignore the info parameter.
263 */
264 bool asImageInfo(SkImageInfo* info) const;
265
259 /** Use this to assign a new pixel address for an existing bitmap. This 266 /** Use this to assign a new pixel address for an existing bitmap. This
260 will automatically release any pixelref previously installed. Only call 267 will automatically release any pixelref previously installed. Only call
261 this if you are handling ownership/lifetime of the pixel memory. 268 this if you are handling ownership/lifetime of the pixel memory.
262 269
263 If the bitmap retains a reference to the colortable (assuming it is 270 If the bitmap retains a reference to the colortable (assuming it is
264 not null) it will take care of incrementing the reference count. 271 not null) it will take care of incrementing the reference count.
265 272
266 @param pixels Address for the pixels, managed by the caller. 273 @param pixels Address for the pixels, managed by the caller.
267 @param ctable ColorTable (or null) that matches the specified pixels 274 @param ctable ColorTable (or null) that matches the specified pixels
268 */ 275 */
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 824
818 // returns the address of the byte that contains the x coordinate 825 // returns the address of the byte that contains the x coordinate
819 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { 826 inline uint8_t* SkBitmap::getAddr1(int x, int y) const {
820 SkASSERT(fPixels); 827 SkASSERT(fPixels);
821 SkASSERT(fConfig == kA1_Config); 828 SkASSERT(fConfig == kA1_Config);
822 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); 829 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
823 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); 830 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3);
824 } 831 }
825 832
826 #endif 833 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkImageInfo.h » ('j') | include/core/SkImageInfo.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698