| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "GrRenderTarget.h" | 10 #include "GrRenderTarget.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 size_t GrRenderTarget::sizeInBytes() const { | 57 size_t GrRenderTarget::sizeInBytes() const { |
| 58 size_t colorBits; | 58 size_t colorBits; |
| 59 if (kUnknown_GrPixelConfig == fDesc.fConfig) { | 59 if (kUnknown_GrPixelConfig == fDesc.fConfig) { |
| 60 colorBits = 32; // don't know, make a guess | 60 colorBits = 32; // don't know, make a guess |
| 61 } else { | 61 } else { |
| 62 colorBits = GrBytesPerPixel(fDesc.fConfig); | 62 colorBits = GrBytesPerPixel(fDesc.fConfig); |
| 63 } | 63 } |
| 64 uint64_t size = fDesc.fWidth; | 64 uint64_t size = fDesc.fWidth; |
| 65 size *= fDesc.fHeight; | 65 size *= fDesc.fHeight; |
| 66 size *= colorBits; | 66 size *= colorBits; |
| 67 size *= GrMax(1, fDesc.fSampleCnt); | 67 size *= SkTMax(1, fDesc.fSampleCnt); |
| 68 return (size_t)(size / 8); | 68 return (size_t)(size / 8); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { | 71 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { |
| 72 if (kCanResolve_ResolveType == getResolveType()) { | 72 if (kCanResolve_ResolveType == getResolveType()) { |
| 73 if (NULL != rect) { | 73 if (NULL != rect) { |
| 74 fResolveRect.join(*rect); | 74 fResolveRect.join(*rect); |
| 75 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { | 75 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
| 76 fResolveRect.setEmpty(); | 76 fResolveRect.setEmpty(); |
| 77 } | 77 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 100 this->setStencilBuffer(NULL); | 100 this->setStencilBuffer(NULL); |
| 101 | 101 |
| 102 INHERITED::onRelease(); | 102 INHERITED::onRelease(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void GrRenderTarget::onAbandon() { | 105 void GrRenderTarget::onAbandon() { |
| 106 this->setStencilBuffer(NULL); | 106 this->setStencilBuffer(NULL); |
| 107 | 107 |
| 108 INHERITED::onAbandon(); | 108 INHERITED::onAbandon(); |
| 109 } | 109 } |
| OLD | NEW |