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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 if (this->texturePriv().hasMipMaps()) { | 48 if (this->texturePriv().hasMipMaps()) { |
49 // We don't have to worry about the mipmaps being a different size than | 49 // We don't have to worry about the mipmaps being a different size than |
50 // we'd expect because we never change fDesc.fWidth/fHeight. | 50 // we'd expect because we never change fDesc.fWidth/fHeight. |
51 textureSize *= 2; | 51 textureSize *= 2; |
52 } | 52 } |
53 return textureSize; | 53 return textureSize; |
54 } | 54 } |
55 | 55 |
56 bool GrTexture::readPixels(int left, int top, int width, int height, | |
57 GrPixelConfig config, void* buffer, | |
58 size_t rowBytes, uint32_t pixelOpsFlags) { | |
59 // go through context so that all necessary flushing occurs | |
60 GrContext* context = this->getContext(); | |
61 if (NULL == context) { | |
62 return false; | |
63 } | |
64 return context->readTexturePixels(this, | |
65 left, top, width, height, | |
66 config, buffer, rowBytes, | |
67 pixelOpsFlags); | |
68 } | |
69 | |
70 void GrTexture::writePixels(int left, int top, int width, int height, | |
71 GrPixelConfig config, const void* buffer, | |
72 size_t rowBytes, uint32_t pixelOpsFlags) { | |
73 // go through context so that all necessary flushing occurs | |
74 GrContext* context = this->getContext(); | |
75 if (NULL == context) { | |
76 return; | |
77 } | |
78 context->writeTexturePixels(this, | |
79 left, top, width, height, | |
80 config, buffer, rowBytes, | |
81 pixelOpsFlags); | |
82 } | |
83 | 56 |
84 void GrTexture::onRelease() { | 57 void GrTexture::onRelease() { |
85 SkASSERT(!this->texturePriv().isSetFlag((GrTextureFlags) kReturnToCache_Flag
Bit)); | 58 SkASSERT(!this->texturePriv().isSetFlag((GrTextureFlags) kReturnToCache_Flag
Bit)); |
86 INHERITED::onRelease(); | 59 INHERITED::onRelease(); |
87 } | 60 } |
88 | 61 |
89 void GrTexture::onAbandon() { | 62 void GrTexture::onAbandon() { |
90 if (fRenderTarget.get()) { | 63 if (fRenderTarget.get()) { |
91 fRenderTarget->abandon(); | 64 fRenderTarget->abandon(); |
92 } | 65 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return GrResourceKey(cacheID, ResourceType(), 0); | 176 return GrResourceKey(cacheID, ResourceType(), 0); |
204 } | 177 } |
205 | 178 |
206 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { | 179 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { |
207 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); | 180 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); |
208 } | 181 } |
209 | 182 |
210 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { | 183 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { |
211 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); | 184 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); |
212 } | 185 } |
OLD | NEW |