OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrSurface.h" | 8 #include "GrSurface.h" |
9 #include "GrSurfacePriv.h" | 9 #include "GrSurfacePriv.h" |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const void** data, | 85 const void** data, |
86 size_t* rowBytes) { | 86 size_t* rowBytes) { |
87 return adjust_params<const void>(surfaceWidth, surfaceHeight, bpp, left, top
, width, height, | 87 return adjust_params<const void>(surfaceWidth, surfaceHeight, bpp, left, top
, width, height, |
88 data, rowBytes); | 88 data, rowBytes); |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 ////////////////////////////////////////////////////////////////////////////// | 92 ////////////////////////////////////////////////////////////////////////////// |
93 | 93 |
94 bool GrSurface::writePixels(int left, int top, int width, int height, | 94 bool GrSurface::writePixels(int left, int top, int width, int height, |
95 GrPixelConfig config, const void* buffer, size_t row
Bytes, | 95 GrPixelConfig config, const SkTArray<SkMipMapLevel>&
texels, |
96 uint32_t pixelOpsFlags) { | 96 uint32_t pixelOpsFlags) { |
97 // go through context so that all necessary flushing occurs | 97 // go through context so that all necessary flushing occurs |
98 GrContext* context = this->getContext(); | 98 GrContext* context = this->getContext(); |
99 if (nullptr == context) { | 99 if (nullptr == context) { |
100 return false; | 100 return false; |
101 } | 101 } |
102 return context->writeSurfacePixels(this, left, top, width, height, config, b
uffer, rowBytes, | 102 return context->writeSurfacePixels(this, left, top, width, height, config, t
exels, |
103 pixelOpsFlags); | 103 pixelOpsFlags); |
104 } | 104 } |
105 | 105 |
| 106 bool GrSurface::writePixels(int left, int top, int width, int height, |
| 107 GrPixelConfig config, const void* buffer, size_t row
Bytes, |
| 108 uint32_t pixelOpsFlags) { |
| 109 SkMipMapLevel level(buffer, rowBytes); |
| 110 const int levelCount = 1; |
| 111 SkTArray<SkMipMapLevel> texels(levelCount); |
| 112 texels.push_back(level); |
| 113 return this->writePixels(left, top, width, height, config, texels, pixelOpsF
lags); |
| 114 } |
| 115 |
106 bool GrSurface::readPixels(int left, int top, int width, int height, | 116 bool GrSurface::readPixels(int left, int top, int width, int height, |
107 GrPixelConfig config, void* buffer, size_t rowBytes, | 117 GrPixelConfig config, void* buffer, size_t rowBytes, |
108 uint32_t pixelOpsFlags) { | 118 uint32_t pixelOpsFlags) { |
109 // go through context so that all necessary flushing occurs | 119 // go through context so that all necessary flushing occurs |
110 GrContext* context = this->getContext(); | 120 GrContext* context = this->getContext(); |
111 if (nullptr == context) { | 121 if (nullptr == context) { |
112 return false; | 122 return false; |
113 } | 123 } |
114 return context->readSurfacePixels(this, left, top, width, height, config, bu
ffer, | 124 return context->readSurfacePixels(this, left, top, width, height, config, bu
ffer, |
115 rowBytes, pixelOpsFlags); | 125 rowBytes, pixelOpsFlags); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 212 |
203 void GrSurface::onRelease() { | 213 void GrSurface::onRelease() { |
204 this->invokeReleaseProc(); | 214 this->invokeReleaseProc(); |
205 this->INHERITED::onRelease(); | 215 this->INHERITED::onRelease(); |
206 } | 216 } |
207 | 217 |
208 void GrSurface::onAbandon() { | 218 void GrSurface::onAbandon() { |
209 this->invokeReleaseProc(); | 219 this->invokeReleaseProc(); |
210 this->INHERITED::onAbandon(); | 220 this->INHERITED::onAbandon(); |
211 } | 221 } |
OLD | NEW |