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

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

Issue 154083004: SkPictureRecord: silently do nothing for non-drawable SkBitmaps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: really, last rebase Created 6 years, 10 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 | src/core/SkCanvas.cpp » ('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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /** Copies the src bitmap into this bitmap. Ownership of the src bitmap's pi xels remains 73 /** Copies the src bitmap into this bitmap. Ownership of the src bitmap's pi xels remains
74 with the src bitmap. 74 with the src bitmap.
75 */ 75 */
76 SkBitmap& operator=(const SkBitmap& src); 76 SkBitmap& operator=(const SkBitmap& src);
77 /** Swap the fields of the two bitmaps. This routine is guaranteed to never fail or throw. 77 /** Swap the fields of the two bitmaps. This routine is guaranteed to never fail or throw.
78 */ 78 */
79 // This method is not exported to java. 79 // This method is not exported to java.
80 void swap(SkBitmap& other); 80 void swap(SkBitmap& other);
81 81
82 /** Return true iff the bitmap has empty dimensions. 82 /** Return true iff the bitmap has empty dimensions.
83 */ 83 * Hey! Before you use this, see if you really want to know drawsNothing() instead.
84 */
84 bool empty() const { return 0 == fWidth || 0 == fHeight; } 85 bool empty() const { return 0 == fWidth || 0 == fHeight; }
85 86
86 /** Return true iff the bitmap has no pixelref. Note: this can return true e ven if the 87 /** Return true iff the bitmap has no pixelref. Note: this can return true e ven if the
87 dimensions of the bitmap are > 0 (see empty()). 88 * dimensions of the bitmap are > 0 (see empty()).
88 */ 89 * Hey! Before you use this, see if you really want to know drawsNothing() instead.
90 */
89 bool isNull() const { return NULL == fPixelRef; } 91 bool isNull() const { return NULL == fPixelRef; }
90 92
93 /** Return true iff drawing this bitmap has no effect.
94 */
95 bool drawsNothing() const { return this->empty() || this->isNull(); }
96
91 /** Return the config for the bitmap. */ 97 /** Return the config for the bitmap. */
92 Config config() const { return (Config)fConfig; } 98 Config config() const { return (Config)fConfig; }
93 99
94 SK_ATTR_DEPRECATED("use config()") 100 SK_ATTR_DEPRECATED("use config()")
95 Config getConfig() const { return this->config(); } 101 Config getConfig() const { return this->config(); }
96 102
97 /** Return the bitmap's width, in pixels. */ 103 /** Return the bitmap's width, in pixels. */
98 int width() const { return fWidth; } 104 int width() const { return fWidth; }
99 105
100 /** Return the bitmap's height, in pixels. */ 106 /** Return the bitmap's height, in pixels. */
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 881
876 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 882 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
877 SkASSERT(fPixels); 883 SkASSERT(fPixels);
878 SkASSERT(fConfig == kIndex8_Config); 884 SkASSERT(fConfig == kIndex8_Config);
879 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); 885 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
880 SkASSERT(fColorTable); 886 SkASSERT(fColorTable);
881 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 887 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
882 } 888 }
883 889
884 #endif 890 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698