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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } else { | 63 } else { |
64 colorBits = GrBytesPerPixel(fDesc.fConfig); | 64 colorBits = GrBytesPerPixel(fDesc.fConfig); |
65 } | 65 } |
66 uint64_t size = fDesc.fWidth; | 66 uint64_t size = fDesc.fWidth; |
67 size *= fDesc.fHeight; | 67 size *= fDesc.fHeight; |
68 size *= colorBits; | 68 size *= colorBits; |
69 size *= GrMax(1, fDesc.fSampleCnt); | 69 size *= GrMax(1, fDesc.fSampleCnt); |
70 return (size_t)(size / 8); | 70 return (size_t)(size / 8); |
71 } | 71 } |
72 | 72 |
73 void GrRenderTarget::flagAsNeedingResolve(const GrIRect* rect) { | 73 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { |
74 if (kCanResolve_ResolveType == getResolveType()) { | 74 if (kCanResolve_ResolveType == getResolveType()) { |
75 if (NULL != rect) { | 75 if (NULL != rect) { |
76 fResolveRect.join(*rect); | 76 fResolveRect.join(*rect); |
77 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { | 77 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
78 fResolveRect.setEmpty(); | 78 fResolveRect.setEmpty(); |
79 } | 79 } |
80 } else { | 80 } else { |
81 fResolveRect.setLTRB(0, 0, this->width(), this->height()); | 81 fResolveRect.setLTRB(0, 0, this->width(), this->height()); |
82 } | 82 } |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 void GrRenderTarget::overrideResolveRect(const GrIRect rect) { | 86 void GrRenderTarget::overrideResolveRect(const SkIRect rect) { |
87 fResolveRect = rect; | 87 fResolveRect = rect; |
88 if (fResolveRect.isEmpty()) { | 88 if (fResolveRect.isEmpty()) { |
89 fResolveRect.setLargestInverted(); | 89 fResolveRect.setLargestInverted(); |
90 } else { | 90 } else { |
91 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { | 91 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
92 fResolveRect.setLargestInverted(); | 92 fResolveRect.setLargestInverted(); |
93 } | 93 } |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 void GrRenderTarget::setStencilBuffer(GrStencilBuffer* stencilBuffer) { | 97 void GrRenderTarget::setStencilBuffer(GrStencilBuffer* stencilBuffer) { |
98 SkRefCnt_SafeAssign(fStencilBuffer, stencilBuffer); | 98 SkRefCnt_SafeAssign(fStencilBuffer, stencilBuffer); |
99 } | 99 } |
100 | 100 |
101 void GrRenderTarget::onRelease() { | 101 void GrRenderTarget::onRelease() { |
102 this->setStencilBuffer(NULL); | 102 this->setStencilBuffer(NULL); |
103 | 103 |
104 INHERITED::onRelease(); | 104 INHERITED::onRelease(); |
105 } | 105 } |
106 | 106 |
107 void GrRenderTarget::onAbandon() { | 107 void GrRenderTarget::onAbandon() { |
108 this->setStencilBuffer(NULL); | 108 this->setStencilBuffer(NULL); |
109 | 109 |
110 INHERITED::onAbandon(); | 110 INHERITED::onAbandon(); |
111 } | 111 } |
OLD | NEW |