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

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: enum 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
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 enum {
54 // Firefox limits width/height to 32767 pixels, but slows down dramatically before it
55 // reaches that limit. We limit by area instead, giving us larger maximum di mensions,
56 // in exchange for a smaller maximum canvas size.
57 kMaxCanvasArea = 32768 * 8192, // Maximum canvas area in CSS pixels
58
59 // In Skia, we will also limit width/height to 32767.
60 kMaxSkiaDim = 32767 // Maximum width/height in CSS pixels.
61 };
62
51 SkXfermode::Mode PLATFORM_EXPORT WebCoreCompositeToSkiaComposite(CompositeOperat or, WebBlendMode = WebBlendModeNormal); 63 SkXfermode::Mode PLATFORM_EXPORT WebCoreCompositeToSkiaComposite(CompositeOperat or, WebBlendMode = WebBlendModeNormal);
52 CompositeOperator PLATFORM_EXPORT compositeOperatorFromSkia(SkXfermode::Mode); 64 CompositeOperator PLATFORM_EXPORT compositeOperatorFromSkia(SkXfermode::Mode);
53 WebBlendMode PLATFORM_EXPORT blendModeFromSkia(SkXfermode::Mode); 65 WebBlendMode PLATFORM_EXPORT blendModeFromSkia(SkXfermode::Mode);
54 66
55 // Map alpha values from [0, 1] to [0, 256] for alpha blending. 67 // Map alpha values from [0, 1] to [0, 256] for alpha blending.
56 int PLATFORM_EXPORT clampedAlphaForBlending(float); 68 int PLATFORM_EXPORT clampedAlphaForBlending(float);
57 69
58 // Multiply a color's alpha channel by an additional alpha factor where 70 // Multiply a color's alpha channel by an additional alpha factor where
59 // alpha is in the range [0, 1]. 71 // alpha is in the range [0, 1].
60 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, float); 72 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, float);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 215 }
204 216
205 template <typename T> sk_sp<T> toSkSp(const RefPtr<T>& ref) 217 template <typename T> sk_sp<T> toSkSp(const RefPtr<T>& ref)
206 { 218 {
207 return toSkSp(PassRefPtr<T>(ref)); 219 return toSkSp(PassRefPtr<T>(ref));
208 } 220 }
209 221
210 } // namespace blink 222 } // namespace blink
211 223
212 #endif // SkiaUtils_h 224 #endif // SkiaUtils_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698