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

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

Issue 53133002: Make not-reusing-scratch-textures only apply to texture uploads (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: clean up Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrDrawTargetCaps.h ('k') | 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 #include "GrDrawState.h" 9 #include "GrDrawState.h"
10 #include "GrDrawTargetCaps.h" 10 #include "GrDrawTargetCaps.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 /** 131 /**
132 * Move the result of the software mask generation back to the gpu 132 * Move the result of the software mask generation back to the gpu
133 */ 133 */
134 void GrSWMaskHelper::toTexture(GrTexture *texture) { 134 void GrSWMaskHelper::toTexture(GrTexture *texture) {
135 SkAutoLockPixels alp(fBM); 135 SkAutoLockPixels alp(fBM);
136 136
137 // If we aren't reusing scratch textures we don't need to flush before 137 // If we aren't reusing scratch textures we don't need to flush before
138 // writing since no one else will be using 'texture' 138 // writing since no one else will be using 'texture'
139 bool reuseScratch = fContext->getGpu()->caps()->reuseScratchTextures(); 139 bool reuseScratch = fContext->getGpu()->caps()->reuseScratchTextures();
140 140
141 // Since we're uploading to it, 'texture' shouldn't have a render target.
142 SkASSERT(NULL == texture->asRenderTarget());
143
141 texture->writePixels(0, 0, fBM.width(), fBM.height(), 144 texture->writePixels(0, 0, fBM.width(), fBM.height(),
142 kAlpha_8_GrPixelConfig, 145 kAlpha_8_GrPixelConfig,
143 fBM.getPixels(), fBM.rowBytes(), 146 fBM.getPixels(), fBM.rowBytes(),
144 reuseScratch ? 0 : GrContext::kDontFlush_PixelOpsFlag); 147 reuseScratch ? 0 : GrContext::kDontFlush_PixelOpsFlag);
145 } 148 }
146 149
147 //////////////////////////////////////////////////////////////////////////////// 150 ////////////////////////////////////////////////////////////////////////////////
148 /** 151 /**
149 * Software rasterizes path to A8 mask (possibly using the context's matrix) 152 * Software rasterizes path to A8 mask (possibly using the context's matrix)
150 * and uploads the result to a scratch texture. Returns the resulting 153 * and uploads the result to a scratch texture. Returns the resulting
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 maskMatrix.preConcat(drawState->getViewMatrix()); 204 maskMatrix.preConcat(drawState->getViewMatrix());
202 205
203 drawState->addCoverageEffect( 206 drawState->addCoverageEffect(
204 GrSimpleTextureEffect::Create(texture, 207 GrSimpleTextureEffect::Create(texture,
205 maskMatrix, 208 maskMatrix,
206 GrTextureParams::kNone_Fi lterMode, 209 GrTextureParams::kNone_Fi lterMode,
207 kPosition_GrCoordSet))->u nref(); 210 kPosition_GrCoordSet))->u nref();
208 211
209 target->drawSimpleRect(dstRect); 212 target->drawSimpleRect(dstRect);
210 } 213 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTargetCaps.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698