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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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 | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/GrTextureProvider.cpp » ('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 * 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 "GrTextureParamsAdjuster.h" 8 #include "GrTextureParamsAdjuster.h"
9 9
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 domain.fLeft = (subset->fLeft + 0.5f) * sx; 85 domain.fLeft = (subset->fLeft + 0.5f) * sx;
86 domain.fTop = (subset->fTop + 0.5f)* sy; 86 domain.fTop = (subset->fTop + 0.5f)* sy;
87 domain.fRight = (subset->fRight - 0.5f) * sx; 87 domain.fRight = (subset->fRight - 0.5f) * sx;
88 domain.fBottom = (subset->fBottom - 0.5f) * sy; 88 domain.fBottom = (subset->fBottom - 0.5f) * sy;
89 // This would cause us to read values from outside the subset. Surely, t he caller knows 89 // This would cause us to read values from outside the subset. Surely, t he caller knows
90 // better! 90 // better!
91 SkASSERT(copyParams.fFilter != GrTextureParams::kMipMap_FilterMode); 91 SkASSERT(copyParams.fFilter != GrTextureParams::kMipMap_FilterMode);
92 paint.addColorFragmentProcessor( 92 paint.addColorFragmentProcessor(
93 GrTextureDomainEffect::Create(inputTexture, SkMatrix::I(), domain, 93 GrTextureDomainEffect::Create(inputTexture, SkMatrix::I(), domain,
94 GrTextureDomain::kClamp_Mode, 94 GrTextureDomain::kClamp_Mode,
95 copyParams.fFilter))->unref(); 95 copyParams.fFilter, kLocal_GrCoordSet, copy->asRenderTarget()))->unref();
96 } else { 96 } else {
97 GrTextureParams params(SkShader::kClamp_TileMode, copyParams.fFilter); 97 GrTextureParams params(SkShader::kClamp_TileMode, copyParams.fFilter);
98 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params); 98 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params, copy ->asRenderTarget());
99 } 99 }
100 100
101 SkRect localRect; 101 SkRect localRect;
102 if (subset) { 102 if (subset) {
103 localRect = SkRect::Make(*subset); 103 localRect = SkRect::Make(*subset);
104 localRect.fLeft *= sx; 104 localRect.fLeft *= sx;
105 localRect.fTop *= sy; 105 localRect.fTop *= sy;
106 localRect.fRight *= sx; 106 localRect.fRight *= sx;
107 localRect.fBottom *= sy; 107 localRect.fBottom *= sy;
108 } else { 108 } else {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 domainRect->fRight /= texW; 320 domainRect->fRight /= texW;
321 domainRect->fBottom /= texH; 321 domainRect->fBottom /= texH;
322 return kDomain_DomainMode; 322 return kDomain_DomainMode;
323 } 323 }
324 324
325 const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor( 325 const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
326 const SkMatrix& textureMatrix, 326 const SkMatrix& textureMatrix,
327 const SkRect& constraintRect, 327 const SkRect& constraintRect,
328 FilterConstraint filterConstraint, 328 FilterConstraint filterConstraint,
329 bool coordsLimitedToConstraintRect, 329 bool coordsLimitedToConstraintRect,
330 const GrTextureParams::FilterMode* filte rOrNullForBicubic) { 330 const GrTextureParams::FilterMode* filte rOrNullForBicubic,
331 GrRenderTarget* dst) {
331 332
332 const SkIRect* contentArea = this->contentAreaOrNull(); 333 const SkIRect* contentArea = this->contentAreaOrNull();
333 334
334 SkRect domain; 335 SkRect domain;
335 GrTexture* texture = this->originalTexture(); 336 GrTexture* texture = this->originalTexture();
336 DomainMode domainMode = 337 DomainMode domainMode =
337 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect, 338 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect,
338 texture->width(), texture->height(), 339 texture->width(), texture->height(),
339 contentArea, filterOrNullForBicubic, 340 contentArea, filterOrNullForBicubic,
340 &domain); 341 &domain);
(...skipping 11 matching lines...) Expand all
352 texture->width(), texture->height(), 353 texture->width(), texture->height(),
353 contentArea, &kBilerp, &domain); 354 contentArea, &kBilerp, &domain);
354 SkASSERT(kTightCopy_DomainMode != domainMode); 355 SkASSERT(kTightCopy_DomainMode != domainMode);
355 } 356 }
356 SkASSERT(kNoDomain_DomainMode == domainMode || 357 SkASSERT(kNoDomain_DomainMode == domainMode ||
357 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom)); 358 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom));
358 if (filterOrNullForBicubic) { 359 if (filterOrNullForBicubic) {
359 if (kDomain_DomainMode == domainMode) { 360 if (kDomain_DomainMode == domainMode) {
360 return GrTextureDomainEffect::Create(texture, textureMatrix, domain, 361 return GrTextureDomainEffect::Create(texture, textureMatrix, domain,
361 GrTextureDomain::kClamp_Mode, 362 GrTextureDomain::kClamp_Mode,
362 *filterOrNullForBicubic); 363 *filterOrNullForBicubic, kLocal _GrCoordSet, dst);
363 } else { 364 } else {
364 GrTextureParams params(SkShader::kClamp_TileMode, *filterOrNullForBi cubic); 365 GrTextureParams params(SkShader::kClamp_TileMode, *filterOrNullForBi cubic);
365 return GrSimpleTextureEffect::Create(texture, textureMatrix, params) ; 366 return GrSimpleTextureEffect::Create(texture, textureMatrix, params, kLocal_GrCoordSet, dst);
366 } 367 }
367 } else { 368 } else {
368 if (kDomain_DomainMode == domainMode) { 369 if (kDomain_DomainMode == domainMode) {
369 return GrBicubicEffect::Create(texture, textureMatrix, domain); 370 return GrBicubicEffect::Create(texture, textureMatrix, domain, dst);
370 } else { 371 } else {
371 static const SkShader::TileMode kClampClamp[] = 372 static const SkShader::TileMode kClampClamp[] =
372 { SkShader::kClamp_TileMode, SkShader::kClamp_TileMode }; 373 { SkShader::kClamp_TileMode, SkShader::kClamp_TileMode };
373 return GrBicubicEffect::Create(texture, textureMatrix, kClampClamp); 374 return GrBicubicEffect::Create(texture, textureMatrix, kClampClamp, dst);
374 } 375 }
375 } 376 }
376 } 377 }
377 378
378 ////////////////////////////////////////////////////////////////////////////// 379 //////////////////////////////////////////////////////////////////////////////
379 380
380 GrTexture* GrTextureMaker::refTextureForParams(GrContext* ctx, const GrTexturePa rams& params) { 381 GrTexture* GrTextureMaker::refTextureForParams(GrContext* ctx, const GrTexturePa rams& params) {
381 CopyParams copyParams; 382 CopyParams copyParams;
382 if (!ctx->getGpu()->makeCopyForTextureParams(this->width(), this->height(), params, 383 if (!ctx->getGpu()->makeCopyForTextureParams(this->width(), this->height(), params,
383 &copyParams)) { 384 &copyParams)) {
(...skipping 20 matching lines...) Expand all
404 return result; 405 return result;
405 } 406 }
406 407
407 GrTexture* GrTextureMaker::generateTextureForParams(GrContext* ctx, const CopyPa rams& copyParams) { 408 GrTexture* GrTextureMaker::generateTextureForParams(GrContext* ctx, const CopyPa rams& copyParams) {
408 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx)); 409 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx));
409 if (!original) { 410 if (!original) {
410 return nullptr; 411 return nullptr;
411 } 412 }
412 return copy_on_gpu(original, nullptr, copyParams); 413 return copy_on_gpu(original, nullptr, copyParams);
413 } 414 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/GrTextureProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698