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

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

Issue 13097006: Add interface to SkXfermode to return a GrEffect and blend coeffs. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add SkGpuDevice.cpp Created 7 years, 9 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 | Annotate | Revision Log
« src/core/SkXfermode.cpp ('K') | « src/core/SkXfermode.cpp ('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 2011 Google Inc. 2 * Copyright 2011 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 "effects/GrTextureDomainEffect.h" 10 #include "effects/GrTextureDomainEffect.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 bool constantColor, 477 bool constantColor,
478 GrPaint* grPaint) { 478 GrPaint* grPaint) {
479 479
480 grPaint->setDither(skPaint.isDither()); 480 grPaint->setDither(skPaint.isDither());
481 grPaint->setAntiAlias(skPaint.isAntiAlias()); 481 grPaint->setAntiAlias(skPaint.isAntiAlias());
482 482
483 SkXfermode::Coeff sm = SkXfermode::kOne_Coeff; 483 SkXfermode::Coeff sm = SkXfermode::kOne_Coeff;
484 SkXfermode::Coeff dm = SkXfermode::kISA_Coeff; 484 SkXfermode::Coeff dm = SkXfermode::kISA_Coeff;
485 485
486 SkXfermode* mode = skPaint.getXfermode(); 486 SkXfermode* mode = skPaint.getXfermode();
487 if (mode) { 487 GrEffectRef* xferEffect;
488 if (!mode->asCoeff(&sm, &dm)) { 488 if (SkXfermode::AsNewEffect(mode, dev->context(), &xferEffect, &sm, &dm)) {
489 //SkDEBUGCODE(SkDebugf("Unsupported xfer mode.\n");) 489 // We're not ready for xfermode effects yet
490 GrAssert(NULL == xferEffect);
491 } else {
492 //SkDEBUGCODE(SkDebugf("Unsupported xfer mode.\n");)
490 #if 0 493 #if 0
491 return false; 494 return false;
492 #endif 495 #endif
493 }
494 } 496 }
495 grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); 497 grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm));
496 498
497 if (justAlpha) { 499 if (justAlpha) {
498 uint8_t alpha = skPaint.getAlpha(); 500 uint8_t alpha = skPaint.getAlpha();
499 grPaint->setColor(GrColorPackRGBA(alpha, alpha, alpha, alpha)); 501 grPaint->setColor(GrColorPackRGBA(alpha, alpha, alpha, alpha));
500 // justAlpha is currently set to true only if there is a texture, 502 // justAlpha is currently set to true only if there is a texture,
501 // so constantColor should not also be true. 503 // so constantColor should not also be true.
502 GrAssert(!constantColor); 504 GrAssert(!constantColor);
503 } else { 505 } else {
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 GrTexture* texture, 1836 GrTexture* texture,
1835 bool needClear) 1837 bool needClear)
1836 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { 1838 : SkDevice(make_bitmap(context, texture->asRenderTarget())) {
1837 1839
1838 GrAssert(texture && texture->asRenderTarget()); 1840 GrAssert(texture && texture->asRenderTarget());
1839 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1841 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1840 // cache. We pass true for the third argument so that it will get unlocked. 1842 // cache. We pass true for the third argument so that it will get unlocked.
1841 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1843 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1842 fNeedClear = needClear; 1844 fNeedClear = needClear;
1843 } 1845 }
OLDNEW
« src/core/SkXfermode.cpp ('K') | « src/core/SkXfermode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698