OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |