OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (fUnlock) { | 121 if (fUnlock) { |
122 GrContext* context = fSurface->getContext(); | 122 GrContext* context = fSurface->getContext(); |
123 GrTexture* texture = fSurface->asTexture(); | 123 GrTexture* texture = fSurface->asTexture(); |
124 if (NULL != context && NULL != texture) { | 124 if (NULL != context && NULL != texture) { |
125 context->unlockScratchTexture(texture); | 125 context->unlockScratchTexture(texture); |
126 } | 126 } |
127 } | 127 } |
128 GrSafeUnref(fSurface); | 128 GrSafeUnref(fSurface); |
129 } | 129 } |
130 | 130 |
131 SkGpuTexture* SkGrPixelRef::getTexture() { | 131 GrTexture* SkGrPixelRef::getTexture() { |
132 if (NULL != fSurface) { | 132 if (NULL != fSurface) { |
133 return (SkGpuTexture*) fSurface->asTexture(); | 133 return fSurface->asTexture(); |
134 } | 134 } |
135 return NULL; | 135 return NULL; |
136 } | 136 } |
137 | 137 |
138 SkPixelRef* SkGrPixelRef::deepCopy(SkBitmap::Config dstConfig, const SkIRect* su
bset) { | 138 SkPixelRef* SkGrPixelRef::deepCopy(SkBitmap::Config dstConfig, const SkIRect* su
bset) { |
139 if (NULL == fSurface) { | 139 if (NULL == fSurface) { |
140 return NULL; | 140 return NULL; |
141 } | 141 } |
142 | 142 |
143 // Note that when copying a render-target-backed pixel ref, we | 143 // Note that when copying a render-target-backed pixel ref, we |
(...skipping 26 matching lines...) Expand all Loading... |
170 if (!dst->allocPixels()) { | 170 if (!dst->allocPixels()) { |
171 SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\
n"); | 171 SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\
n"); |
172 return false; | 172 return false; |
173 } | 173 } |
174 SkAutoLockPixels al(*dst); | 174 SkAutoLockPixels al(*dst); |
175 void* buffer = dst->getPixels(); | 175 void* buffer = dst->getPixels(); |
176 return fSurface->readPixels(left, top, width, height, | 176 return fSurface->readPixels(left, top, width, height, |
177 kSkia8888_GrPixelConfig, | 177 kSkia8888_GrPixelConfig, |
178 buffer, dst->rowBytes()); | 178 buffer, dst->rowBytes()); |
179 } | 179 } |
OLD | NEW |