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

Side by Side Diff: src/core/SkBitmapProcShader.cpp

Issue 808703006: remove view matrix from context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: one more fix Created 6 years 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 | « src/core/SkBitmapProcShader.h ('k') | src/core/SkColorShader.h » ('j') | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 /////////////////////////////////////////////////////////////////////////////// 361 ///////////////////////////////////////////////////////////////////////////////
362 362
363 #if SK_SUPPORT_GPU 363 #if SK_SUPPORT_GPU
364 364
365 #include "GrTextureAccess.h" 365 #include "GrTextureAccess.h"
366 #include "effects/GrSimpleTextureEffect.h" 366 #include "effects/GrSimpleTextureEffect.h"
367 #include "SkGr.h" 367 #include "SkGr.h"
368 368
369 bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint& paint, 369 bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint& paint,
370 const SkMatrix& viewM,
370 const SkMatrix* localMatrix, GrColo r* paintColor, 371 const SkMatrix* localMatrix, GrColo r* paintColor,
371 GrFragmentProcessor** fp) const { 372 GrFragmentProcessor** fp) const {
372 SkMatrix matrix; 373 SkMatrix matrix;
373 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); 374 matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height());
374 375
375 SkMatrix lmInverse; 376 SkMatrix lmInverse;
376 if (!this->getLocalMatrix().invert(&lmInverse)) { 377 if (!this->getLocalMatrix().invert(&lmInverse)) {
377 return false; 378 return false;
378 } 379 }
379 if (localMatrix) { 380 if (localMatrix) {
(...skipping 18 matching lines...) Expand all
398 GrTextureParams::FilterMode textureFilterMode; 399 GrTextureParams::FilterMode textureFilterMode;
399 switch(paint.getFilterLevel()) { 400 switch(paint.getFilterLevel()) {
400 case SkPaint::kNone_FilterLevel: 401 case SkPaint::kNone_FilterLevel:
401 textureFilterMode = GrTextureParams::kNone_FilterMode; 402 textureFilterMode = GrTextureParams::kNone_FilterMode;
402 break; 403 break;
403 case SkPaint::kLow_FilterLevel: 404 case SkPaint::kLow_FilterLevel:
404 textureFilterMode = GrTextureParams::kBilerp_FilterMode; 405 textureFilterMode = GrTextureParams::kBilerp_FilterMode;
405 break; 406 break;
406 case SkPaint::kMedium_FilterLevel: { 407 case SkPaint::kMedium_FilterLevel: {
407 SkMatrix matrix; 408 SkMatrix matrix;
408 matrix.setConcat(context->getMatrix(), this->getLocalMatrix()); 409 matrix.setConcat(viewM, this->getLocalMatrix());
409 if (matrix.getMinScale() < SK_Scalar1) { 410 if (matrix.getMinScale() < SK_Scalar1) {
410 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 411 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
411 } else { 412 } else {
412 // Don't trigger MIP level generation unnecessarily. 413 // Don't trigger MIP level generation unnecessarily.
413 textureFilterMode = GrTextureParams::kBilerp_FilterMode; 414 textureFilterMode = GrTextureParams::kBilerp_FilterMode;
414 } 415 }
415 break; 416 break;
416 } 417 }
417 case SkPaint::kHigh_FilterLevel: { 418 case SkPaint::kHigh_FilterLevel: {
418 SkMatrix matrix; 419 SkMatrix matrix;
419 matrix.setConcat(context->getMatrix(), this->getLocalMatrix()); 420 matrix.setConcat(viewM, this->getLocalMatrix());
420 useBicubic = GrBicubicEffect::ShouldUseBicubic(matrix, &textureFilte rMode); 421 useBicubic = GrBicubicEffect::ShouldUseBicubic(matrix, &textureFilte rMode);
421 break; 422 break;
422 } 423 }
423 default: 424 default:
424 SkErrorInternals::SetError( kInvalidPaint_SkError, 425 SkErrorInternals::SetError( kInvalidPaint_SkError,
425 "Sorry, I don't understand the filtering " 426 "Sorry, I don't understand the filtering "
426 "mode you asked for. Falling back to " 427 "mode you asked for. Falling back to "
427 "MIPMaps."); 428 "MIPMaps.");
428 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 429 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
429 break; 430 break;
(...skipping 16 matching lines...) Expand all
446 *fp = GrBicubicEffect::Create(texture, matrix, tm); 447 *fp = GrBicubicEffect::Create(texture, matrix, tm);
447 } else { 448 } else {
448 *fp = GrSimpleTextureEffect::Create(texture, matrix, params); 449 *fp = GrSimpleTextureEffect::Create(texture, matrix, params);
449 } 450 }
450 451
451 return true; 452 return true;
452 } 453 }
453 454
454 #else 455 #else
455 456
456 bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const S kMatrix*, GrColor*, 457 bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const S kMatrix&,
458 const SkMatrix*, GrColor*,
457 GrFragmentProcessor**) const { 459 GrFragmentProcessor**) const {
458 SkDEBUGFAIL("Should not call in GPU-less build"); 460 SkDEBUGFAIL("Should not call in GPU-less build");
459 return false; 461 return false;
460 } 462 }
461 463
462 #endif 464 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkColorShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698