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 "GrPipelineBuilder.h" | 10 #include "GrPipelineBuilder.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 int dimX, dimY; | 241 int dimX, dimY; |
242 SkTextureCompressor::GetBlockDimensions(fCompressedFormat, &dimX, &dimY)
; | 242 SkTextureCompressor::GetBlockDimensions(fCompressedFormat, &dimX, &dimY)
; |
243 SkASSERT((desc.fWidth % dimX) == 0); | 243 SkASSERT((desc.fWidth % dimX) == 0); |
244 SkASSERT((desc.fHeight % dimY) == 0); | 244 SkASSERT((desc.fHeight % dimY) == 0); |
245 #endif | 245 #endif |
246 | 246 |
247 desc.fConfig = fmt_to_config(fCompressedFormat); | 247 desc.fConfig = fmt_to_config(fCompressedFormat); |
248 SkASSERT(fContext->caps()->isConfigTexturable(desc.fConfig)); | 248 SkASSERT(fContext->caps()->isConfigTexturable(desc.fConfig)); |
249 } | 249 } |
250 | 250 |
251 return fContext->textureProvider()->refScratchTexture( | 251 return fContext->textureProvider()->createApproxTexture(desc); |
252 desc, GrTextureProvider::kApprox_ScratchTexMatch); | |
253 } | 252 } |
254 | 253 |
255 void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de
sc, | 254 void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de
sc, |
256 const void *data, size_t rowbytes) { | 255 const void *data, size_t rowbytes) { |
257 // 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 |
258 // writing since no one else will be using 'texture' | 257 // writing since no one else will be using 'texture' |
259 bool reuseScratch = fContext->caps()->reuseScratchTextures(); | 258 bool reuseScratch = fContext->caps()->reuseScratchTextures(); |
260 | 259 |
261 // 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 |
262 // have a render target. | 261 // have a render target. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 368 |
370 pipelineBuilder->addCoverageProcessor( | 369 pipelineBuilder->addCoverageProcessor( |
371 GrSimpleTextureEffect::Create(pipelineBuilder->getProce
ssorDataManager(), | 370 GrSimpleTextureEffect::Create(pipelineBuilder->getProce
ssorDataManager(), |
372 texture, | 371 texture, |
373 maskMatrix, | 372 maskMatrix, |
374 GrTextureParams::kNone_Fi
lterMode, | 373 GrTextureParams::kNone_Fi
lterMode, |
375 kDevice_GrCoordSet))->unr
ef(); | 374 kDevice_GrCoordSet))->unr
ef(); |
376 | 375 |
377 target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &i
nvert); | 376 target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &i
nvert); |
378 } | 377 } |
OLD | NEW |