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

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

Issue 2182603003: Just pass the draw context to paint conversion (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 const SkMatrix* textureMatrix; 194 const SkMatrix* textureMatrix;
195 SkMatrix tempMatrix; 195 SkMatrix tempMatrix;
196 if (canUseTextureCoordsAsLocalCoords) { 196 if (canUseTextureCoordsAsLocalCoords) {
197 textureMatrix = &SkMatrix::I(); 197 textureMatrix = &SkMatrix::I();
198 } else { 198 } else {
199 if (!srcToDstMatrix.invert(&tempMatrix)) { 199 if (!srcToDstMatrix.invert(&tempMatrix)) {
200 return; 200 return;
201 } 201 }
202 textureMatrix = &tempMatrix; 202 textureMatrix = &tempMatrix;
203 } 203 }
204 bool gammaCorrect = this->surfaceProps().isGammaCorrect();
205 SkSourceGammaTreatment gammaTreatment = gammaCorrect
206 ? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
207 sk_sp<GrFragmentProcessor> fp(producer->createFragmentProcessor( 204 sk_sp<GrFragmentProcessor> fp(producer->createFragmentProcessor(
208 *textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode, 205 *textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode,
209 fDrawContext->getColorSpace(), gammaTreatment)); 206 fDrawContext->getColorSpace(), fDrawContext->sourceGammaTreatment()));
210 if (!fp) { 207 if (!fp) {
211 return; 208 return;
212 } 209 }
213 210
214 GrPaint grPaint; 211 GrPaint grPaint;
215 if (!SkPaintToGrPaintWithTexture(fContext, paint, viewMatrix, fp, producer-> isAlphaOnly(), 212 if (!SkPaintToGrPaintWithTexture(fContext, fDrawContext.get(), paint, viewMa trix, fp,
216 gammaCorrect, fDrawContext->getColorSpace() , &grPaint)) { 213 producer->isAlphaOnly(), &grPaint)) {
217 return; 214 return;
218 } 215 }
219 216
220 if (canUseTextureCoordsAsLocalCoords) { 217 if (canUseTextureCoordsAsLocalCoords) {
221 fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect, clippedSrcRect); 218 fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect, clippedSrcRect);
222 return; 219 return;
223 } 220 }
224 221
225 if (!mf) { 222 if (!mf) {
226 fDrawContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect); 223 fDrawContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect);
(...skipping 13 matching lines...) Expand all
240 rrect)) { 237 rrect)) {
241 return; 238 return;
242 } 239 }
243 SkPath rectPath; 240 SkPath rectPath;
244 rectPath.addRect(clippedDstRect); 241 rectPath.addRect(clippedDstRect);
245 rectPath.setIsVolatile(true); 242 rectPath.setIsVolatile(true);
246 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext.get(), fCl ip, 243 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext.get(), fCl ip,
247 rectPath, &grPaint, viewMatrix, mf, GrSt yle::SimpleFill(), 244 rectPath, &grPaint, viewMatrix, mf, GrSt yle::SimpleFill(),
248 true); 245 true);
249 } 246 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/SkGr.cpp » ('j') | src/gpu/text/GrAtlasTextContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698