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

Side by Side Diff: src/gpu/GrSurface.cpp

Issue 2258463002: Cast for fuzzer complaint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | 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 "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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698