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

Side by Side Diff: src/image/SkSurface.cpp

Issue 830033003: change API contract: disallow zero-sized images or surfaces (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « src/image/SkImage_Raster.cpp ('k') | src/image/SkSurface_Raster.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 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 #include "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 static SkSurface_Base* asSB(SkSurface* surface) { 117 static SkSurface_Base* asSB(SkSurface* surface) {
118 return static_cast<SkSurface_Base*>(surface); 118 return static_cast<SkSurface_Base*>(surface);
119 } 119 }
120 120
121 /////////////////////////////////////////////////////////////////////////////// 121 ///////////////////////////////////////////////////////////////////////////////
122 122
123 SkSurface::SkSurface(int width, int height, const SkSurfaceProps* props) 123 SkSurface::SkSurface(int width, int height, const SkSurfaceProps* props)
124 : fProps(SkSurfacePropsCopyOrDefault(props)), fWidth(width), fHeight(height) 124 : fProps(SkSurfacePropsCopyOrDefault(props)), fWidth(width), fHeight(height)
125 { 125 {
126 SkASSERT(fWidth >= 0); 126 SkASSERT(fWidth > 0);
127 SkASSERT(fHeight >= 0); 127 SkASSERT(fHeight > 0);
128 fGenerationID = 0; 128 fGenerationID = 0;
129 } 129 }
130 130
131 SkSurface::SkSurface(const SkImageInfo& info, const SkSurfaceProps* props) 131 SkSurface::SkSurface(const SkImageInfo& info, const SkSurfaceProps* props)
132 : fProps(SkSurfacePropsCopyOrDefault(props)), fWidth(info.width()), fHeight( info.height()) 132 : fProps(SkSurfacePropsCopyOrDefault(props)), fWidth(info.width()), fHeight( info.height())
133 { 133 {
134 SkASSERT(fWidth >= 0); 134 SkASSERT(fWidth > 0);
135 SkASSERT(fHeight >= 0); 135 SkASSERT(fHeight > 0);
136 fGenerationID = 0; 136 fGenerationID = 0;
137 } 137 }
138 138
139 uint32_t SkSurface::generationID() { 139 uint32_t SkSurface::generationID() {
140 if (0 == fGenerationID) { 140 if (0 == fGenerationID) {
141 fGenerationID = asSB(this)->newGenerationID(); 141 fGenerationID = asSB(this)->newGenerationID();
142 } 142 }
143 return fGenerationID; 143 return fGenerationID;
144 } 144 }
145 145
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) { 186 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) {
187 return NULL; 187 return NULL;
188 } 188 }
189 189
190 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount, 190 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
191 const SkSurfaceProps*) { 191 const SkSurfaceProps*) {
192 return NULL; 192 return NULL;
193 } 193 }
194 194
195 #endif 195 #endif
OLDNEW
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698