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 "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 GrContext* context = this->getContext(); | 60 GrContext* context = this->getContext(); |
61 if (NULL == context) { | 61 if (NULL == context) { |
62 return false; | 62 return false; |
63 } | 63 } |
64 return context->readTexturePixels(this, | 64 return context->readTexturePixels(this, |
65 left, top, width, height, | 65 left, top, width, height, |
66 config, buffer, rowBytes, | 66 config, buffer, rowBytes, |
67 pixelOpsFlags); | 67 pixelOpsFlags); |
68 } | 68 } |
69 | 69 |
70 void GrTexture::writePixels(int left, int top, int width, int height, | 70 bool GrTexture::writePixels(int left, int top, int width, int height, |
71 GrPixelConfig config, const void* buffer, | 71 GrPixelConfig config, const void* buffer, |
72 size_t rowBytes, uint32_t pixelOpsFlags) { | 72 size_t rowBytes, uint32_t pixelOpsFlags) { |
73 // go through context so that all necessary flushing occurs | 73 // go through context so that all necessary flushing occurs |
74 GrContext* context = this->getContext(); | 74 GrContext* context = this->getContext(); |
75 if (NULL == context) { | 75 if (NULL == context) { |
76 return; | 76 return false; |
77 } | 77 } |
78 context->writeTexturePixels(this, | 78 return context->writeTexturePixels(this, |
79 left, top, width, height, | 79 left, top, width, height, |
80 config, buffer, rowBytes, | 80 config, buffer, rowBytes, |
81 pixelOpsFlags); | 81 pixelOpsFlags); |
82 } | 82 } |
83 | 83 |
84 void GrTexture::onRelease() { | 84 void GrTexture::onRelease() { |
85 SkASSERT(!this->texturePriv().isSetFlag((GrTextureFlags) kReturnToCache_Flag
Bit)); | 85 SkASSERT(!this->texturePriv().isSetFlag((GrTextureFlags) kReturnToCache_Flag
Bit)); |
86 INHERITED::onRelease(); | 86 INHERITED::onRelease(); |
87 } | 87 } |
88 | 88 |
89 void GrTexture::onAbandon() { | 89 void GrTexture::onAbandon() { |
90 if (fRenderTarget.get()) { | 90 if (fRenderTarget.get()) { |
91 fRenderTarget->abandon(); | 91 fRenderTarget->abandon(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return GrResourceKey(cacheID, ResourceType(), 0); | 203 return GrResourceKey(cacheID, ResourceType(), 0); |
204 } | 204 } |
205 | 205 |
206 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { | 206 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { |
207 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); | 207 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); |
208 } | 208 } |
209 | 209 |
210 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { | 210 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { |
211 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); | 211 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); |
212 } | 212 } |
OLD | NEW |