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

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

Issue 23707019: alpha threshold bitmap shader (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: false->NULL Created 7 years, 3 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
« no previous file with comments | « src/effects/SkBitmapAlphaThresholdShader.cpp ('k') | tests/GLProgramsTest.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 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // same meaning as in skPaint2GrPaintNoShader. 528 // same meaning as in skPaint2GrPaintNoShader.
529 inline bool skPaint2GrPaintShader(SkGpuDevice* dev, 529 inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
530 const SkPaint& skPaint, 530 const SkPaint& skPaint,
531 bool constantColor, 531 bool constantColor,
532 GrPaint* grPaint) { 532 GrPaint* grPaint) {
533 SkShader* shader = skPaint.getShader(); 533 SkShader* shader = skPaint.getShader();
534 if (NULL == shader) { 534 if (NULL == shader) {
535 return skPaint2GrPaintNoShader(dev, skPaint, false, constantColor, grPai nt); 535 return skPaint2GrPaintNoShader(dev, skPaint, false, constantColor, grPai nt);
536 } 536 }
537 537
538 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing state
539 // Also require shader to set the render target .
540 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL);
541 GrContext::AutoRenderTarget(dev->context(), NULL);
542
538 // setup the shader as the first color effect on the paint 543 // setup the shader as the first color effect on the paint
539 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint )); 544 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint ));
540 if (NULL != effect.get()) { 545 if (NULL != effect.get()) {
541 grPaint->addColorEffect(effect); 546 grPaint->addColorEffect(effect);
542 // Now setup the rest of the paint. 547 // Now setup the rest of the paint.
543 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); 548 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint);
544 } else { 549 } else {
545 // We still don't have SkColorShader::asNewEffect() implemented. 550 // We still don't have SkColorShader::asNewEffect() implemented.
546 SkShader::GradientInfo info; 551 SkShader::GradientInfo info;
547 SkColor color; 552 SkColor color;
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 GrTexture* texture, 1864 GrTexture* texture,
1860 bool needClear) 1865 bool needClear)
1861 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1866 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1862 1867
1863 SkASSERT(texture && texture->asRenderTarget()); 1868 SkASSERT(texture && texture->asRenderTarget());
1864 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1869 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1865 // cache. We pass true for the third argument so that it will get unlocked. 1870 // cache. We pass true for the third argument so that it will get unlocked.
1866 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1871 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1867 fNeedClear = needClear; 1872 fNeedClear = needClear;
1868 } 1873 }
OLDNEW
« no previous file with comments | « src/effects/SkBitmapAlphaThresholdShader.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698