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

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

Issue 25023003: Implement color filter as GrGLEffect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 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
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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 if (NULL != colorFilter) { 501 if (NULL != colorFilter) {
502 // if the source color is a constant then apply the filter here once rat her than per pixel 502 // if the source color is a constant then apply the filter here once rat her than per pixel
503 // in a shader. 503 // in a shader.
504 if (constantColor) { 504 if (constantColor) {
505 SkColor filtered = colorFilter->filterColor(skPaint.getColor()); 505 SkColor filtered = colorFilter->filterColor(skPaint.getColor());
506 grPaint->setColor(SkColor2GrColor(filtered)); 506 grPaint->setColor(SkColor2GrColor(filtered));
507 } else { 507 } else {
508 SkAutoTUnref<GrEffectRef> effect(colorFilter->asNewEffect(dev->conte xt())); 508 SkAutoTUnref<GrEffectRef> effect(colorFilter->asNewEffect(dev->conte xt()));
509 if (NULL != effect.get()) { 509 if (NULL != effect.get()) {
510 grPaint->addColorEffect(effect); 510 grPaint->addColorEffect(effect);
511 } else {
512 // TODO: rewrite this using asNewEffect()
513 SkColor color;
514 SkXfermode::Mode filterMode;
515 if (colorFilter->asColorMode(&color, &filterMode)) {
516 grPaint->setXfermodeColorFilter(filterMode, SkColor2GrColor( color));
517 }
518 } 511 }
519 } 512 }
520 } 513 }
521 514
522 return true; 515 return true;
523 } 516 }
524 517
525 // This function is similar to skPaint2GrPaintNoShader but also converts 518 // This function is similar to skPaint2GrPaintNoShader but also converts
526 // skPaint's shader to a GrTexture/GrEffectStage if possible. The texture to 519 // skPaint's shader to a GrTexture/GrEffectStage if possible. The texture to
527 // be used is set on grPaint and returned in param act. constantColor has the 520 // be used is set on grPaint and returned in param act. constantColor has the
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 GrTexture* texture, 1871 GrTexture* texture,
1879 bool needClear) 1872 bool needClear)
1880 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1873 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1881 1874
1882 SkASSERT(texture && texture->asRenderTarget()); 1875 SkASSERT(texture && texture->asRenderTarget());
1883 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1876 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1884 // cache. We pass true for the third argument so that it will get unlocked. 1877 // cache. We pass true for the third argument so that it will get unlocked.
1885 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1878 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1886 fNeedClear = needClear; 1879 fNeedClear = needClear;
1887 } 1880 }
OLDNEW
« src/gpu/GrDrawState.h ('K') | « src/gpu/GrPaint.cpp ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698