Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/gpu/GrSWMaskHelper.cpp

Issue 1704593002: Remove outdated optimization to not flush for new textures in GrSWMaskHelper (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 desc.fConfig = fmt_to_config(fCompressedFormat); 246 desc.fConfig = fmt_to_config(fCompressedFormat);
247 SkASSERT(fContext->caps()->isConfigTexturable(desc.fConfig)); 247 SkASSERT(fContext->caps()->isConfigTexturable(desc.fConfig));
248 } 248 }
249 249
250 return fContext->textureProvider()->createApproxTexture(desc); 250 return fContext->textureProvider()->createApproxTexture(desc);
251 } 251 }
252 252
253 void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de sc, 253 void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de sc,
254 const void *data, size_t rowbytes) { 254 const void *data, size_t rowbytes) {
255 // If we aren't reusing scratch textures we don't need to flush before
256 // writing since no one else will be using 'texture'
257 bool reuseScratch = fContext->caps()->reuseScratchTextures();
258
259 // Since we're uploading to it, and it's compressed, 'texture' shouldn't 255 // Since we're uploading to it, and it's compressed, 'texture' shouldn't
260 // have a render target. 256 // have a render target.
261 SkASSERT(nullptr == texture->asRenderTarget()); 257 SkASSERT(nullptr == texture->asRenderTarget());
262 258
263 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, 259 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, data, ro wbytes);
264 desc.fConfig, data, rowbytes,
265 reuseScratch ? 0 : GrContext::kDontFlush_PixelOpsFlag);
266 } 260 }
267 261
268 void GrSWMaskHelper::compressTextureData(GrTexture *texture, const GrSurfaceDesc & desc) { 262 void GrSWMaskHelper::compressTextureData(GrTexture *texture, const GrSurfaceDesc & desc) {
269 263
270 SkASSERT(GrPixelConfigIsCompressed(desc.fConfig)); 264 SkASSERT(GrPixelConfigIsCompressed(desc.fConfig));
271 SkASSERT(fmt_to_config(fCompressedFormat) == desc.fConfig); 265 SkASSERT(fmt_to_config(fCompressedFormat) == desc.fConfig);
272 266
273 SkAutoDataUnref cmpData(SkTextureCompressor::CompressBitmapToFormat(fPixels, 267 SkAutoDataUnref cmpData(SkTextureCompressor::CompressBitmapToFormat(fPixels,
274 fCompres sedFormat)); 268 fCompres sedFormat));
275 SkASSERT(cmpData); 269 SkASSERT(cmpData);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 pipelineBuilder->addCoverageFragmentProcessor( 362 pipelineBuilder->addCoverageFragmentProcessor(
369 GrSimpleTextureEffect::Create(texture, 363 GrSimpleTextureEffect::Create(texture,
370 maskMatrix, 364 maskMatrix,
371 GrTextureParams::kNone_Fi lterMode, 365 GrTextureParams::kNone_Fi lterMode,
372 kDevice_GrCoordSet))->unr ef(); 366 kDevice_GrCoordSet))->unr ef();
373 367
374 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S kMatrix::I(), 368 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S kMatrix::I(),
375 dstRect, nullptr, &invert)); 369 dstRect, nullptr, &invert));
376 target->drawBatch(*pipelineBuilder, batch); 370 target->drawBatch(*pipelineBuilder, batch);
377 } 371 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698