Lines Matching defs:texture

157     // of them before freeing the texture cache
310 // The desired texture is NPOT and tiled but that isn't supported by
311 // the current hardware. Resize the texture to be a POT
333 GrTexture* texture = fGpu->createTexture(rtDesc, NULL, 0);
335 if (NULL != texture) {
338 drawState->setRenderTarget(texture->asRenderTarget());
353 verts[0].setIRectFan(0, 0, texture->width(), texture->height(), 2 * sizeof(SkPoint));
359 // stretched textures when the texture params is either filtered or
368 // We shouldn't be resizing a compressed texture.
378 texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRowBytes);
379 SkASSERT(NULL != texture);
382 return texture;
393 GrTexture* texture;
398 texture = this->createResizedTexture(desc, cacheID,
402 texture = fGpu->createTexture(desc, srcData, rowBytes);
405 if (NULL != texture) {
408 fResourceCache->purgeAsNeeded(1, texture->gpuMemorySize());
409 fResourceCache->addResource(resourceKey, texture);
416 return texture;
422 GrTexture* texture = gpu->createTexture(desc, NULL, 0);
423 if (NULL != texture) {
424 GrResourceKey key = GrTextureImpl::ComputeScratchKey(texture->desc());
427 resourceCache->purgeAsNeeded(1, texture->gpuMemorySize());
429 resourceCache->addResource(key, texture, GrResourceCache::kHide_OwnershipFlag);
431 return texture;
446 // If we're never recycling this texture we can always make it the right size
465 // Ensure we have exclusive access to the texture so future 'find' calls don't return it
497 void GrContext::addExistingTextureToCache(GrTexture* texture) {
499 if (NULL == texture) {
503 // This texture should already have a cache entry since it was once
505 SkASSERT(NULL != texture->getCacheEntry());
509 SkASSERT(texture->unique());
511 if (fGpu->caps()->reuseScratchTextures() || NULL != texture->asRenderTarget()) {
512 // Since this texture came from an AutoScratchTexture it should
514 fResourceCache->makeNonExclusive(texture->getCacheEntry());
516 } else if (texture->getDeferredRefCount() <= 0) {
517 // When we aren't reusing textures we know this scratch texture
519 fResourceCache->makeNonExclusive(texture->getCacheEntry());
520 fResourceCache->deleteResource(texture->getCacheEntry());
524 // ref count goes to 0 the texture will be deleted (remember
526 texture->setNeedsDeferredUnref();
531 void GrContext::unlockScratchTexture(GrTexture* texture) {
532 ASSERT_OWNED_RESOURCE(texture);
533 SkASSERT(NULL != texture->getCacheEntry());
535 // If this is a scratch texture we detached it from the cache
537 // the same texture).
538 if (texture->getCacheEntry()->key().isScratch()) {
539 if (fGpu->caps()->reuseScratchTextures() || NULL != texture->asRenderTarget()) {
540 fResourceCache->makeNonExclusive(texture->getCacheEntry());
542 } else if (texture->unique() && texture->getDeferredRefCount() <= 0) {
543 // Only the cache now knows about this texture. Since we're never
546 fResourceCache->makeNonExclusive(texture->getCacheEntry());
547 fResourceCache->deleteResource(texture->getCacheEntry());
554 texture->impl()->setFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit);
555 // Give up the cache's ref to the texture
556 texture->unref();
1203 // Note that internalDrawPath may sw-rasterize the path into a scratch texture.
1204 // Scratch textures can be recycled after they are returned to the texture
1316 bool GrContext::writeTexturePixels(GrTexture* texture,
1320 ASSERT_OWNED_RESOURCE(texture);
1322 if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture, config)) {
1323 if (NULL != texture->asRenderTarget()) {
1324 return this->writeRenderTargetPixels(texture->asRenderTarget(),
1336 return fGpu->writeTexturePixels(texture, left, top, width, height,
1340 bool GrContext::readTexturePixels(GrTexture* texture,
1344 ASSERT_OWNED_RESOURCE(texture);
1346 GrRenderTarget* target = texture->asRenderTarget();
1354 // texture, i.e., use GetTexImage() instead
1365 GrTexture* dst = ast.texture();
1367 this->copyTexture(texture, target, NULL);
1415 // In that case we'll perform an R and B swap while drawing to a scratch texture of the swapped
1434 // If the src is a texture and we would have to do conversions after read pixels, we instead
1435 // do the conversions by drawing the src to a scratch texture. If we handle any of the
1452 // our texture cache and pay the cost of creating and destroying many textures. So, we only
1463 GrTexture* texture = ast.texture();
1464 if (texture) {
1497 drawState->setRenderTarget(texture->asRenderTarget());
1503 target = texture->asRenderTarget();
1512 // Perform any conversions we weren't able to perform using a scratch texture.
1557 // Writes pending to the source texture are not tracked, so a flush
1559 // of the source texture. See similar behavior in
1604 // If the RT is also a texture and we don't have to premultiply then take the texture path.
1605 // We expect to be at least as fast or faster since it doesn't use an intermediate texture as
1609 // At least some drivers on the Mac get confused when glTexImage2D is called on a texture
1621 // we will upload the original src data to a scratch texture but we will spoof it as the swapped
1637 GrTexture* texture = ast.texture();
1638 if (NULL == texture) {
1644 textureMatrix.setIDiv(texture->width(), texture->height());
1653 effect.reset(this->createUPMToPMEffect(texture, swapRAndB, textureMatrix));
1681 effect.reset(GrConfigConversionEffect::Create(texture,
1687 if (!this->writeTexturePixels(texture,
1849 const GrEffectRef* GrContext::createPMToUPMEffect(GrTexture* texture,
1859 return GrConfigConversionEffect::Create(texture, swapRAndB, pmToUPM, matrix);
1865 const GrEffectRef* GrContext::createUPMToPMEffect(GrTexture* texture,
1875 return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, matrix);