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

Side by Side Diff: src/effects/SkColorFilters.cpp

Issue 628633003: gl programs rewrite (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: build fix Created 6 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
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/gpu/GrDrawState.h » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkBlitRow.h" 8 #include "SkBlitRow.h"
9 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect); 400 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect);
401 GrFragmentProcessor* ModeColorFilterEffect::TestCreate(SkRandom* rand, 401 GrFragmentProcessor* ModeColorFilterEffect::TestCreate(SkRandom* rand,
402 GrContext*, 402 GrContext*,
403 const GrDrawTargetCaps&, 403 const GrDrawTargetCaps&,
404 GrTexture*[]) { 404 GrTexture*[]) {
405 SkXfermode::Mode mode = SkXfermode::kDst_Mode; 405 SkXfermode::Mode mode = SkXfermode::kDst_Mode;
406 while (SkXfermode::kDst_Mode == mode) { 406 while (SkXfermode::kDst_Mode == mode) {
407 mode = static_cast<SkXfermode::Mode>(rand->nextRangeU(0, SkXfermode::kLa stCoeffMode)); 407 mode = static_cast<SkXfermode::Mode>(rand->nextRangeU(0, SkXfermode::kLa stCoeffMode));
408 } 408 }
409 GrColor color = rand->nextU(); 409
410 // pick a random premul color
411 uint8_t alpha = rand->nextULessThan(256);
412 GrColor color = GrColorPackRGBA(rand->nextRangeU(0, alpha),
413 rand->nextRangeU(0, alpha),
414 rand->nextRangeU(0, alpha),
415 alpha);
410 return ModeColorFilterEffect::Create(color, mode); 416 return ModeColorFilterEffect::Create(color, mode);
411 } 417 }
412 418
413 GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*) const { 419 GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*) const {
414 if (SkXfermode::kDst_Mode != fMode) { 420 if (SkXfermode::kDst_Mode != fMode) {
415 return ModeColorFilterEffect::Create(SkColor2GrColor(fColor), fMode); 421 return ModeColorFilterEffect::Create(SkColor2GrColor(fColor), fMode);
416 } 422 }
417 return NULL; 423 return NULL;
418 } 424 }
419 425
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), 552 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)),
547 SkIntToScalar(SkColorGetG(add)), 553 SkIntToScalar(SkColorGetG(add)),
548 SkIntToScalar(SkColorGetB(add)), 554 SkIntToScalar(SkColorGetB(add)),
549 0); 555 0);
550 return SkColorMatrixFilter::Create(matrix); 556 return SkColorMatrixFilter::Create(matrix);
551 } 557 }
552 558
553 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter) 559 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter)
554 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkModeColorFilter) 560 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkModeColorFilter)
555 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 561 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698