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: third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h

Issue 2255683005: Determine if OffscreenCanvas is paintable in different rendering contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Canvas2DTypecast
Patch Set: fix based on feedback Created 4 years, 4 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 | « third_party/WebKit/Source/platform/graphics/ImageBuffer.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 * 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 30 matching lines...) Expand all
41 #include "third_party/skia/include/core/SkColor.h" 41 #include "third_party/skia/include/core/SkColor.h"
42 #include "third_party/skia/include/core/SkRefCnt.h" 42 #include "third_party/skia/include/core/SkRefCnt.h"
43 #include "third_party/skia/include/core/SkScalar.h" 43 #include "third_party/skia/include/core/SkScalar.h"
44 #include "third_party/skia/include/core/SkXfermode.h" 44 #include "third_party/skia/include/core/SkXfermode.h"
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 /**** constants ****/
52
53 // Firefox limits width/height to 32767 pixels, but slows down dramatically befo re it
54 // reaches that limit. We limit by area instead, giving us larger maximum dimens ions,
55 // in exchange for a smaller maximum canvas size.
56 const int PLATFORM_EXPORT MaxCanvasArea = 32768 * 8192; // Maximum canvas area i n CSS pixels
Justin Novosad 2016/08/19 17:30:01 Defining a const in a header can lead to symbol cl
xlai (Olivia) 2016/08/19 17:42:03 Done.
57
58 // In Skia, we will also limit width/height to 32767.
59 const int PLATFORM_EXPORT MaxSkiaDim = 32767; // Maximum width/height in CSS pix els.
60
51 SkXfermode::Mode PLATFORM_EXPORT WebCoreCompositeToSkiaComposite(CompositeOperat or, WebBlendMode = WebBlendModeNormal); 61 SkXfermode::Mode PLATFORM_EXPORT WebCoreCompositeToSkiaComposite(CompositeOperat or, WebBlendMode = WebBlendModeNormal);
52 CompositeOperator PLATFORM_EXPORT compositeOperatorFromSkia(SkXfermode::Mode); 62 CompositeOperator PLATFORM_EXPORT compositeOperatorFromSkia(SkXfermode::Mode);
53 WebBlendMode PLATFORM_EXPORT blendModeFromSkia(SkXfermode::Mode); 63 WebBlendMode PLATFORM_EXPORT blendModeFromSkia(SkXfermode::Mode);
54 64
55 // Map alpha values from [0, 1] to [0, 256] for alpha blending. 65 // Map alpha values from [0, 1] to [0, 256] for alpha blending.
56 int PLATFORM_EXPORT clampedAlphaForBlending(float); 66 int PLATFORM_EXPORT clampedAlphaForBlending(float);
57 67
58 // Multiply a color's alpha channel by an additional alpha factor where 68 // Multiply a color's alpha channel by an additional alpha factor where
59 // alpha is in the range [0, 1]. 69 // alpha is in the range [0, 1].
60 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, float); 70 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, float);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 213 }
204 214
205 template <typename T> sk_sp<T> toSkSp(const RefPtr<T>& ref) 215 template <typename T> sk_sp<T> toSkSp(const RefPtr<T>& ref)
206 { 216 {
207 return toSkSp(PassRefPtr<T>(ref)); 217 return toSkSp(PassRefPtr<T>(ref));
208 } 218 }
209 219
210 } // namespace blink 220 } // namespace blink
211 221
212 #endif // SkiaUtils_h 222 #endif // SkiaUtils_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698