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 "GrSurface.h" | 8 #include "GrSurface.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrSurfacePriv.h" | 10 #include "GrSurfacePriv.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // We own one color value for each MSAA sample. | 22 // We own one color value for each MSAA sample. |
23 int colorValuesPerPixel = SkTMax(1, desc.fSampleCnt); | 23 int colorValuesPerPixel = SkTMax(1, desc.fSampleCnt); |
24 if (desc.fSampleCnt) { | 24 if (desc.fSampleCnt) { |
25 // Worse case, we own the resolve buffer so that is one more sample
per pixel. | 25 // Worse case, we own the resolve buffer so that is one more sample
per pixel. |
26 colorValuesPerPixel += 1; | 26 colorValuesPerPixel += 1; |
27 } | 27 } |
28 SkASSERT(kUnknown_GrPixelConfig != desc.fConfig); | 28 SkASSERT(kUnknown_GrPixelConfig != desc.fConfig); |
29 SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig)); | 29 SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig)); |
30 size_t colorBytes = GrBytesPerPixel(desc.fConfig); | 30 size_t colorBytes = GrBytesPerPixel(desc.fConfig); |
31 SkASSERT(colorBytes > 0); | 31 SkASSERT(colorBytes > 0); |
32 size = colorValuesPerPixel * desc.fWidth * desc.fHeight * colorBytes; | 32 |
| 33 size = (size_t) colorValuesPerPixel * desc.fWidth * desc.fHeight * color
Bytes; |
33 } else { | 34 } else { |
34 if (GrPixelConfigIsCompressed(desc.fConfig)) { | 35 if (GrPixelConfigIsCompressed(desc.fConfig)) { |
35 size = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fH
eight); | 36 size = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fH
eight); |
36 } else { | 37 } else { |
37 size = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fC
onfig); | 38 size = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fC
onfig); |
38 } | 39 } |
39 | 40 |
40 size += size/3; // in case we have to mipmap | 41 size += size/3; // in case we have to mipmap |
41 } | 42 } |
42 | 43 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 188 |
188 void GrSurface::onRelease() { | 189 void GrSurface::onRelease() { |
189 this->invokeReleaseProc(); | 190 this->invokeReleaseProc(); |
190 this->INHERITED::onRelease(); | 191 this->INHERITED::onRelease(); |
191 } | 192 } |
192 | 193 |
193 void GrSurface::onAbandon() { | 194 void GrSurface::onAbandon() { |
194 this->invokeReleaseProc(); | 195 this->invokeReleaseProc(); |
195 this->INHERITED::onAbandon(); | 196 this->INHERITED::onAbandon(); |
196 } | 197 } |
OLD | NEW |