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

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

Issue 196473010: bitmapshader with A8 bitmap should be colorized by the paint's color (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« include/core/SkShader.h ('K') | « src/core/SkBitmapProcShader.h ('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/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 568
569 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing state and require 569 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing state and require
570 // the shader to set a render target . 570 // the shader to set a render target .
571 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL); 571 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL);
572 572
573 // setup the shader as the first color effect on the paint 573 // setup the shader as the first color effect on the paint
574 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint )); 574 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint ));
575 if (NULL != effect.get()) { 575 if (NULL != effect.get()) {
576 grPaint->addColorEffect(effect); 576 grPaint->addColorEffect(effect);
577 // Now setup the rest of the paint. 577 // Now setup the rest of the paint.
578 // If the shader's bitmap is kA8_Config, the paint's RGB is used, and
579 // modulated by the shader's alpha. Otherwise, the shader's RGB is used,
580 // modulated by the paint's alpha.
581 SkBitmap* bitmap = shader->getBitmap();
582 if (NULL != bitmap && SkBitmap::kA8_Config == bitmap->config()) {
583 return skPaint2GrPaintNoShader(dev, skPaint, false, true, grPaint);
584 }
578 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); 585 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint);
579 } else { 586 } else {
580 // We still don't have SkColorShader::asNewEffect() implemented. 587 // We still don't have SkColorShader::asNewEffect() implemented.
581 SkShader::GradientInfo info; 588 SkShader::GradientInfo info;
582 SkColor color; 589 SkColor color;
583 590
584 info.fColors = &color; 591 info.fColors = &color;
585 info.fColorOffsets = NULL; 592 info.fColorOffsets = NULL;
586 info.fColorCount = 1; 593 info.fColorCount = 1;
587 if (SkShader::kColor_GradientType == shader->asAGradient(&info)) { 594 if (SkShader::kColor_GradientType == shader->asAGradient(&info)) {
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 GrTexture* texture, 1999 GrTexture* texture,
1993 bool needClear) 2000 bool needClear)
1994 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 2001 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1995 2002
1996 SkASSERT(texture && texture->asRenderTarget()); 2003 SkASSERT(texture && texture->asRenderTarget());
1997 // This constructor is called from onCreateDevice. It has locked the RT in t he texture 2004 // This constructor is called from onCreateDevice. It has locked the RT in t he texture
1998 // cache. We pass true for the third argument so that it will get unlocked. 2005 // cache. We pass true for the third argument so that it will get unlocked.
1999 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 2006 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
2000 fNeedClear = needClear; 2007 fNeedClear = needClear;
2001 } 2008 }
OLDNEW
« include/core/SkShader.h ('K') | « src/core/SkBitmapProcShader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698