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

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

Issue 643743003: Create helper functions to use in computeInvariantOutput calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update blurMaskFilter 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 | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.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 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 typedef MaskedColorExpr AExpr; 377 typedef MaskedColorExpr AExpr;
378 private: 378 private:
379 float fColor[4]; 379 float fColor[4];
380 uint32_t fFlags; 380 uint32_t fFlags;
381 }; 381 };
382 382
383 } 383 }
384 384
385 void ModeColorFilterEffect::onComputeInvariantOutput(InvariantOutput* inout) con st { 385 void ModeColorFilterEffect::onComputeInvariantOutput(InvariantOutput* inout) con st {
386 float inputColor[4]; 386 float inputColor[4];
387 GrColorToRGBAFloat(inout->fColor, inputColor); 387 GrColorToRGBAFloat(inout->color(), inputColor);
388 float filterColor[4]; 388 float filterColor[4];
389 GrColorToRGBAFloat(fColor, filterColor); 389 GrColorToRGBAFloat(fColor, filterColor);
390 MaskedColorExpr result = 390 MaskedColorExpr result =
391 color_filter_expression(fMode, 391 color_filter_expression(fMode,
392 MaskedColorExpr(filterColor, kRGBA_GrColorCompon entFlags), 392 MaskedColorExpr(filterColor, kRGBA_GrColorCompon entFlags),
393 MaskedColorExpr(inputColor, inout->fValidFlags)) ; 393 MaskedColorExpr(inputColor, inout->validFlags()) );
394 394
395 inout->fColor = result.getColor(); 395 inout->setToOther(result.getValidComponents(), result.getColor());
396 inout->fValidFlags = result.getValidComponents();
397 inout->fIsSingleComponent = false;
398 } 396 }
399 397
400 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect); 398 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect);
401 GrFragmentProcessor* ModeColorFilterEffect::TestCreate(SkRandom* rand, 399 GrFragmentProcessor* ModeColorFilterEffect::TestCreate(SkRandom* rand,
402 GrContext*, 400 GrContext*,
403 const GrDrawTargetCaps&, 401 const GrDrawTargetCaps&,
404 GrTexture*[]) { 402 GrTexture*[]) {
405 SkXfermode::Mode mode = SkXfermode::kDst_Mode; 403 SkXfermode::Mode mode = SkXfermode::kDst_Mode;
406 while (SkXfermode::kDst_Mode == mode) { 404 while (SkXfermode::kDst_Mode == mode) {
407 mode = static_cast<SkXfermode::Mode>(rand->nextRangeU(0, SkXfermode::kLa stCoeffMode)); 405 mode = static_cast<SkXfermode::Mode>(rand->nextRangeU(0, SkXfermode::kLa stCoeffMode));
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), 550 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)),
553 SkIntToScalar(SkColorGetG(add)), 551 SkIntToScalar(SkColorGetG(add)),
554 SkIntToScalar(SkColorGetB(add)), 552 SkIntToScalar(SkColorGetB(add)),
555 0); 553 0);
556 return SkColorMatrixFilter::Create(matrix); 554 return SkColorMatrixFilter::Create(matrix);
557 } 555 }
558 556
559 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter) 557 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter)
560 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkModeColorFilter) 558 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkModeColorFilter)
561 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 559 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698