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

Side by Side Diff: include/core/SkPaint.h

Issue 203203005: update comment on setShader to clarify alpha-bitmap behavior in bitmapshaders (Closed) Base URL: https://skia.googlecode.com/svn/trunk
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 | Annotate | Revision Log
« gm/bitmapshader.cpp ('K') | « gm/bitmapshader.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 2
3 /* 3 /*
4 * Copyright 2006 The Android Open Source Project 4 * Copyright 2006 The Android Open Source Project
5 * 5 *
6 * Use of this source code is governed by a BSD-style license that can be 6 * Use of this source code is governed by a BSD-style license that can be
7 * found in the LICENSE file. 7 * found in the LICENSE file.
8 */ 8 */
9 9
10 10
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 SkShader* getShader() const { return fShader; } 507 SkShader* getShader() const { return fShader; }
508 508
509 /** Set or clear the shader object. 509 /** Set or clear the shader object.
510 * Shaders specify the source color(s) for what is being drawn. If a paint 510 * Shaders specify the source color(s) for what is being drawn. If a paint
511 * has no shader, then the paint's color is used. If the paint has a 511 * has no shader, then the paint's color is used. If the paint has a
512 * shader, then the shader's color(s) are use instead, but they are 512 * shader, then the shader's color(s) are use instead, but they are
513 * modulated by the paint's alpha. This makes it easy to create a shader 513 * modulated by the paint's alpha. This makes it easy to create a shader
514 * once (e.g. bitmap tiling or gradient) and then change its transparency 514 * once (e.g. bitmap tiling or gradient) and then change its transparency
515 * w/o having to modify the original shader... only the paint's alpha needs 515 * w/o having to modify the original shader... only the paint's alpha needs
516 * to be modified. 516 * to be modified.
517 * <p /> 517 *
518 * There is an exception to this only-respect-paint's-alpha rule: If the sh ader only generates
519 * alpha (e.g. SkShader::CreateBitmapShader(bitmap, ...) where bitmap's col ortype is kAlpha_8)
520 * then the shader will use the paint's entire color to "colorize" its outp ut (modulating the
521 * bitmap's alpha with the paint's color+alpha).
522 *
518 * Pass NULL to clear any previous shader. 523 * Pass NULL to clear any previous shader.
519 * As a convenience, the parameter passed is also returned. 524 * As a convenience, the parameter passed is also returned.
520 * If a previous shader exists, its reference count is decremented. 525 * If a previous shader exists, its reference count is decremented.
521 * If shader is not NULL, its reference count is incremented. 526 * If shader is not NULL, its reference count is incremented.
522 * @param shader May be NULL. The shader to be installed in the paint 527 * @param shader May be NULL. The shader to be installed in the paint
523 * @return shader 528 * @return shader
524 */ 529 */
525 SkShader* setShader(SkShader* shader); 530 SkShader* setShader(SkShader* shader);
526 531
527 /** Get the paint's colorfilter. If there is a colorfilter, its reference 532 /** Get the paint's colorfilter. If there is a colorfilter, its reference
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 #ifdef SK_BUILD_FOR_ANDROID 1152 #ifdef SK_BUILD_FOR_ANDROID
1148 SkPaintOptionsAndroid fPaintOptionsAndroid; 1153 SkPaintOptionsAndroid fPaintOptionsAndroid;
1149 1154
1150 // In order for the == operator to work properly this must be the last field 1155 // In order for the == operator to work properly this must be the last field
1151 // in the struct so that we can do a memcmp to this field's offset. 1156 // in the struct so that we can do a memcmp to this field's offset.
1152 uint32_t fGenerationID; 1157 uint32_t fGenerationID;
1153 #endif 1158 #endif
1154 }; 1159 };
1155 1160
1156 #endif 1161 #endif
OLDNEW
« gm/bitmapshader.cpp ('K') | « gm/bitmapshader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698