aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-05-03 15:23:21 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-03 20:02:07 +0000
commitf40b24913a99fc6fcc4b7f60e4dfcda980a16ee1 (patch)
treecefa01609c03211bd049e928ce9e4dfe8d4ba4d9 /src/image
parente80e6183e5e1531555aaf9b5cee58c5e663d2934 (diff)
Validate SkSpecialSurface raster info
BUG=chromium:716311 Change-Id: I01ea2e77ba8920f735395dd46ef2cea78a858308 Reviewed-on: https://skia-review.googlesource.com/15230 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkSurface_Raster.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index c4796c402f..1ee3d7ea61 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -11,12 +11,8 @@
#include "SkDevice.h"
#include "SkMallocPixelRef.h"
-static const size_t kIgnoreRowBytesValue = (size_t)~0;
-
class SkSurface_Raster : public SkSurface_Base {
public:
- static bool Valid(const SkImageInfo&, size_t rb = kIgnoreRowBytesValue);
-
SkSurface_Raster(const SkImageInfo&, void*, size_t rb,
void (*releaseProc)(void* pixels, void* context), void* context,
const SkSurfaceProps*);
@@ -39,7 +35,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
-bool SkSurface_Raster::Valid(const SkImageInfo& info, size_t rowBytes) {
+bool SkSurfaceValidateRasterInfo(const SkImageInfo& info, size_t rowBytes) {
if (info.isEmpty()) {
return false;
}
@@ -186,7 +182,7 @@ sk_sp<SkSurface> SkSurface::MakeRasterDirectReleaseProc(const SkImageInfo& info,
if (nullptr == releaseProc) {
context = nullptr;
}
- if (!SkSurface_Raster::Valid(info, rb)) {
+ if (!SkSurfaceValidateRasterInfo(info, rb)) {
return nullptr;
}
if (nullptr == pixels) {
@@ -203,7 +199,7 @@ sk_sp<SkSurface> SkSurface::MakeRasterDirect(const SkImageInfo& info, void* pixe
sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, size_t rowBytes,
const SkSurfaceProps* props) {
- if (!SkSurface_Raster::Valid(info)) {
+ if (!SkSurfaceValidateRasterInfo(info)) {
return nullptr;
}