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

Unified Diff: include/core/SkBitmap.h

Issue 354143004: remove unnecessary bitmapdevice references (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/BitmapBench.cpp ('k') | src/animator/SkDrawBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkBitmap.h
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index d3c33a8e034d23e9c7ee00f0bf571e2e0b43ece3..d2ba057acfd78ce56114ab51d0d759973a1d05b5 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -290,7 +290,7 @@ public:
#endif
/**
- * Allocate a pixelref to match the specified image info. If the Factory
+ * Allocate the bitmap's pixels to match the requested image info. If the Factory
* is non-null, call it to allcoate the pixelref. If the ImageInfo requires
* a colortable, then ColorTable must be non-null, and will be ref'd.
* On failure, the bitmap will be set to empty and return false.
@@ -298,13 +298,23 @@ public:
bool allocPixels(const SkImageInfo&, SkPixelRefFactory*, SkColorTable*);
/**
+ * Allocate the bitmap's pixels to match the requested image info and
+ * rowBytes. If the request cannot be met (e.g. the info is invalid or
+ * the requested rowBytes are not compatible with the info
+ * (e.g. rowBytes < info.minRowBytes() or rowBytes is not aligned with
+ * the pixel size specified by info.colorType()) then false is returned
+ * and the bitmap is set to empty.
+ */
+ bool allocPixels(const SkImageInfo& info, size_t rowBytes);
+
+ /**
* Allocate a pixelref to match the specified image info, using the default
* allocator.
* On success, the bitmap's pixels will be "locked", and return true.
* On failure, the bitmap will be set to empty and return false.
*/
bool allocPixels(const SkImageInfo& info) {
- return this->allocPixels(info, NULL, NULL);
+ return this->allocPixels(info, info.minRowBytes());
}
bool allocN32Pixels(int width, int height, bool isOpaque = false) {
« no previous file with comments | « bench/BitmapBench.cpp ('k') | src/animator/SkDrawBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698