| 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" |
| 11 | 11 |
| 12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
| 13 #include "SkGrPriv.h" | 13 #include "SkGrPriv.h" |
| 14 #include "SkImageEncoder.h" | 14 #include "SkImageEncoder.h" |
| 15 #include <stdio.h> | 15 #include <stdio.h> |
| 16 | 16 |
| 17 size_t GrSurface::WorseCaseSize(const GrSurfaceDesc& desc) { | 17 size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc) { |
| 18 size_t size; | 18 size_t size; |
| 19 | 19 |
| 20 bool isRenderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); | 20 bool isRenderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); |
| 21 if (isRenderTarget) { | 21 if (isRenderTarget) { |
| 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 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 void GrSurface::onRelease() { | 189 void GrSurface::onRelease() { |
| 190 this->invokeReleaseProc(); | 190 this->invokeReleaseProc(); |
| 191 this->INHERITED::onRelease(); | 191 this->INHERITED::onRelease(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void GrSurface::onAbandon() { | 194 void GrSurface::onAbandon() { |
| 195 this->invokeReleaseProc(); | 195 this->invokeReleaseProc(); |
| 196 this->INHERITED::onAbandon(); | 196 this->INHERITED::onAbandon(); |
| 197 } | 197 } |
| OLD | NEW |