| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 4 * Copyright (C) 2007-2008 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2008 Torch Mobile, Inc. |
| 5 * Copyright (C) 2013 Google, Inc. All rights reserved. | 5 * Copyright (C) 2013 Google, Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 kRepeatModeY = 1 << 1, | 52 kRepeatModeY = 1 << 1, |
| 53 | 53 |
| 54 kRepeatModeNone = 0, | 54 kRepeatModeNone = 0, |
| 55 kRepeatModeXY = kRepeatModeX | kRepeatModeY | 55 kRepeatModeXY = kRepeatModeX | kRepeatModeY |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 static PassRefPtr<Pattern> CreateImagePattern(PassRefPtr<Image>, | 58 static PassRefPtr<Pattern> CreateImagePattern(PassRefPtr<Image>, |
| 59 RepeatMode = kRepeatModeXY); | 59 RepeatMode = kRepeatModeXY); |
| 60 static PassRefPtr<Pattern> CreatePaintRecordPattern( | 60 static PassRefPtr<Pattern> CreatePaintRecordPattern( |
| 61 sk_sp<PaintRecord>, | 61 sk_sp<PaintRecord>, |
| 62 const FloatRect& record_bounds, |
| 62 RepeatMode = kRepeatModeXY); | 63 RepeatMode = kRepeatModeXY); |
| 63 virtual ~Pattern(); | 64 virtual ~Pattern(); |
| 64 | 65 |
| 65 void ApplyToFlags(PaintFlags&, const SkMatrix&); | 66 void ApplyToFlags(PaintFlags&, const SkMatrix&); |
| 66 | 67 |
| 67 bool IsRepeatX() const { return repeat_mode_ & kRepeatModeX; } | 68 bool IsRepeatX() const { return repeat_mode_ & kRepeatModeX; } |
| 68 bool IsRepeatY() const { return repeat_mode_ & kRepeatModeY; } | 69 bool IsRepeatY() const { return repeat_mode_ & kRepeatModeY; } |
| 69 bool IsRepeatXY() const { return repeat_mode_ == kRepeatModeXY; } | 70 bool IsRepeatXY() const { return repeat_mode_ == kRepeatModeXY; } |
| 70 | 71 |
| 71 virtual bool IsTextureBacked() const { return false; } | 72 virtual bool IsTextureBacked() const { return false; } |
| 72 | 73 |
| 73 protected: | 74 protected: |
| 74 virtual sk_sp<PaintShader> CreateShader(const SkMatrix&) = 0; | 75 virtual sk_sp<PaintShader> CreateShader(const SkMatrix&) = 0; |
| 75 virtual bool IsLocalMatrixChanged(const SkMatrix&) const; | 76 virtual bool IsLocalMatrixChanged(const SkMatrix&) const; |
| 76 | 77 |
| 77 RepeatMode repeat_mode_; | 78 RepeatMode repeat_mode_; |
| 78 | 79 |
| 79 Pattern(RepeatMode); | 80 Pattern(RepeatMode); |
| 80 mutable sk_sp<PaintShader> cached_shader_; | 81 mutable sk_sp<PaintShader> cached_shader_; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } // namespace blink | 84 } // namespace blink |
| 84 | 85 |
| 85 #endif | 86 #endif |
| OLD | NEW |