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 "GrSWMaskHelper.h" | 8 #include "GrSWMaskHelper.h" |
9 | 9 |
10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 #endif | 245 #endif |
246 | 246 |
247 desc.fConfig = fmt_to_config(fCompressedFormat); | 247 desc.fConfig = fmt_to_config(fCompressedFormat); |
248 SkASSERT(fContext->getGpu()->caps()->isConfigTexturable(desc.fConfig)); | 248 SkASSERT(fContext->getGpu()->caps()->isConfigTexturable(desc.fConfig)); |
249 } | 249 } |
250 | 250 |
251 return fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)
; | 251 return fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)
; |
252 } | 252 } |
253 | 253 |
254 void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de
sc, | 254 void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de
sc, |
255 const void *data, int rowbytes) { | 255 const void *data, size_t rowbytes) { |
256 // If we aren't reusing scratch textures we don't need to flush before | 256 // If we aren't reusing scratch textures we don't need to flush before |
257 // writing since no one else will be using 'texture' | 257 // writing since no one else will be using 'texture' |
258 bool reuseScratch = fContext->getGpu()->caps()->reuseScratchTextures(); | 258 bool reuseScratch = fContext->getGpu()->caps()->reuseScratchTextures(); |
259 | 259 |
260 // Since we're uploading to it, and it's compressed, 'texture' shouldn't | 260 // Since we're uploading to it, and it's compressed, 'texture' shouldn't |
261 // have a render target. | 261 // have a render target. |
262 SkASSERT(NULL == texture->asRenderTarget()); | 262 SkASSERT(NULL == texture->asRenderTarget()); |
263 | 263 |
264 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, | 264 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, |
265 desc.fConfig, data, rowbytes, | 265 desc.fConfig, data, rowbytes, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 maskMatrix.preConcat(drawState->getViewMatrix()); | 371 maskMatrix.preConcat(drawState->getViewMatrix()); |
372 | 372 |
373 drawState->addCoverageProcessor( | 373 drawState->addCoverageProcessor( |
374 GrSimpleTextureEffect::Create(texture, | 374 GrSimpleTextureEffect::Create(texture, |
375 maskMatrix, | 375 maskMatrix, |
376 GrTextureParams::kNone_Fi
lterMode, | 376 GrTextureParams::kNone_Fi
lterMode, |
377 kPosition_GrCoordSet))->u
nref(); | 377 kPosition_GrCoordSet))->u
nref(); |
378 | 378 |
379 target->drawSimpleRect(drawState, color, dstRect); | 379 target->drawSimpleRect(drawState, color, dstRect); |
380 } | 380 } |
OLD | NEW |