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

Side by Side Diff: Source/platform/graphics/skia/SkiaUtils.h

Issue 900463002: Make SVG painting independent of GraphicsContext's alpha state (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address reviewer comments Created 5 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. 2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "wtf/MathExtras.h" 45 #include "wtf/MathExtras.h"
46 46
47 namespace blink { 47 namespace blink {
48 48
49 class GraphicsContext; 49 class GraphicsContext;
50 50
51 SkXfermode::Mode PLATFORM_EXPORT WebCoreCompositeToSkiaComposite(CompositeOperat or, WebBlendMode = WebBlendModeNormal); 51 SkXfermode::Mode PLATFORM_EXPORT WebCoreCompositeToSkiaComposite(CompositeOperat or, WebBlendMode = WebBlendModeNormal);
52 CompositeOperator PLATFORM_EXPORT compositeOperatorFromSkia(SkXfermode::Mode); 52 CompositeOperator PLATFORM_EXPORT compositeOperatorFromSkia(SkXfermode::Mode);
53 WebBlendMode PLATFORM_EXPORT blendModeFromSkia(SkXfermode::Mode); 53 WebBlendMode PLATFORM_EXPORT blendModeFromSkia(SkXfermode::Mode);
54 54
55 // Map alpha values from [0, 1] to [0, 256] for alpha blending.
56 int PLATFORM_EXPORT clampedAlphaForBlending(float);
57
58 // Multiply a color's alpha channel by an additional alpha factor where
59 // alpha is in the range [0, 1].
60 SkColor PLATFORM_EXPORT multiplyAlpha(SkColor, float);
61
62 // Multiply a color's alpha channel by an additional alpha factor where
63 // alpha is in the range [0, 256].
64 SkColor PLATFORM_EXPORT multiplyAlpha(SkColor, int);
65
55 inline SkPaint::FilterLevel WebCoreInterpolationQualityToSkFilterLevel(Interpola tionQuality quality) 66 inline SkPaint::FilterLevel WebCoreInterpolationQualityToSkFilterLevel(Interpola tionQuality quality)
56 { 67 {
57 // FIXME: this reflects existing client mappings, but should probably 68 // FIXME: this reflects existing client mappings, but should probably
58 // be expanded to map higher level interpolations more accurately. 69 // be expanded to map higher level interpolations more accurately.
59 return quality != InterpolationNone ? SkPaint::kLow_FilterLevel : SkPaint::k None_FilterLevel; 70 return quality != InterpolationNone ? SkPaint::kLow_FilterLevel : SkPaint::k None_FilterLevel;
60 } 71 }
61 72
62 // Skia has problems when passed infinite, etc floats, filter them to 0. 73 // Skia has problems when passed infinite, etc floats, filter them to 0.
63 inline SkScalar WebCoreFloatToSkScalar(float f) 74 inline SkScalar WebCoreFloatToSkScalar(float f)
64 { 75 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 float srcHeight, 112 float srcHeight,
102 float destWidth, 113 float destWidth,
103 float destHeight, 114 float destHeight,
104 bool isDataComplete = true); 115 bool isDataComplete = true);
105 116
106 bool shouldDrawAntiAliased(const GraphicsContext*, const SkRect& destRect); 117 bool shouldDrawAntiAliased(const GraphicsContext*, const SkRect& destRect);
107 118
108 } // namespace blink 119 } // namespace blink
109 120
110 #endif // SkiaUtils_h 121 #endif // SkiaUtils_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsContextState.cpp ('k') | Source/platform/graphics/skia/SkiaUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698