| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return 0.0f; | 118 return 0.0f; |
| 119 return 0.288675f * radius + 0.5f; | 119 return 0.288675f * radius + 0.5f; |
| 120 } | 120 } |
| 121 | 121 |
| 122 template<typename PrimitiveType> | 122 template<typename PrimitiveType> |
| 123 void drawPlatformFocusRing(const PrimitiveType&, SkCanvas*, SkColor, int width); | 123 void drawPlatformFocusRing(const PrimitiveType&, SkCanvas*, SkColor, int width); |
| 124 | 124 |
| 125 // TODO(fmalita): remove in favor of direct SrcRectConstraint use. | 125 // TODO(fmalita): remove in favor of direct SrcRectConstraint use. |
| 126 inline SkCanvas::SrcRectConstraint WebCoreClampingModeToSkiaRectConstraint(Image
::ImageClampingMode clampMode) | 126 inline SkCanvas::SrcRectConstraint WebCoreClampingModeToSkiaRectConstraint(Image
::ImageClampingMode clampMode) |
| 127 { | 127 { |
| 128 return clampMode == Image::ClampImageToSourceRect | 128 return SkCanvas::kFast_SrcRectConstraint; |
| 129 ? SkCanvas::kStrict_SrcRectConstraint | |
| 130 : SkCanvas::kFast_SrcRectConstraint; | |
| 131 } | 129 } |
| 132 | 130 |
| 133 // Skia's smart pointer APIs are preferable over their legacy raw pointer counte
rparts. | 131 // Skia's smart pointer APIs are preferable over their legacy raw pointer counte
rparts. |
| 134 // The following helpers ensure interoperability between Skia's SkRefCnt wrapper
sk_sp<T> and | 132 // The following helpers ensure interoperability between Skia's SkRefCnt wrapper
sk_sp<T> and |
| 135 // Blink's RefPtr<T>/PassRefPtr<T>. | 133 // Blink's RefPtr<T>/PassRefPtr<T>. |
| 136 // | 134 // |
| 137 // - fromSkSp(sk_sp<T>): adopts an sk_sp into a PassRefPtr (to be used w
hen transferring | 135 // - fromSkSp(sk_sp<T>): adopts an sk_sp into a PassRefPtr (to be used w
hen transferring |
| 138 // ownership from Skia to Blink). | 136 // ownership from Skia to Blink). |
| 139 // - toSkSp(PassRefPtr<T>): releases a PassRefPtr into a sk_sp (to be used
when transferring | 137 // - toSkSp(PassRefPtr<T>): releases a PassRefPtr into a sk_sp (to be used
when transferring |
| 140 // ownership from Blink to Skia). | 138 // ownership from Blink to Skia). |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 201 } |
| 204 | 202 |
| 205 template <typename T> sk_sp<T> toSkSp(const RefPtr<T>& ref) | 203 template <typename T> sk_sp<T> toSkSp(const RefPtr<T>& ref) |
| 206 { | 204 { |
| 207 return toSkSp(PassRefPtr<T>(ref)); | 205 return toSkSp(PassRefPtr<T>(ref)); |
| 208 } | 206 } |
| 209 | 207 |
| 210 } // namespace blink | 208 } // namespace blink |
| 211 | 209 |
| 212 #endif // SkiaUtils_h | 210 #endif // SkiaUtils_h |
| OLD | NEW |