OLD | NEW |
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 "GrTextureDomain.h" | 8 #include "GrTextureDomain.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "GrSimpleTextureEffect.h" | 10 #include "GrSimpleTextureEffect.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::Make(GrTe
xture* texture, | 290 sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::Make(GrTe
xture* texture, |
291 const SkIRect& subset, const SkIPoint& deviceSpaceOffset) { | 291 const SkIRect& subset, const SkIPoint& deviceSpaceOffset) { |
292 return sk_sp<GrFragmentProcessor>(new GrDeviceSpaceTextureDecalFragmentProce
ssor( | 292 return sk_sp<GrFragmentProcessor>(new GrDeviceSpaceTextureDecalFragmentProce
ssor( |
293 texture, subset, deviceSpaceOffset)); | 293 texture, subset, deviceSpaceOffset)); |
294 } | 294 } |
295 | 295 |
296 GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentPro
cessor( | 296 GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentPro
cessor( |
297 GrTexture* texture, const SkIRect& subset, const SkIPoint& deviceSpaceOf
fset) | 297 GrTexture* texture, const SkIRect& subset, const SkIPoint& deviceSpaceOf
fset) |
298 : fTextureAccess(texture, GrTextureParams::ClampNoFilter()) | 298 : fTextureAccess(texture, GrTextureParams::ClampNoFilter()) |
299 , fTextureDomain(GrTextureDomain::MakeTexelDomain(texture, subset), | 299 , fTextureDomain(GrTextureDomain::MakeTexelDomain(texture->width(), text
ure->height(), subset), |
300 GrTextureDomain::kDecal_Mode) { | 300 GrTextureDomain::kDecal_Mode) { |
301 this->addTextureAccess(&fTextureAccess); | 301 this->addTextureAccess(&fTextureAccess); |
302 fDeviceSpaceOffset.fX = deviceSpaceOffset.fX - subset.fLeft; | 302 fDeviceSpaceOffset.fX = deviceSpaceOffset.fX - subset.fLeft; |
303 fDeviceSpaceOffset.fY = deviceSpaceOffset.fY - subset.fTop; | 303 fDeviceSpaceOffset.fY = deviceSpaceOffset.fY - subset.fTop; |
304 this->initClassID<GrDeviceSpaceTextureDecalFragmentProcessor>(); | 304 this->initClassID<GrDeviceSpaceTextureDecalFragmentProcessor>(); |
305 this->setWillReadFragmentPosition(); | 305 this->setWillReadFragmentPosition(); |
306 } | 306 } |
307 | 307 |
308 GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
LInstance() const { | 308 GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
LInstance() const { |
309 class GLSLProcessor : public GrGLSLFragmentProcessor { | 309 class GLSLProcessor : public GrGLSLFragmentProcessor { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 SkIRect subset; | 384 SkIRect subset; |
385 subset.fLeft = d->fRandom->nextULessThan(d->fTextures[texIdx]->width() - 1); | 385 subset.fLeft = d->fRandom->nextULessThan(d->fTextures[texIdx]->width() - 1); |
386 subset.fRight = d->fRandom->nextRangeU(subset.fLeft, d->fTextures[texIdx]->w
idth()); | 386 subset.fRight = d->fRandom->nextRangeU(subset.fLeft, d->fTextures[texIdx]->w
idth()); |
387 subset.fTop = d->fRandom->nextULessThan(d->fTextures[texIdx]->height() - 1); | 387 subset.fTop = d->fRandom->nextULessThan(d->fTextures[texIdx]->height() - 1); |
388 subset.fBottom = d->fRandom->nextRangeU(subset.fTop, d->fTextures[texIdx]->h
eight()); | 388 subset.fBottom = d->fRandom->nextRangeU(subset.fTop, d->fTextures[texIdx]->h
eight()); |
389 SkIPoint pt; | 389 SkIPoint pt; |
390 pt.fX = d->fRandom->nextULessThan(2048); | 390 pt.fX = d->fRandom->nextULessThan(2048); |
391 pt.fY = d->fRandom->nextULessThan(2048); | 391 pt.fY = d->fRandom->nextULessThan(2048); |
392 return GrDeviceSpaceTextureDecalFragmentProcessor::Make(d->fTextures[texIdx]
, subset, pt); | 392 return GrDeviceSpaceTextureDecalFragmentProcessor::Make(d->fTextures[texIdx]
, subset, pt); |
393 } | 393 } |
OLD | NEW |