diff options
author | reed <reed@google.com> | 2014-12-09 13:55:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-09 13:55:20 -0800 |
commit | a8918a065075dece6e407cce0dfddf110e5d61a9 (patch) | |
tree | efb420e47b1b7838e1381d5ee56724863f9d97dc /include/core | |
parent | 2e3b3e369d79e78f7635d4c20e83a47ab571bdf2 (diff) |
Revert of remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (patchset #3 id:40001 of https://codereview.chromium.org/790733003/)
Reason for revert:
need to update chrome first
Original issue's description:
> remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul
>
> patch from issue 781403002 at patchset 20001 (http://crrev.com/781403002#ps20001)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/2c1605a1fbaa2e35a27399a34254fb1200ec2ae6
TBR=fmalita@google.com,fmalita@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/791763002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkCanvas.h | 29 | ||||
-rw-r--r-- | include/core/SkSurface.h | 5 |
2 files changed, 29 insertions, 5 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 46dc3774f0..ff60c57fa7 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -62,6 +62,35 @@ public: SK_DECLARE_INST_COUNT(SkCanvas) /** + * Attempt to allocate an offscreen raster canvas, matching the ImageInfo. + * On success, return a new canvas that will draw into that offscreen. + * + * The caller can access the pixels after drawing into this canvas by + * calling readPixels() or peekPixels(). + * + * If the requested ImageInfo is opaque (either the colortype is + * intrinsically opaque like RGB_565, or the info's alphatype is kOpaque) + * then the pixel memory may be uninitialized. Otherwise, the pixel memory + * will be initialized to 0, which is interpreted as transparent. + * + * On failure, return NULL. This can fail for several reasons: + * 1. the memory allocation failed (e.g. request is too large) + * 2. invalid ImageInfo (e.g. negative dimensions) + * 3. unsupported ImageInfo for a canvas + * - kUnknown_SkColorType, kIndex_8_SkColorType + * - kIgnore_SkAlphaType + * - this list is not complete, so others may also be unsupported + * + * Note: it is valid to request a supported ImageInfo, but with zero + * dimensions. + */ + static SkCanvas* NewRaster(const SkImageInfo&); + + static SkCanvas* NewRasterN32(int width, int height) { + return NewRaster(SkImageInfo::MakeN32Premul(width, height)); + } + + /** * Attempt to allocate raster canvas, matching the ImageInfo, that will draw directly into the * specified pixels. To access the pixels after drawing to them, the caller should call * flush() or call peekPixels(...). diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index 7563d09842..0e238f8429 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -61,14 +61,9 @@ public: * specified width and height, and populates the rest of info to match * pixels in SkPMColor format. */ -#ifdef SK_SUPPORT_LEGACY_NewRasterPMColor static SkSurface* NewRasterPMColor(int width, int height, const SkSurfaceProps* props = NULL) { return NewRaster(SkImageInfo::MakeN32Premul(width, height), props); } -#endif - static SkSurface* NewRasterN32Premul(int width, int height, const SkSurfaceProps* props = NULL) { - return NewRaster(SkImageInfo::MakeN32Premul(width, height), props); - } /** * Return a new surface using the specified render target. |